mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-24 00:31:16 +00:00
Disable eboutic in counter click/main
This commit is contained in:
parent
9c93c004ec
commit
2e5e217842
@ -70,7 +70,7 @@ class FullClickSetup:
|
||||
cls.customer_old_can_not_buy = old_subscriber_user.make()
|
||||
cls.customer_can_not_buy = baker.make(User)
|
||||
|
||||
cls.club_counter = baker.make(Counter)
|
||||
cls.club_counter = baker.make(Counter, type="OFFICE")
|
||||
baker.make(
|
||||
Membership,
|
||||
start_date=now() - timedelta(days=30),
|
||||
@ -302,6 +302,18 @@ class TestCounterClick(FullClickSetup, TestCase):
|
||||
def refill_user(self, user: User, amount: Decimal | int):
|
||||
baker.make(Refilling, amount=amount, customer=user.customer, is_validated=False)
|
||||
|
||||
def test_click_eboutic_failure(self):
|
||||
eboutic = baker.make(Counter, type="EBOUTIC")
|
||||
self.client.force_login(self.club_admin)
|
||||
assert (
|
||||
self.submit_basket(
|
||||
self.customer,
|
||||
[BasketItem(self.stamps.id, 5)],
|
||||
counter=eboutic,
|
||||
).status_code
|
||||
== 404
|
||||
)
|
||||
|
||||
def test_click_office_success(self):
|
||||
self.refill_user(self.customer, 10)
|
||||
self.client.force_login(self.club_admin)
|
||||
|
@ -148,6 +148,9 @@ class CounterClick(CounterTabsMixin, CanViewMixin, SingleObjectMixin, FormView):
|
||||
pk_url_kwarg = "counter_id"
|
||||
current_tab = "counter"
|
||||
|
||||
def get_queryset(self):
|
||||
return super().get_queryset().exclude(type="EBOUTIC")
|
||||
|
||||
def get_form_kwargs(self):
|
||||
kwargs = super().get_form_kwargs()
|
||||
kwargs["form_kwargs"] = {
|
||||
|
@ -43,6 +43,9 @@ class CounterMain(
|
||||
)
|
||||
current_tab = "counter"
|
||||
|
||||
def get_queryset(self):
|
||||
return super().get_queryset().exclude(type="EBOUTIC")
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
self.object = self.get_object()
|
||||
if self.object.type == "BAR" and not (
|
||||
|
Loading…
Reference in New Issue
Block a user