This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import pytest
|
||||
import logging
|
||||
|
||||
import pytest
|
||||
import sqlparse
|
||||
from sqlalchemy import create_engine, event
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
@@ -14,12 +16,36 @@ def pytest_addoption(parser):
|
||||
)
|
||||
|
||||
|
||||
class SqlParseFormatter(logging.Formatter):
|
||||
def format(self, record):
|
||||
recordMessage = record.getMessage()
|
||||
if not recordMessage.startswith("[") and any(
|
||||
recordMessage.startswith(keyword)
|
||||
for keyword in [
|
||||
"SELECT",
|
||||
"INSERT",
|
||||
"UPDATE",
|
||||
"DELETE",
|
||||
"WITH",
|
||||
]
|
||||
):
|
||||
formatted_sql = sqlparse.format(recordMessage, reindent=True, keyword_case="upper")
|
||||
record.msg = "\n" + formatted_sql
|
||||
|
||||
return super().format(record)
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def sql_session(request):
|
||||
"""Create a new SQLAlchemy session for testing."""
|
||||
|
||||
echo = request.config.getoption("--echo")
|
||||
logging.basicConfig()
|
||||
logger = logging.getLogger("sqlalchemy.engine")
|
||||
handler = logging.StreamHandler()
|
||||
handler.setFormatter(SqlParseFormatter())
|
||||
logger.addHandler(handler)
|
||||
|
||||
echo = request.config.getoption("--echo")
|
||||
engine = create_engine(
|
||||
"sqlite:///:memory:",
|
||||
echo=echo,
|
||||
|
||||
@@ -1,18 +1,23 @@
|
||||
import pytest
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
import pytest
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from dibbler.models import Transaction, User
|
||||
from dibbler.queries import adjust_interest, current_interest
|
||||
|
||||
|
||||
def test_adjust_interest_no_history(sql_session: Session) -> None:
|
||||
def insert_test_data(sql_session: Session) -> User:
|
||||
user = User("Test User")
|
||||
sql_session.add(user)
|
||||
sql_session.commit()
|
||||
|
||||
return user
|
||||
|
||||
|
||||
def test_adjust_interest_no_history(sql_session: Session) -> None:
|
||||
user = insert_test_data(sql_session)
|
||||
|
||||
adjust_interest(
|
||||
sql_session,
|
||||
user_id=user.id,
|
||||
@@ -27,9 +32,7 @@ def test_adjust_interest_no_history(sql_session: Session) -> None:
|
||||
|
||||
|
||||
def test_adjust_interest_existing_history(sql_session: Session) -> None:
|
||||
user = User("Test User")
|
||||
sql_session.add(user)
|
||||
sql_session.commit()
|
||||
user = insert_test_data(sql_session)
|
||||
|
||||
transactions = [
|
||||
Transaction.adjust_interest(
|
||||
@@ -58,9 +61,7 @@ def test_adjust_interest_existing_history(sql_session: Session) -> None:
|
||||
|
||||
|
||||
def test_adjust_interest_negative_failure(sql_session: Session) -> None:
|
||||
user = User("Test User")
|
||||
sql_session.add(user)
|
||||
sql_session.commit()
|
||||
user = insert_test_data(sql_session)
|
||||
|
||||
with pytest.raises(ValueError, match="Interest rate cannot be negative"):
|
||||
adjust_interest(
|
||||
|
||||
@@ -11,11 +11,17 @@ from dibbler.models.Transaction import (
|
||||
from dibbler.queries import adjust_penalty, current_penalty
|
||||
|
||||
|
||||
def test_adjust_penalty_no_history(sql_session: Session) -> None:
|
||||
def insert_test_data(sql_session: Session) -> User:
|
||||
user = User("Test User")
|
||||
sql_session.add(user)
|
||||
sql_session.commit()
|
||||
|
||||
return user
|
||||
|
||||
|
||||
def test_adjust_penalty_no_history(sql_session: Session) -> None:
|
||||
user = insert_test_data(sql_session)
|
||||
|
||||
adjust_penalty(
|
||||
sql_session,
|
||||
user_id=user.id,
|
||||
@@ -31,9 +37,7 @@ def test_adjust_penalty_no_history(sql_session: Session) -> None:
|
||||
|
||||
|
||||
def test_adjust_penalty_multiplier_no_history(sql_session: Session) -> None:
|
||||
user = User("Test User")
|
||||
sql_session.add(user)
|
||||
sql_session.commit()
|
||||
user = insert_test_data(sql_session)
|
||||
|
||||
adjust_penalty(
|
||||
sql_session,
|
||||
@@ -50,9 +54,7 @@ def test_adjust_penalty_multiplier_no_history(sql_session: Session) -> None:
|
||||
|
||||
|
||||
def test_adjust_penalty_multiplier_less_than_100_fail(sql_session: Session) -> None:
|
||||
user = User("Test User")
|
||||
sql_session.add(user)
|
||||
sql_session.commit()
|
||||
user = insert_test_data(sql_session)
|
||||
|
||||
adjust_penalty(
|
||||
sql_session,
|
||||
@@ -76,9 +78,7 @@ def test_adjust_penalty_multiplier_less_than_100_fail(sql_session: Session) -> N
|
||||
|
||||
|
||||
def test_adjust_penalty_existing_history(sql_session: Session) -> None:
|
||||
user = User("Test User")
|
||||
sql_session.add(user)
|
||||
sql_session.commit()
|
||||
user = insert_test_data(sql_session)
|
||||
|
||||
transactions = [
|
||||
Transaction.adjust_penalty(
|
||||
@@ -108,9 +108,7 @@ def test_adjust_penalty_existing_history(sql_session: Session) -> None:
|
||||
|
||||
|
||||
def test_adjust_penalty_multiplier_existing_history(sql_session: Session) -> None:
|
||||
user = User("Test User")
|
||||
sql_session.add(user)
|
||||
sql_session.commit()
|
||||
user = insert_test_data(sql_session)
|
||||
|
||||
transactions = [
|
||||
Transaction.adjust_penalty(
|
||||
@@ -139,9 +137,7 @@ def test_adjust_penalty_multiplier_existing_history(sql_session: Session) -> Non
|
||||
|
||||
|
||||
def test_adjust_penalty_and_multiplier(sql_session: Session) -> None:
|
||||
user = User("Test User")
|
||||
sql_session.add(user)
|
||||
sql_session.commit()
|
||||
user = insert_test_data(sql_session)
|
||||
|
||||
adjust_penalty(
|
||||
sql_session,
|
||||
|
||||
@@ -1,9 +1,26 @@
|
||||
import pytest
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Not yet implemented")
|
||||
def test_joint_buy_product_missing_product(sql_session: Session) -> None: ...
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Not yet implemented")
|
||||
def test_joint_buy_product_missing_user(sql_session: Session) -> None: ...
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Not yet implemented")
|
||||
def test_joint_buy_product_out_of_stock(sql_session: Session) -> None: ...
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Not yet implemented")
|
||||
def test_joint_buy_product(sql_session: Session) -> None: ...
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Not yet implemented")
|
||||
def test_joint_buy_product_duplicate_user(sql_session: Session) -> None: ...
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Not yet implemented")
|
||||
def test_joint_buy_product_non_involved_instigator(sql_session: Session) -> None: ...
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from datetime import datetime
|
||||
from pprint import pprint
|
||||
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from dibbler.models import Product, User
|
||||
from dibbler.models.Transaction import Transaction
|
||||
from dibbler.queries import product_owners, product_owners_log
|
||||
from dibbler.queries import product_owners, product_owners_log, product_stock
|
||||
|
||||
|
||||
def insert_test_data(sql_session: Session) -> tuple[Product, User]:
|
||||
@@ -38,6 +39,7 @@ def test_product_owners_add_products(sql_session: Session) -> None:
|
||||
amount=30,
|
||||
per_product=10,
|
||||
product_count=3,
|
||||
time=datetime(2024, 1, 1, 10, 0, 0),
|
||||
)
|
||||
]
|
||||
sql_session.add_all(transactions)
|
||||
@@ -58,11 +60,13 @@ def test_product_owners_add_and_buy_products(sql_session: Session) -> None:
|
||||
amount=30,
|
||||
per_product=10,
|
||||
product_count=3,
|
||||
time=datetime(2024, 1, 1, 10, 0, 0),
|
||||
),
|
||||
Transaction.buy_product(
|
||||
user_id=user.id,
|
||||
product_id=product.id,
|
||||
product_count=1,
|
||||
time=datetime(2024, 1, 2, 10, 0, 0),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -84,11 +88,13 @@ def test_product_owners_add_and_throw_products(sql_session: Session) -> None:
|
||||
amount=40,
|
||||
per_product=10,
|
||||
product_count=4,
|
||||
time=datetime(2024, 1, 1, 10, 0, 0),
|
||||
),
|
||||
Transaction.throw_product(
|
||||
user_id=user.id,
|
||||
product_id=product.id,
|
||||
product_count=2,
|
||||
time=datetime(2024, 1, 2, 10, 0, 0),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -113,6 +119,7 @@ def test_product_owners_multiple_users(sql_session: Session) -> None:
|
||||
amount=20,
|
||||
per_product=10,
|
||||
product_count=2,
|
||||
time=datetime(2024, 1, 1, 10, 0, 0),
|
||||
),
|
||||
Transaction.add_product(
|
||||
user_id=user2.id,
|
||||
@@ -120,6 +127,7 @@ def test_product_owners_multiple_users(sql_session: Session) -> None:
|
||||
amount=30,
|
||||
per_product=10,
|
||||
product_count=3,
|
||||
time=datetime(2024, 1, 2, 10, 0, 0),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -142,11 +150,13 @@ def test_product_owners_adjust_stock_down(sql_session: Session) -> None:
|
||||
amount=50,
|
||||
per_product=10,
|
||||
product_count=5,
|
||||
time=datetime(2024, 1, 1, 10, 0, 0),
|
||||
),
|
||||
Transaction.adjust_stock(
|
||||
user_id=user.id,
|
||||
product_id=product.id,
|
||||
product_count=-2,
|
||||
time=datetime(2024, 1, 2, 10, 0, 0),
|
||||
),
|
||||
]
|
||||
sql_session.add_all(transactions)
|
||||
@@ -154,6 +164,8 @@ def test_product_owners_adjust_stock_down(sql_session: Session) -> None:
|
||||
|
||||
pprint(product_owners_log(sql_session, product))
|
||||
|
||||
assert product_stock(sql_session, product) == 3
|
||||
|
||||
owners = product_owners(sql_session, product)
|
||||
assert owners == [user, user, user]
|
||||
|
||||
@@ -168,11 +180,13 @@ def test_product_owners_adjust_stock_up(sql_session: Session) -> None:
|
||||
amount=20,
|
||||
per_product=10,
|
||||
product_count=2,
|
||||
time=datetime(2024, 1, 1, 10, 0, 0),
|
||||
),
|
||||
Transaction.adjust_stock(
|
||||
user_id=user.id,
|
||||
product_id=product.id,
|
||||
product_count=3,
|
||||
time=datetime(2024, 1, 2, 10, 0, 0),
|
||||
),
|
||||
]
|
||||
sql_session.add_all(transactions)
|
||||
@@ -194,11 +208,13 @@ def test_product_owners_negative_stock(sql_session: Session) -> None:
|
||||
amount=10,
|
||||
per_product=10,
|
||||
product_count=1,
|
||||
time=datetime(2024, 1, 1, 10, 0, 0),
|
||||
),
|
||||
Transaction.buy_product(
|
||||
user_id=user.id,
|
||||
product_id=product.id,
|
||||
product_count=2,
|
||||
time=datetime(2024, 1, 2, 10, 0, 0),
|
||||
),
|
||||
]
|
||||
sql_session.add_all(transactions)
|
||||
@@ -216,6 +232,7 @@ def test_product_owners_add_products_from_negative_stock(sql_session: Session) -
|
||||
user_id=user.id,
|
||||
product_id=product.id,
|
||||
product_count=2,
|
||||
time=datetime(2024, 1, 1, 10, 0, 0),
|
||||
),
|
||||
Transaction.add_product(
|
||||
user_id=user.id,
|
||||
@@ -223,6 +240,7 @@ def test_product_owners_add_products_from_negative_stock(sql_session: Session) -
|
||||
amount=30,
|
||||
per_product=10,
|
||||
product_count=3,
|
||||
time=datetime(2024, 1, 2, 10, 0, 0),
|
||||
),
|
||||
]
|
||||
sql_session.add_all(transactions)
|
||||
@@ -247,6 +265,7 @@ def test_product_owners_interleaved_users(sql_session: Session) -> None:
|
||||
amount=20,
|
||||
per_product=10,
|
||||
product_count=2,
|
||||
time=datetime(2024, 1, 1, 10, 0, 0),
|
||||
),
|
||||
Transaction.add_product(
|
||||
user_id=user2.id,
|
||||
@@ -254,11 +273,13 @@ def test_product_owners_interleaved_users(sql_session: Session) -> None:
|
||||
amount=30,
|
||||
per_product=10,
|
||||
product_count=3,
|
||||
time=datetime(2024, 1, 2, 10, 0, 0),
|
||||
),
|
||||
Transaction.buy_product(
|
||||
user_id=user1.id,
|
||||
product_id=product.id,
|
||||
product_count=1,
|
||||
time=datetime(2024, 1, 3, 10, 0, 0),
|
||||
),
|
||||
Transaction.add_product(
|
||||
user_id=user1.id,
|
||||
@@ -266,6 +287,7 @@ def test_product_owners_interleaved_users(sql_session: Session) -> None:
|
||||
amount=10,
|
||||
per_product=10,
|
||||
product_count=1,
|
||||
time=datetime(2024, 1, 4, 10, 0, 0),
|
||||
),
|
||||
]
|
||||
sql_session.add_all(transactions)
|
||||
@@ -274,4 +296,4 @@ def test_product_owners_interleaved_users(sql_session: Session) -> None:
|
||||
pprint(product_owners_log(sql_session, product))
|
||||
|
||||
owners = product_owners(sql_session, product)
|
||||
assert owners == [user1, user2, user2, user1, user1]
|
||||
assert owners == [user1, user2, user2, user2, user1]
|
||||
|
||||
@@ -416,3 +416,6 @@ def test_product_price_joint_transactions(sql_session: Session) -> None:
|
||||
# Count: 3 + 4 = 7, Price: (26 * 3 + 25 * 4) / (3 + 4) = 25.57 -> 26
|
||||
|
||||
assert product_price_ == math.ceil((26 * 3 + 25 * 4) / (3 + 4))
|
||||
|
||||
|
||||
def test_product_price_until(sql_session: Session) -> None: ...
|
||||
|
||||
@@ -1,26 +1,27 @@
|
||||
from datetime import datetime
|
||||
|
||||
import pytest
|
||||
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from dibbler.models import Product, Transaction, User
|
||||
from dibbler.queries import product_stock, joint_buy_product
|
||||
from dibbler.models.TransactionType import TransactionTypeSQL
|
||||
from dibbler.queries import joint_buy_product, product_stock
|
||||
|
||||
|
||||
def insert_test_data(sql_session: Session) -> None:
|
||||
user1 = User("Test User 1")
|
||||
|
||||
sql_session.add(user1)
|
||||
def insert_test_data(sql_session: Session) -> tuple[User, Product]:
|
||||
user = User("Test User 1")
|
||||
product = Product("1234567890123", "Test Product")
|
||||
sql_session.add(user)
|
||||
sql_session.add(product)
|
||||
sql_session.commit()
|
||||
return user, product
|
||||
|
||||
|
||||
def test_product_stock_basic_history(sql_session: Session) -> None:
|
||||
insert_test_data(sql_session)
|
||||
user, product = insert_test_data(sql_session)
|
||||
|
||||
user1 = sql_session.scalars(select(User).where(User.name == "Test User 1")).one()
|
||||
|
||||
product = Product("1234567890123", "Test Product")
|
||||
sql_session.add(product)
|
||||
sql_session.commit()
|
||||
|
||||
transactions = [
|
||||
@@ -28,7 +29,7 @@ def test_product_stock_basic_history(sql_session: Session) -> None:
|
||||
time=datetime(2023, 10, 1, 12, 0, 0),
|
||||
amount=10,
|
||||
per_product=10,
|
||||
user_id=user1.id,
|
||||
user_id=user.id,
|
||||
product_id=product.id,
|
||||
product_count=1,
|
||||
),
|
||||
@@ -40,27 +41,71 @@ def test_product_stock_basic_history(sql_session: Session) -> None:
|
||||
assert product_stock(sql_session, product) == 1
|
||||
|
||||
|
||||
def test_product_stock_complex_history(sql_session: Session) -> None:
|
||||
insert_test_data(sql_session)
|
||||
def test_product_stock_adjust_stock_up(sql_session: Session) -> None:
|
||||
user, product = insert_test_data(sql_session)
|
||||
|
||||
user1 = sql_session.scalars(select(User).where(User.name == "Test User 1")).one()
|
||||
|
||||
product = Product("1234567890123", "Test Product")
|
||||
sql_session.add(product)
|
||||
transactions = [
|
||||
Transaction.add_product(
|
||||
user_id=user.id,
|
||||
product_id=product.id,
|
||||
amount=50,
|
||||
per_product=10,
|
||||
product_count=5,
|
||||
time=datetime(2024, 1, 1, 10, 0, 0),
|
||||
),
|
||||
Transaction.adjust_stock(
|
||||
user_id=user.id,
|
||||
product_id=product.id,
|
||||
product_count=2,
|
||||
time=datetime(2024, 1, 2, 10, 0, 0),
|
||||
),
|
||||
]
|
||||
sql_session.add_all(transactions)
|
||||
sql_session.commit()
|
||||
|
||||
assert product_stock(sql_session, product) == 5 + 2
|
||||
|
||||
|
||||
def test_product_stock_adjust_stock_down(sql_session: Session) -> None:
|
||||
user, product = insert_test_data(sql_session)
|
||||
|
||||
transactions = [
|
||||
Transaction.add_product(
|
||||
user_id=user.id,
|
||||
product_id=product.id,
|
||||
amount=50,
|
||||
per_product=10,
|
||||
product_count=5,
|
||||
time=datetime(2024, 1, 1, 10, 0, 0),
|
||||
),
|
||||
Transaction.adjust_stock(
|
||||
user_id=user.id,
|
||||
product_id=product.id,
|
||||
product_count=-2,
|
||||
time=datetime(2024, 1, 2, 10, 0, 0),
|
||||
),
|
||||
]
|
||||
sql_session.add_all(transactions)
|
||||
sql_session.commit()
|
||||
|
||||
assert product_stock(sql_session, product) == 5 - 2
|
||||
|
||||
|
||||
def test_product_stock_complex_history(sql_session: Session) -> None:
|
||||
user, product = insert_test_data(sql_session)
|
||||
|
||||
transactions = [
|
||||
Transaction.add_product(
|
||||
time=datetime(2023, 10, 1, 13, 0, 0),
|
||||
amount=27 * 2,
|
||||
per_product=27,
|
||||
user_id=user1.id,
|
||||
user_id=user.id,
|
||||
product_id=product.id,
|
||||
product_count=2,
|
||||
),
|
||||
Transaction.buy_product(
|
||||
time=datetime(2023, 10, 1, 13, 0, 1),
|
||||
user_id=user1.id,
|
||||
user_id=user.id,
|
||||
product_id=product.id,
|
||||
product_count=3,
|
||||
),
|
||||
@@ -68,67 +113,63 @@ def test_product_stock_complex_history(sql_session: Session) -> None:
|
||||
time=datetime(2023, 10, 1, 13, 0, 2),
|
||||
amount=50 * 4,
|
||||
per_product=50,
|
||||
user_id=user1.id,
|
||||
user_id=user.id,
|
||||
product_id=product.id,
|
||||
product_count=4,
|
||||
),
|
||||
Transaction.adjust_stock(
|
||||
time=datetime(2023, 10, 1, 15, 0, 0),
|
||||
user_id=user1.id,
|
||||
user_id=user.id,
|
||||
product_id=product.id,
|
||||
product_count=3,
|
||||
),
|
||||
Transaction.adjust_stock(
|
||||
time=datetime(2023, 10, 1, 15, 0, 1),
|
||||
user_id=user1.id,
|
||||
user_id=user.id,
|
||||
product_id=product.id,
|
||||
product_count=-2,
|
||||
),
|
||||
Transaction.throw_product(
|
||||
time=datetime(2023, 10, 1, 15, 0, 2),
|
||||
user_id=user.id,
|
||||
product_id=product.id,
|
||||
product_count=1,
|
||||
),
|
||||
]
|
||||
|
||||
sql_session.add_all(transactions)
|
||||
sql_session.commit()
|
||||
|
||||
assert product_stock(sql_session, product) == 2 - 3 + 4 + 3 - 2
|
||||
assert product_stock(sql_session, product) == 2 - 3 + 4 + 3 - 2 - 1
|
||||
|
||||
|
||||
def test_product_stock_no_transactions(sql_session: Session) -> None:
|
||||
insert_test_data(sql_session)
|
||||
|
||||
product = Product("1234567890123", "Test Product")
|
||||
sql_session.add(product)
|
||||
sql_session.commit()
|
||||
_, product = insert_test_data(sql_session)
|
||||
|
||||
assert product_stock(sql_session, product) == 0
|
||||
|
||||
|
||||
def test_negative_product_stock(sql_session: Session) -> None:
|
||||
insert_test_data(sql_session)
|
||||
|
||||
user1 = sql_session.scalars(select(User).where(User.name == "Test User 1")).one()
|
||||
|
||||
product = Product("1234567890123", "Test Product")
|
||||
sql_session.add(product)
|
||||
sql_session.commit()
|
||||
user, product = insert_test_data(sql_session)
|
||||
|
||||
transactions = [
|
||||
Transaction.add_product(
|
||||
time=datetime(2023, 10, 1, 14, 0, 0),
|
||||
amount=50,
|
||||
per_product=50,
|
||||
user_id=user1.id,
|
||||
user_id=user.id,
|
||||
product_id=product.id,
|
||||
product_count=1,
|
||||
),
|
||||
Transaction.buy_product(
|
||||
time=datetime(2023, 10, 1, 14, 0, 1),
|
||||
user_id=user1.id,
|
||||
user_id=user.id,
|
||||
product_id=product.id,
|
||||
product_count=2,
|
||||
),
|
||||
Transaction.adjust_stock(
|
||||
time=datetime(2023, 10, 1, 16, 0, 0),
|
||||
user_id=user1.id,
|
||||
user_id=user.id,
|
||||
product_id=product.id,
|
||||
product_count=-1,
|
||||
),
|
||||
@@ -142,17 +183,12 @@ def test_negative_product_stock(sql_session: Session) -> None:
|
||||
|
||||
|
||||
def test_product_stock_joint_transaction(sql_session: Session) -> None:
|
||||
insert_test_data(sql_session)
|
||||
user1, product = insert_test_data(sql_session)
|
||||
|
||||
user1 = sql_session.scalars(select(User).where(User.name == "Test User 1")).one()
|
||||
user2 = User("Test User 2")
|
||||
sql_session.add(user2)
|
||||
sql_session.commit()
|
||||
|
||||
product = Product("1234567890123", "Test Product")
|
||||
sql_session.add(product)
|
||||
sql_session.commit()
|
||||
|
||||
transactions = [
|
||||
Transaction.add_product(
|
||||
time=datetime(2023, 10, 1, 17, 0, 0),
|
||||
@@ -179,4 +215,9 @@ def test_product_stock_joint_transaction(sql_session: Session) -> None:
|
||||
assert product_stock(sql_session, product) == 5 - 3
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Not yet implemented")
|
||||
def test_product_stock_until(sql_session: Session) -> None: ...
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Not yet implemented")
|
||||
def test_product_stock_throw_away(sql_session: Session) -> None: ...
|
||||
|
||||
@@ -567,5 +567,9 @@ def test_transaction_log_combined_filter_product_transaction_id_transaction_type
|
||||
# NOTE: see the corresponding TODO's above the function definition
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Not yet implemented")
|
||||
def test_transaction_log_filtered_by_user_joint_transactions(sql_session: Session) -> None: ...
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Not yet implemented")
|
||||
def test_transaction_log_filtered_by_user_throw_away_transactions(sql_session: Session) -> None: ...
|
||||
|
||||
@@ -2,6 +2,8 @@ import math
|
||||
from datetime import datetime
|
||||
from pprint import pprint
|
||||
|
||||
import pytest
|
||||
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from dibbler.models import Product, Transaction, User
|
||||
@@ -302,29 +304,33 @@ def test_user_balance_penalty_interest_combined(sql_session: Session) -> None:
|
||||
assert user_balance(sql_session, user) == (27 - 200 - math.ceil(27 * 2 * 1.1))
|
||||
|
||||
|
||||
def test_user_balance_joint_transactions(sql_session: Session):
|
||||
pass
|
||||
@pytest.mark.skip(reason="Not yet implemented")
|
||||
def test_user_balance_joint_transactions(sql_session: Session): ...
|
||||
|
||||
|
||||
def test_user_balance_joint_transactions_interest(sql_session: Session):
|
||||
pass
|
||||
@pytest.mark.skip(reason="Not yet implemented")
|
||||
def test_user_balance_joint_transactions_interest(sql_session: Session): ...
|
||||
|
||||
|
||||
def test_user_balance_joint_transactions_changing_interest(sql_session: Session):
|
||||
pass
|
||||
@pytest.mark.skip(reason="Not yet implemented")
|
||||
def test_user_balance_joint_transactions_changing_interest(sql_session: Session): ...
|
||||
|
||||
|
||||
def test_user_balance_joint_transactions_penalty(sql_session: Session):
|
||||
pass
|
||||
@pytest.mark.skip(reason="Not yet implemented")
|
||||
def test_user_balance_joint_transactions_penalty(sql_session: Session): ...
|
||||
|
||||
|
||||
def test_user_balance_joint_transactions_changing_penalty(sql_session: Session):
|
||||
pass
|
||||
@pytest.mark.skip(reason="Not yet implemented")
|
||||
def test_user_balance_joint_transactions_changing_penalty(sql_session: Session): ...
|
||||
|
||||
|
||||
def test_user_balance_joint_transactions_penalty_interest_combined(sql_session: Session):
|
||||
pass
|
||||
@pytest.mark.skip(reason="Not yet implemented")
|
||||
def test_user_balance_joint_transactions_penalty_interest_combined(sql_session: Session): ...
|
||||
|
||||
|
||||
def test_user_balance_throw_away_products(sql_session: Session):
|
||||
pass
|
||||
@pytest.mark.skip(reason="Not yet implemented")
|
||||
def test_user_balance_until(sql_session: Session): ...
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Not yet implemented")
|
||||
def test_user_balance_throw_away_products(sql_session: Session): ...
|
||||
|
||||
Reference in New Issue
Block a user