def test_get_user_fields(self): fields = get_user_fields() self.assertEqual(fields, ('id', 'username', 'email', 'profile')) mocked_hasattr = patch('comment.api.serializers.hasattr').start() mocked_hasattr.return_value = True fields = get_user_fields() self.assertEqual(fields, ('id', 'username', 'email', 'profile', 'logentry'))
def test_has_image_field(self, mocked_hasattr, mocked_isinstance): mocked_isinstance.return_value = True mocked_hasattr.return_value = True fields = get_user_fields() self.assertIs('logentry' in fields, True)
def test_default_fields(self): fields = get_user_fields() self.assertSetEqual( set(fields), set(settings.COMMENT_USER_API_FIELDS + ['profile']))