mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-24 00:31:16 +00:00
Fix wrong tests/permissions
This commit is contained in:
parent
ccf5118c9d
commit
7f6fd7dc47
@ -187,7 +187,7 @@ class TestRefilling(FullClickSetup, TestCase):
|
|||||||
self.refill_user(
|
self.refill_user(
|
||||||
self.customer_old_can_not_buy, self.counter, 10
|
self.customer_old_can_not_buy, self.counter, 10
|
||||||
).status_code
|
).status_code
|
||||||
== 403
|
== 404
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_refilling_counter_success(self):
|
def test_refilling_counter_success(self):
|
||||||
@ -868,4 +868,4 @@ class TestClubCounterClickAccess(TestCase):
|
|||||||
self.counter.sellers.add(self.user)
|
self.counter.sellers.add(self.user)
|
||||||
self.client.force_login(self.user)
|
self.client.force_login(self.user)
|
||||||
res = self.client.get(self.click_url)
|
res = self.client.get(self.click_url)
|
||||||
assert res.status_code == 200
|
assert res.status_code == 403
|
||||||
|
@ -167,7 +167,10 @@ class CounterClick(CounterTabsMixin, CanViewMixin, SingleObjectMixin, FormView):
|
|||||||
if not self.customer.can_buy or self.customer.user.is_banned_counter:
|
if not self.customer.can_buy or self.customer.user.is_banned_counter:
|
||||||
return redirect(obj) # Redirect to counter
|
return redirect(obj) # Redirect to counter
|
||||||
|
|
||||||
if obj.type == "OFFICE" and not obj.club.has_rights_in_club(request.user):
|
if obj.type == "OFFICE" and (
|
||||||
|
obj.sellers.filter(pk=request.user.pk).exists()
|
||||||
|
or not obj.club.has_rights_in_club(request.user)
|
||||||
|
):
|
||||||
raise PermissionDenied
|
raise PermissionDenied
|
||||||
|
|
||||||
if obj.type == "BAR" and (
|
if obj.type == "BAR" and (
|
||||||
|
Loading…
Reference in New Issue
Block a user