from test_plus.test import TestCase
class TestUser(TestCase):
def setup(self):
self.user = self.make_user()
def test__str__(self):
self.assertEqual(self.user.__str__(), 'testuser')
def test_get_profile_name(self):
self.assertEqual(self.user.username, 'testuser')
self.user.nickname = '昵称'
self.assertEqual(self.user.nickname, '昵称')
def test_get_absolute_url(self):
self.assertEqual(self.user.get_absolute_url(), '/users/testuser')
Traceback (most recent call last):
File “/home/zanhu/zanhu/users/tests/test_models.py”, line 17, in test_get_profile_name
self.assertEqual(self.user.username, ‘testuser’)
AttributeError: ‘TestUser’ object has no attribute ‘user’