Add user account test

This commit is contained in:
c0de 2018-03-11 21:59:51 -05:00
parent 2e8683f4bd
commit d418a9fd08

View File

@ -2,5 +2,30 @@
from __future__ import unicode_literals
from django.test import TestCase
from account.models import Account
from django.contrib.auth.models import User
# Create your tests here.
class AccountTestCase(TestCase):
def setUp(self):
usr1 = User.objects.create(username='usr1',
first_name='test',
last_name='1',
email='test1@example.com')
usr2 = User.objects.create(username='usr2',
first_name='test',
last_name='2',
email='test2@example.com')
Account.objects.create(user=usr1)
Account.objects.create(user=usr2)
def test_user_meta_data(self):
""" Should return some info about these user accounts """
usr1 = User.objects.get(username='usr1')
usr_acct1 = Account.objects.get(user=usr1)
usr2 = User.objects.get(username='usr2')
usr_acct2 = Account.objects.get(user=usr2)
self.assertEqual(usr_acct1.__str__(), {'user': 'usr1', 'first_login': True, 'accepted_terms': None})
self.assertEqual(usr_acct2.__str__(), {'user': 'usr2', 'first_login': True, 'accepted_terms': None})