예제 #1
0
    def test_no_password_is_in_serialized_result(self, serialize_model):
        expected = {
            'id': 1,
            'username': '******',
        }
        serialize_model.return_value = expected

        user = User.objects.get(username='******')
        self.assertEqual(expected, XUser.get_user_dict(user))
예제 #2
0
    def test_get_dict(self):
        user = User.objects.get(username='******')
        result = XUser.get_user_dict(user)

        self.assertEqual(user.pk, result['id'])
        self.assertEqual(user.username, result['username'])
        self.assertEqual(user.email, result['email'])
        self.assertTrue(result['is_active'])
        self.assertFalse(result['is_staff'])
        self.assertFalse(result['is_superuser'])
예제 #3
0
 def test_ensure_password_not_returned(self):
     data = XUser.get_user_dict(self.user)
     self.assertEqual(data['username'], self.user.username)
     self.assertEqual(data['email'], self.user.email)
     self.assertNotIn('password', data)
예제 #4
0
 def test_ensure_password_not_returned(self):
     data = XUser.get_user_dict(self.user)
     self.assertEqual(data['username'], self.user.username)
     self.assertEqual(data['email'], self.user.email)
     self.assertNotIn('password', data)
예제 #5
0
 def test_ensure_password_not_returned(self):
     test_user = self.http_req.user
     data = XUser.get_user_dict(test_user)
     self.assertEqual(data['username'], test_user.username)
     self.assertEqual(data['email'], test_user.email)
     self.assert_('password' not in data)
예제 #6
0
 def test_ensure_password_not_returned(self):
     test_user = self.http_req.user
     data = XUser.get_user_dict(test_user)
     self.assertEqual(data['username'], test_user.username)
     self.assertEqual(data['email'], test_user.email)
     self.assert_('password' not in data)