Add of tests

This commit is contained in:
lsacienne 2022-05-05 23:24:08 +02:00
parent f2666f6fb0
commit ba6599fa56
No known key found for this signature in database
GPG Key ID: 5B1939A93F7A6F48
3 changed files with 51 additions and 1 deletions

View File

@ -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

View File

@ -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):

View File

@ -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