mirror of
https://github.com/ae-utbm/sith.git
synced 2025-06-30 23:25:19 +00:00
Compare commits
No commits in common. "2480644f1cde156390554f0e3f2ae2e77f4a4ba5" and "d56990b91fa4e0c5767d39afff9a527abb2232a0" have entirely different histories.
2480644f1c
...
d56990b91f
@ -67,6 +67,8 @@ class EbouticTest(TestCase):
|
|||||||
urllib.parse.quote_plus(b64sig),
|
urllib.parse.quote_plus(b64sig),
|
||||||
)
|
)
|
||||||
response = self.client.get(url)
|
response = self.client.get(url)
|
||||||
|
self.assertTrue(response.status_code == 200)
|
||||||
|
self.assertTrue(response.content.decode("utf-8") == "")
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def test_buy_simple_product_with_sith_account(self):
|
def test_buy_simple_product_with_sith_account(self):
|
||||||
@ -138,8 +140,6 @@ class EbouticTest(TestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
response = self.generate_bank_valid_answer_from_page_content(response.content)
|
response = self.generate_bank_valid_answer_from_page_content(response.content)
|
||||||
self.assertTrue(response.status_code == 200)
|
|
||||||
self.assertTrue(response.content.decode("utf-8") == "")
|
|
||||||
|
|
||||||
response = self.client.get(
|
response = self.client.get(
|
||||||
reverse(
|
reverse(
|
||||||
@ -161,42 +161,6 @@ class EbouticTest(TestCase):
|
|||||||
" <td>Carte bancaire</td>" in str(response.content)
|
" <td>Carte bancaire</td>" in str(response.content)
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_alter_basket_with_credit_card(self):
|
|
||||||
self.client.login(username="subscriber", password="plop")
|
|
||||||
response = self.client.post(
|
|
||||||
reverse("eboutic:main"),
|
|
||||||
{"action": "add_product", "product_id": self.barbar.id},
|
|
||||||
)
|
|
||||||
self.assertTrue(
|
|
||||||
'<input type="hidden" name="action" value="add_product">\\n'
|
|
||||||
' <button type="submit" name="product_id" value="4"> + </button>\\n'
|
|
||||||
"</form>\\n Barbar: 1.70 \\xe2\\x82\\xac</li>" in str(response.content)
|
|
||||||
)
|
|
||||||
response = self.client.post(reverse("eboutic:command"))
|
|
||||||
self.assertTrue(
|
|
||||||
"<tr>\\n <td>Barbar</td>\\n <td>1</td>\\n"
|
|
||||||
" <td>1.70 \\xe2\\x82\\xac</td>\\n </tr>"
|
|
||||||
in str(response.content)
|
|
||||||
)
|
|
||||||
|
|
||||||
response_altered = self.client.post(
|
|
||||||
reverse("eboutic:main"),
|
|
||||||
{"action": "add_product", "product_id": self.barbar.id},
|
|
||||||
)
|
|
||||||
self.assertTrue(
|
|
||||||
'<input type="hidden" name="action" value="add_product">\\n'
|
|
||||||
' <button type="submit" name="product_id" value="4"> + </button>\\n'
|
|
||||||
"</form>\\n Barbar: 3.40 \\xe2\\x82\\xac</li>"
|
|
||||||
in str(response_altered.content)
|
|
||||||
)
|
|
||||||
|
|
||||||
response = self.generate_bank_valid_answer_from_page_content(response.content)
|
|
||||||
self.assertTrue(response.status_code == 400)
|
|
||||||
self.assertTrue(
|
|
||||||
"Payment failed with error: SuspiciousOperation('Basket total and amount do not match'"
|
|
||||||
in response.content.decode("utf-8")
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_buy_refill_product_with_credit_card(self):
|
def test_buy_refill_product_with_credit_card(self):
|
||||||
self.client.login(username="subscriber", password="plop")
|
self.client.login(username="subscriber", password="plop")
|
||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
@ -217,8 +181,6 @@ class EbouticTest(TestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
response = self.generate_bank_valid_answer_from_page_content(response.content)
|
response = self.generate_bank_valid_answer_from_page_content(response.content)
|
||||||
self.assertTrue(response.status_code == 200)
|
|
||||||
self.assertTrue(response.content.decode("utf-8") == "")
|
|
||||||
|
|
||||||
response = self.client.get(
|
response = self.client.get(
|
||||||
reverse(
|
reverse(
|
||||||
@ -265,8 +227,6 @@ class EbouticTest(TestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
response = self.generate_bank_valid_answer_from_page_content(response.content)
|
response = self.generate_bank_valid_answer_from_page_content(response.content)
|
||||||
self.assertTrue(response.status_code == 200)
|
|
||||||
self.assertTrue(response.content.decode("utf-8") == "")
|
|
||||||
|
|
||||||
response = self.client.get(
|
response = self.client.get(
|
||||||
reverse(
|
reverse(
|
||||||
|
@ -271,10 +271,6 @@ class EtransactionAutoAnswer(View):
|
|||||||
)
|
)
|
||||||
if b is None:
|
if b is None:
|
||||||
raise SuspiciousOperation("Basket does not exists")
|
raise SuspiciousOperation("Basket does not exists")
|
||||||
if int(b.get_total() * 100) != int(request.GET["Amount"]):
|
|
||||||
raise SuspiciousOperation(
|
|
||||||
"Basket total and amount do not match"
|
|
||||||
)
|
|
||||||
i = Invoice()
|
i = Invoice()
|
||||||
i.user = b.user
|
i.user = b.user
|
||||||
i.payment_method = "CARD"
|
i.payment_method = "CARD"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user