Beispiel #1
0
 def test_user_profile_readonly(self):
     with patch.object(self.user, 'is_authenticated', return_value=True):
         profile = self.user.profile
         profile.readonly = True
         profile.save()
         response = api.UserProfileViewSet().list(self.mock_request)
         self.assertEqual(True, response.data['readonly'])
Beispiel #2
0
 def test_user_profile(self):
     with patch.object(self.user, 'is_authenticated', return_value=True):
         response = api.UserProfileViewSet().list(self.mock_request)
         expected = {
             'readonly'   : False,
             'can_extract': False,
             'filters'    : [],
             'roles'      : {'default': []}
         }
         self.assertEqual(expected, response.data)
Beispiel #3
0
 def test_user_profile(self):
     response = api.UserProfileViewSet().list(self.mock_request)
     expected = {
         'readonly'   : False,
         'can_extract': False,
         'filters'    : [],
         'roles'      : {'default': []},
         'full_name'  : '',
         'avatar_url' : 'http://gravatar.com/avatar/5d9c68c6c50ed3d02a2fcf54f63993b6?s=80&r=g&d=identicon',
         'user_id'    : self.user.id
     }
     self.assertEqual(expected, response.data)
Beispiel #4
0
 def test_user_profile_not_logged_in(self):
     mock_request = MagicMock(name='request')
     mock_request.user.is_authenticated.return_value = False
     response = api.UserProfileViewSet().list(mock_request)
     self.assertEqual(401, response.status_code)
Beispiel #5
0
 def test_user_profile_readonly(self):
     profile = self.user.profile
     profile.readonly = True
     profile.save()
     response = api.UserProfileViewSet().list(self.mock_request)
     self.assertEqual(True, response.data['readonly'])