From b88cd9673cb31419dcf117f4956264bdedd48411 Mon Sep 17 00:00:00 2001 From: Thomas Girod Date: Tue, 10 Jan 2023 04:14:47 +0100 Subject: [PATCH] =?UTF-8?q?d=C3=A9but=20correction=20par=20les=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- counter/tests.py | 11 +++++------ counter/views.py | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/counter/tests.py b/counter/tests.py index 0a25a9ff..846d93e9 100644 --- a/counter/tests.py +++ b/counter/tests.py @@ -42,7 +42,7 @@ class CounterTest(TestCase): self.foyer = Counter.objects.get(id=2) def test_full_click(self): - response = self.client.post( + self.client.post( reverse("counter:login", kwargs={"counter_id": self.mde.id}), {"username": self.skia.username, "password": "plop"}, ) @@ -63,7 +63,6 @@ class CounterTest(TestCase): {"code": "4000k", "counter_token": counter_token}, ) location = response.get("location") - response = self.client.get(response.get("location")) self.assertTrue(">Richard Batsbak2 x Barbar" in str(response_content)) - self.assertTrue("
  • 2 x Déconsigne Eco-cup" in str(response_content)) + self.assertTrue("2 x Barbar" in str(response_content)) + self.assertTrue("2 x Déconsigne Eco-cup" in str(response_content)) self.assertTrue( "

    Client : Richard Batsbak - Nouveau montant : 3.60" in str(response_content) diff --git a/counter/views.py b/counter/views.py index 90031c8d..bafa7197 100644 --- a/counter/views.py +++ b/counter/views.py @@ -404,7 +404,7 @@ class CounterClick(CounterTabsMixin, CanViewMixin, DetailView): self.operator = self.customer.user else: self.operator = self.object.get_random_barman() - action = parse_qs(request.body.decode())["action"][0] + action = parse_qs(request.body.decode()).get("action", [""])[0] if action == "add_product": self.add_product(request)