Example #1
0
    def test_should_returns_404_when_app_does_not_exists(self, msg_mock, get, delete):
        get.return_value = mock.Mock(status_code=200)
        delete.return_value = mock.Mock(status_code=404, text="app not found")

        response = Unlock.as_view()(self.request, name="appname")

        self.assertEqual(302, response.status_code)
        msg_mock.assert_called_with(self.request, 'app not found', fail_silently=True)
Example #2
0
    def test_should_returns_404_when_app_does_not_exists(
            self, msg_mock, get, delete):
        get.return_value = mock.Mock(status_code=200)
        delete.return_value = mock.Mock(status_code=404, text="app not found")

        response = Unlock.as_view()(self.request, name="appname")

        self.assertEqual(302, response.status_code)
        msg_mock.assert_called_with(self.request,
                                    'app not found',
                                    fail_silently=True)
Example #3
0
    def test_should_redirect_to_the_settings(self, msg_mock, get, delete):
        get.return_value = mock.Mock(status_code=200)
        delete.return_value = mock.Mock(status_code=200)

        response = Unlock.as_view()(self.request, name="appname")

        self.assertEqual(302, response.status_code)
        self.assertIsInstance(response, HttpResponseRedirect)
        self.assertEqual(reverse('app-settings', args=["appname"]), response['Location'])

        url = "{}/apps/appname/lock".format(settings.TSURU_HOST)
        delete.assert_called_with(url, headers={'authorization': 'admin'})
        msg_mock.assert_called_with(self.request, u'App was successfully unlocked', fail_silently=True)
Example #4
0
    def test_should_redirect_to_the_settings(self, msg_mock, get, delete):
        get.return_value = mock.Mock(status_code=200)
        delete.return_value = mock.Mock(status_code=200)

        response = Unlock.as_view()(self.request, name="appname")

        self.assertEqual(302, response.status_code)
        self.assertIsInstance(response, HttpResponseRedirect)
        self.assertEqual(reverse('app-settings', args=["appname"]),
                         response['Location'])

        url = "{}/apps/appname/lock".format(settings.TSURU_HOST)
        delete.assert_called_with(url, headers={'authorization': 'admin'})
        msg_mock.assert_called_with(self.request,
                                    u'App was successfully unlocked',
                                    fail_silently=True)