def test_get_username_from_regular_user(self): user_profile_attr = dict(name='timothy', phone='+256775019449', location=self.district, email=None) profile = UserProfile(**user_profile_attr).save() self.assertEqual('', profile.username())
def test_get_username(self): user = User(username='******', password='******').save() user_profile_attr = dict(name='timothy', phone='+256775019449', location=self.district, email=None, user=user) profile = UserProfile(**user_profile_attr).save() self.assertEqual('haha', profile.username())
def test_should_get_a_list_of_users(self): user_profile = UserProfile(**self.mobile_user).save() response = self.client.get(self.API_ENDPOINT, format='json') self.assertEqual(200, response.status_code) self.assertEqual(1, len(response.data)) self.assertEqual(self.mobile_user['name'], response.data[0]['name']) self.assertEqual(self.mobile_user['phone'], response.data[0]['phone']) self.assertEqual(self.mobile_user['email'], response.data[0]['email']) self.assertEqual(user_profile.username(), '') self.assertEqual(self.district.name, response.data[0]['location']['name'])
def test_should_get_a_list_of_users(self): user_profile = UserProfile(**self.mobile_user).save() response = self.client.get(self.API_ENDPOINT, format='json') self.assertEqual(200, response.status_code) self.assertEqual(1, len(response.data)) self.assertEqual(self.mobile_user['name'], response.data[0]['name']) self.assertEqual(self.mobile_user['phone'], response.data[0]['phone']) self.assertEqual(self.mobile_user['email'], response.data[0]['email']) self.assertEqual(user_profile.username(), '') self.assertEqual(self.district.name, response.data[0]['location']['name'])
def test_get_username_from_regular_user(self): user_profile_attr = dict(name='timothy', phone='+256775019449', location=self.district, email=None) profile = UserProfile(**user_profile_attr).save() self.assertEqual('', profile.username())
def test_get_username(self): user = User(username='******', password='******').save() user_profile_attr = dict(name='timothy', phone='+256775019449', location=self.district, email=None, user=user) profile = UserProfile(**user_profile_attr).save() self.assertEqual('haha', profile.username())