Format eboutic

This commit is contained in:
2017-06-12 09:50:08 +02:00
parent d722efc40f
commit 4395d62cd8
4 changed files with 88 additions and 91 deletions

View File

@ -34,7 +34,8 @@ from django.core.management import call_command
from django.conf import settings
from core.models import User
from counter.models import Customer, ProductType, Product, Counter, Refilling
from counter.models import Product, Counter, Refilling
class EbouticTest(TestCase):
def setUp(self):
@ -74,25 +75,24 @@ class EbouticTest(TestCase):
"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))
" <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))
" <td>1.70 \\xe2\\x82\\xac</td>\\n </tr>" in str(response.content))
response = self.client.post(reverse("eboutic:pay_with_sith"), {
"action": "pay_with_sith_account"
})
})
self.assertTrue("Le paiement a \\xc3\\xa9t\\xc3\\xa9 effectu\\xc3\\xa9\\n" in str(response.content))
response = self.client.get(reverse("core:user_account_detail", kwargs={
"user_id": self.subscriber.id,
"year": datetime.now().year,
"month": datetime.now().month,
}))
}))
self.assertTrue("class=\"selected_tab\">Compte (8.30 \\xe2\\x82\\xac)</a>" in str(response.content))
self.assertTrue("<td>Eboutic</td>\\n <td><a href=\"/user/3/\">Subscribed User</a></td>\\n"
" <td>Barbar</td>\\n <td>1</td>\\n <td>1.70 \\xe2\\x82\\xac</td>\\n"
" <td>Compte utilisateur</td>" in str(response.content))
" <td>Barbar</td>\\n <td>1</td>\\n <td>1.70 \\xe2\\x82\\xac</td>\\n"
" <td>Compte utilisateur</td>" in str(response.content))
def test_buy_simple_product_with_credit_card(self):
self.client.login(username='subscriber', password='plop')
@ -100,11 +100,11 @@ class EbouticTest(TestCase):
"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))
" <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))
" <td>1.70 \\xe2\\x82\\xac</td>\\n </tr>" in str(response.content))
response = self.generate_bank_valid_answer_from_page_content(response.content)
@ -112,11 +112,11 @@ class EbouticTest(TestCase):
"user_id": self.subscriber.id,
"year": datetime.now().year,
"month": datetime.now().month,
}))
}))
self.assertTrue("class=\"selected_tab\">Compte (0.00 \\xe2\\x82\\xac)</a>" in str(response.content))
self.assertTrue("<td>Eboutic</td>\\n <td><a href=\"/user/3/\">Subscribed User</a></td>\\n"
" <td>Barbar</td>\\n <td>1</td>\\n <td>1.70 \\xe2\\x82\\xac</td>\\n"
" <td>Carte bancaire</td>" in str(response.content))
" <td>Barbar</td>\\n <td>1</td>\\n <td>1.70 \\xe2\\x82\\xac</td>\\n"
" <td>Carte bancaire</td>" in str(response.content))
def test_buy_refill_product_with_credit_card(self):
self.client.login(username='subscriber', password='plop')
@ -124,11 +124,11 @@ class EbouticTest(TestCase):
"action": "add_product",
"product_id": self.refill.id})
self.assertTrue("<input type=\"hidden\" name=\"action\" value=\"add_product\">\\n"
" <button type=\"submit\" name=\"product_id\" value=\"3\"> + </button>\\n"
"</form>\\n Rechargement 15 \\xe2\\x82\\xac: 15.00 \\xe2\\x82\\xac</li>" in str(response.content))
" <button type=\"submit\" name=\"product_id\" value=\"3\"> + </button>\\n"
"</form>\\n Rechargement 15 \\xe2\\x82\\xac: 15.00 \\xe2\\x82\\xac</li>" in str(response.content))
response = self.client.post(reverse("eboutic:command"))
self.assertTrue("<tr>\\n <td>Rechargement 15 \\xe2\\x82\\xac</td>\\n <td>1</td>\\n"
" <td>15.00 \\xe2\\x82\\xac</td>\\n </tr>" in str(response.content))
" <td>15.00 \\xe2\\x82\\xac</td>\\n </tr>" in str(response.content))
response = self.generate_bank_valid_answer_from_page_content(response.content)
@ -136,12 +136,12 @@ class EbouticTest(TestCase):
"user_id": self.subscriber.id,
"year": datetime.now().year,
"month": datetime.now().month,
}))
}))
self.assertTrue("class=\"selected_tab\">Compte (15.00 \\xe2\\x82\\xac)</a>" in str(response.content))
self.assertTrue("<td>\\n <ul>\\n \\n "
"<li>1 x Rechargement 15 \\xe2\\x82\\xac - 15.00 \\xe2\\x82\\xac</li>\\n"
" \\n </ul>\\n </td>\\n"
" <td>15.00 \\xe2\\x82\\xac</td>" in str(response.content))
"<li>1 x Rechargement 15 \\xe2\\x82\\xac - 15.00 \\xe2\\x82\\xac</li>\\n"
" \\n </ul>\\n </td>\\n"
" <td>15.00 \\xe2\\x82\\xac</td>" in str(response.content))
def test_buy_subscribe_product_with_credit_card(self):
self.client.login(username='old_subscriber', password='plop')
@ -151,11 +151,11 @@ class EbouticTest(TestCase):
"action": "add_product",
"product_id": self.cotis.id})
self.assertTrue("<input type=\"hidden\" name=\"action\" value=\"add_product\">\\n"
" <button type=\"submit\" name=\"product_id\" value=\"1\"> + </button>\\n"
"</form>\\n Cotis 1 semestre: 15.00 \\xe2\\x82\\xac</li>" in str(response.content))
" <button type=\"submit\" name=\"product_id\" value=\"1\"> + </button>\\n"
"</form>\\n Cotis 1 semestre: 15.00 \\xe2\\x82\\xac</li>" in str(response.content))
response = self.client.post(reverse("eboutic:command"))
self.assertTrue("<tr>\\n <td>Cotis 1 semestre</td>\\n <td>1</td>\\n"
" <td>15.00 \\xe2\\x82\\xac</td>\\n </tr>" in str(response.content))
" <td>15.00 \\xe2\\x82\\xac</td>\\n </tr>" in str(response.content))
response = self.generate_bank_valid_answer_from_page_content(response.content)
@ -163,14 +163,11 @@ class EbouticTest(TestCase):
"user_id": self.old_subscriber.id,
"year": datetime.now().year,
"month": datetime.now().month,
}))
}))
self.assertTrue("class=\"selected_tab\">Compte (0.00 \\xe2\\x82\\xac)</a>" in str(response.content))
self.assertTrue("<td>\\n <ul>\\n \\n "
"<li>1 x Cotis 1 semestre - 15.00 \\xe2\\x82\\xac</li>\\n"
" \\n </ul>\\n </td>\\n"
" <td>15.00 \\xe2\\x82\\xac</td>" in str(response.content))
"<li>1 x Cotis 1 semestre - 15.00 \\xe2\\x82\\xac</li>\\n"
" \\n </ul>\\n </td>\\n"
" <td>15.00 \\xe2\\x82\\xac</td>" in str(response.content))
response = self.client.get(reverse("core:user_profile", kwargs={"user_id": self.old_subscriber.id}))
self.assertTrue("Cotisant jusqu\\'au" in str(response.content))