コード例 #1
0
    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'))
コード例 #2
0
 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)
コード例 #3
0
 def test_default_fields(self):
     fields = get_user_fields()
     self.assertSetEqual(
         set(fields), set(settings.COMMENT_USER_API_FIELDS + ['profile']))