Пример #1
0
    def test_503(self):
        self.data_api_client.get_brief.side_effect = HTTPError('API is down')
        self.app.config['DEBUG'] = False

        res = self.client.get('/suppliers/opportunities/1/ask-a-question')
        assert res.status_code == 503
        assert u"Sorry, we’re experiencing technical difficulties" in res.get_data(
            as_text=True)
        assert "Try again later." in res.get_data(as_text=True)
    def test_301(self, data_api_client):
        with self.app.test_client():
            self.login()

            data_api_client.get_supplier.side_effect = HTTPError('API is down')
            self.app.config['DEBUG'] = False

            res = self.client.get(self.url_for('main.dashboard'))
            assert_equal(301, res.status_code)
    def test_503(self):
        self.data_api_client.find_direct_award_projects.side_effect = HTTPError(
            'API is down')
        self.app.config['DEBUG'] = False

        res = self.client.get('/buyers')
        assert res.status_code == 503
        assert u"Sorry, we’re experiencing technical difficulties" in res.get_data(
            as_text=True)
        assert "Try again later." in res.get_data(as_text=True)
    def test_503(self, data_api_client):
        with self.app.test_client():
            self.login()

            data_api_client.get_supplier.side_effect = HTTPError('API is down')
            self.app.config['DEBUG'] = False

            res = self.client.get('/suppliers')
            assert res.status_code == 503
            assert u"Sorry, we’re experiencing technical difficulties" in res.get_data(
                as_text=True)
            assert "Try again later." in res.get_data(as_text=True)
 def MockHTTPError(status_code):
     return HTTPError(mock.Mock(status_code=status_code))