new apps/dashboard/wallet.html for stripe payment integration and user's consumables; nav added to _footer.html & also dynamic copyright year with django now Y template; new apps.dash.tests ITs & UTs reflect new wallet functionality in .urls & .views
This commit is contained in:
49
src/apps/dashboard/tests/integrated/test_wallet_views.py
Normal file
49
src/apps/dashboard/tests/integrated/test_wallet_views.py
Normal file
@@ -0,0 +1,49 @@
|
||||
import lxml.html
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
from apps.lyric.models import Token, User, Wallet
|
||||
|
||||
|
||||
class WalletViewTest(TestCase):
|
||||
def setUp(self):
|
||||
self.user = User.objects.create(email="capman@test.io")
|
||||
self.client.force_login(self.user)
|
||||
response = self.client.get("/dashboard/wallet/")
|
||||
self.parsed = lxml.html.fromstring(response.content)
|
||||
|
||||
def test_wallet_page_requires_login(self):
|
||||
self.client.logout()
|
||||
response = self.client.get("/dashboard/wallet/")
|
||||
self.assertRedirects(
|
||||
response, "/?next=/dashboard/wallet/", fetch_redirect_response=False
|
||||
)
|
||||
|
||||
def test_wallet_page_renders(self):
|
||||
[el] = self.parsed.cssselect("#id_writs_balance")
|
||||
self.assertEqual(el.text_content().strip(), "144")
|
||||
|
||||
def test_wallet_page_shows_esteem_balance(self):
|
||||
[el] = self.parsed.cssselect("#id_esteem_balance")
|
||||
self.assertEqual(el.text_content().strip(), "0")
|
||||
|
||||
def test_wallet_page_shows_coin_on_a_string(self):
|
||||
[_] = self.parsed.cssselect("#id_coin_on_a_string")
|
||||
|
||||
def test_wallet_page_shows_free_token(self):
|
||||
[_] = self.parsed.cssselect("#id_free_token_0")
|
||||
|
||||
def test_wallet_page_shows_payment_methods_section(self):
|
||||
[_] = self.parsed.cssselect("#id_add_payment_method")
|
||||
|
||||
def test_wallet_page_shows_stripe_payment_element(self):
|
||||
[_] = self.parsed.cssselect("#id_stripe_payment_element")
|
||||
|
||||
def test_wallet_page_shows_tithe_token_shop(self):
|
||||
[_] = self.parsed.cssselect("#id_tithe_token_shop")
|
||||
|
||||
def test_tithe_token_shop_shows_bundle(self):
|
||||
bundles = self.parsed.cssselect("#id_tithe_token_shop .token-bundle")
|
||||
self.assertGreater(len(bundles), 0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user