diff --git a/counter/tests/test_counter.py b/counter/tests/test_counter.py index 99e9ac77..6ed3e08b 100644 --- a/counter/tests/test_counter.py +++ b/counter/tests/test_counter.py @@ -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) diff --git a/counter/views/click.py b/counter/views/click.py index f4f3f6b6..e74a48c5 100644 --- a/counter/views/click.py +++ b/counter/views/click.py @@ -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"] = { diff --git a/counter/views/home.py b/counter/views/home.py index 60cc5a5a..d66b0969 100644 --- a/counter/views/home.py +++ b/counter/views/home.py @@ -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 (