예제 #1
0
 def test_view_should_send_error_message(self, get, delete, error):
     get.return_value = Mock(status_code=200)
     delete.return_value = Mock(status_code=403, text=u'error')
     team_name = "avengers"
     user = "******"
     RemoveUser.as_view()(self.request, team=team_name, user=user)
     error.assert_called_with(self.request, u'error', fail_silently=True)
 def test_view_should_send_error_message(self, get, delete, error):
     get.return_value = Mock(status_code=200)
     delete.return_value = Mock(status_code=403, text=u'error')
     team_name = "avengers"
     user = "******"
     RemoveUser.as_view()(self.request, team=team_name,
                          user=user)
     error.assert_called_with(self.request, u'error', fail_silently=True)
 def test_view_should_send_success_message(self, get, delete, success):
     get.return_value = Mock(status_code=200)
     delete.return_value = Mock(status_code=200)
     team_name = "avengers"
     user = "******"
     RemoveUser.as_view()(self.request, team=team_name,
                          user=user)
     success.assert_called_with(self.request, u'User successfully removed!', fail_silently=True)
예제 #4
0
 def test_view_should_send_success_message(self, get, delete, success):
     get.return_value = Mock(status_code=200)
     delete.return_value = Mock(status_code=200)
     team_name = "avengers"
     user = "******"
     RemoveUser.as_view()(self.request, team=team_name, user=user)
     success.assert_called_with(self.request,
                                u'User successfully removed!',
                                fail_silently=True)
 def test_view(self, get, delete, error):
     get.return_value = Mock(status_code=200)
     team_name = "avengers"
     user = "******"
     response = RemoveUser.as_view()(self.request, team=team_name,
                                     user=user)
     self.assertEqual(302, response.status_code)
     url = reverse("team-info", args=[team_name])
     self.assertEqual(url, response.items()[2][1])
     url = "{0}/teams/{1}/{2}".format(settings.TSURU_HOST, team_name, user)
     headers = {"authorization": "admin"}
     delete.assert_called_with(url, headers=headers)
예제 #6
0
 def test_view(self, get, delete, error):
     get.return_value = Mock(status_code=200)
     team_name = "avengers"
     user = "******"
     response = RemoveUser.as_view()(self.request,
                                     team=team_name,
                                     user=user)
     self.assertEqual(302, response.status_code)
     url = reverse("team-info", args=[team_name])
     self.assertEqual(url, response.items()[2][1])
     url = "{0}/teams/{1}/{2}".format(settings.TSURU_HOST, team_name, user)
     headers = {"authorization": "admin"}
     delete.assert_called_with(url, headers=headers)