mirror of
https://github.com/ae-utbm/sith.git
synced 2025-11-25 14:16:56 +00:00
Merge pull request #1256 from ae-utbm/remove-is_validated
Database optimisations on counter
This commit is contained in:
@@ -116,7 +116,6 @@ class TestAccountDumpCommand(TestAccountDump):
|
||||
operation: Selling = customer.buyings.order_by("date").last()
|
||||
assert operation.unit_price == initial_amount
|
||||
assert operation.counter_id == settings.SITH_COUNTER_ACCOUNT_DUMP_ID
|
||||
assert operation.is_validated is True
|
||||
dump = customer.dumps.last()
|
||||
assert dump.dump_operation == operation
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ def set_age(user: User, age: int):
|
||||
|
||||
|
||||
def force_refill_user(user: User, amount: Decimal | int):
|
||||
baker.make(Refilling, amount=amount, customer=user.customer, is_validated=False)
|
||||
baker.make(Refilling, amount=amount, customer=user.customer)
|
||||
|
||||
|
||||
class TestFullClickBase(TestCase):
|
||||
@@ -115,18 +115,10 @@ class TestRefilling(TestFullClickBase):
|
||||
) -> HttpResponse:
|
||||
used_client = client if client is not None else self.client
|
||||
return used_client.post(
|
||||
reverse(
|
||||
"counter:refilling_create",
|
||||
kwargs={"customer_id": user.pk},
|
||||
),
|
||||
{
|
||||
"amount": str(amount),
|
||||
"payment_method": "CASH",
|
||||
"bank": "OTHER",
|
||||
},
|
||||
reverse("counter:refilling_create", kwargs={"customer_id": user.pk}),
|
||||
{"amount": str(amount), "payment_method": Refilling.PaymentMethod.CASH},
|
||||
HTTP_REFERER=reverse(
|
||||
"counter:click",
|
||||
kwargs={"counter_id": counter.id, "user_id": user.pk},
|
||||
"counter:click", kwargs={"counter_id": counter.id, "user_id": user.pk}
|
||||
),
|
||||
)
|
||||
|
||||
@@ -149,11 +141,7 @@ class TestRefilling(TestFullClickBase):
|
||||
"counter:refilling_create",
|
||||
kwargs={"customer_id": self.customer.pk},
|
||||
),
|
||||
{
|
||||
"amount": "10",
|
||||
"payment_method": "CASH",
|
||||
"bank": "OTHER",
|
||||
},
|
||||
{"amount": "10", "payment_method": "CASH"},
|
||||
)
|
||||
|
||||
self.client.force_login(self.club_admin)
|
||||
|
||||
@@ -298,7 +298,6 @@ def test_update_balance():
|
||||
_quantity=len(customers),
|
||||
unit_price=10,
|
||||
quantity=1,
|
||||
payment_method="SITH_ACCOUNT",
|
||||
_save_related=True,
|
||||
),
|
||||
*sale_recipe.prepare(
|
||||
@@ -306,14 +305,12 @@ def test_update_balance():
|
||||
_quantity=3,
|
||||
unit_price=5,
|
||||
quantity=2,
|
||||
payment_method="SITH_ACCOUNT",
|
||||
_save_related=True,
|
||||
),
|
||||
sale_recipe.prepare(
|
||||
customer=customers[4],
|
||||
quantity=1,
|
||||
unit_price=50,
|
||||
payment_method="SITH_ACCOUNT",
|
||||
_save_related=True,
|
||||
),
|
||||
*sale_recipe.prepare(
|
||||
@@ -324,7 +321,7 @@ def test_update_balance():
|
||||
_quantity=len(customers),
|
||||
unit_price=50,
|
||||
quantity=1,
|
||||
payment_method="CARD",
|
||||
payment_method=Selling.PaymentMethod.CARD,
|
||||
_save_related=True,
|
||||
),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user