Exemplo n.º 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))
Exemplo n.º 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'])
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)