mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-22 15:51:19 +00:00
Add of tests
This commit is contained in:
parent
f2666f6fb0
commit
ba6599fa56
@ -611,6 +611,7 @@ Welcome to the wiki page!
|
||||
mde.products.add(cons)
|
||||
mde.products.add(dcons)
|
||||
mde.sellers.add(skia)
|
||||
|
||||
mde.save()
|
||||
|
||||
eboutic = Counter.objects.filter(name="Eboutic").first()
|
||||
@ -935,6 +936,7 @@ Welcome to the wiki page!
|
||||
# Add barman to counter
|
||||
c = Counter.objects.get(id=2)
|
||||
c.sellers.add(User.objects.get(pk=krophil.pk))
|
||||
mde.sellers.add(sli)
|
||||
c.save()
|
||||
|
||||
# Create an election
|
||||
|
@ -36,7 +36,10 @@ class CounterTest(TestCase):
|
||||
def setUp(self):
|
||||
call_command("populate")
|
||||
self.skia = User.objects.filter(username="skia").first()
|
||||
self.sli = User.objects.filter(username="sli").first()
|
||||
self.krophil = User.objects.filter(username="krophil").first()
|
||||
self.mde = Counter.objects.filter(name="MDE").first()
|
||||
self.foyer = Counter.objects.get(id=2)
|
||||
|
||||
def test_full_click(self):
|
||||
response = self.client.post(
|
||||
@ -93,6 +96,51 @@ class CounterTest(TestCase):
|
||||
in str(response_content)
|
||||
)
|
||||
|
||||
response = self.client.post(
|
||||
reverse("counter:login", kwargs={"counter_id": self.mde.id}),
|
||||
{"username": self.sli.username, "password": "plop"},
|
||||
)
|
||||
|
||||
response = self.client.post(
|
||||
location,
|
||||
{
|
||||
"action": "refill",
|
||||
"amount": "5",
|
||||
"payment_method": "CASH",
|
||||
"bank": "OTHER",
|
||||
},
|
||||
)
|
||||
|
||||
response = self.client.post(
|
||||
reverse("counter:login", kwargs={"counter_id": self.foyer.id}),
|
||||
{"username": self.krophil.username, "password": "plop"},
|
||||
)
|
||||
|
||||
response = self.client.get(
|
||||
reverse("counter:details", kwargs={"counter_id": self.foyer.id})
|
||||
)
|
||||
|
||||
counter_token = re.search(
|
||||
r'name="counter_token" value="([^"]*)"', str(response.content)
|
||||
).group(1)
|
||||
|
||||
response = self.client.post(
|
||||
reverse("counter:details", kwargs={"counter_id": self.foyer.id}),
|
||||
{"code": "4000k", "counter_token": counter_token},
|
||||
)
|
||||
location = response.get("location")
|
||||
|
||||
response = self.client.post(
|
||||
location,
|
||||
{
|
||||
"action": "refill",
|
||||
"amount": "5",
|
||||
"payment_method": "CASH",
|
||||
"bank": "OTHER",
|
||||
},
|
||||
)
|
||||
self.assertTrue(response.status_code == 403)
|
||||
|
||||
|
||||
class CounterStatsTest(TestCase):
|
||||
def setUp(self):
|
||||
|
@ -45,7 +45,7 @@ Par défaut, la base de données du site de prod contient des données nécessai
|
||||
* **comptable** -> administrateur comptabilité
|
||||
* **guy** -> utilisateur non cotisant et sans groupe
|
||||
* **rbatsbak** -> utilisateur non cotisant et sans groupe
|
||||
* **sli** -> cotisant avec carte étudiante attachée au compte
|
||||
* **sli** -> cotisant avec carte étudiante attachée au compte, barmen MDE
|
||||
* **krophil** -> cotisant avec des plein d'écocups, barmen foyer
|
||||
* **comunity** -> administrateur communication
|
||||
* **tutu** -> administrateur pédagogie
|
||||
|
Loading…
Reference in New Issue
Block a user