def test_create_new_work_order_api_error(self, data_api_client):
        self.login_as_buyer()
        data_api_client.get_brief.return_value = test_brief
        data_api_client.find_brief_responses.return_value = {
            'briefResponses': [
                {
                    'supplierCode': 4321,
                    'supplierName': 'test supplier'
                }
            ]
        }

        data_api_client.create_work_order.side_effect = APIError(mock.Mock(status_code=500))

        res = self.client.post(
            self.expand_path(
                '/buyers/frameworks/digital-outcomes-and-specialists/requirements/digital-specialists/1234'
                '/work-orders/create'
            ),
            data={
                'seller': 4321,
                'csrf_token': FakeCsrf.valid_token,
            })

        text = res.get_data(as_text=True)
        assert res.status_code == 500
        assert 'Request failed' in text
Beispiel #2
0
    def test_404_if_supplier_framework_does_not_exist(self):
        self.data_api_client.get_framework.return_value = self.framework_response
        self.data_api_client.get_supplier_framework_info.side_effect = APIError(
            mock.Mock(status_code=404))

        resp = self.client.get(self.opportunities_dashboard_url)

        assert resp.status_code == 404
Beispiel #3
0
    def test_404_if_framework_does_not_exist(self):
        self.data_api_client.get_framework.side_effect = APIError(
            mock.Mock(status_code=404))

        resp = self.client.get(
            '/suppliers/frameworks/does-not-exist/opportunities')

        assert resp.status_code == 404
Beispiel #4
0
    def test_should_404_if_supplier_does_not_exist(self, data_api_client):
        data_api_client.get_supplier.side_effect = APIError(Response(404))

        response = self.client.get(
            '/admin/suppliers/1234/edit/declarations/g-cloud-7')

        eq_(response.status_code, 404)
        data_api_client.get_supplier.assert_called_with('1234')
        assert not data_api_client.get_framework.called
Beispiel #5
0
    def test_404_if_work_order_not_found(self, data_api_client):
        with self.app.app_context():
            self.login_as_buyer()
            data_api_client.get_work_order.side_effect = APIError(
                mock.Mock(status_code=404))

            res = self.client.get(self.expand_path('/work-orders/1234'))

            assert res.status_code == 302
Beispiel #6
0
    def test_should_404_if_framework_does_not_exist(self, data_api_client):
        data_api_client.get_supplier.return_value = self.load_example_listing(
            'supplier_response')
        data_api_client.get_framework.side_effect = APIError(Response(404))

        response = self.client.get(
            '/admin/suppliers/1234/edit/declarations/g-cloud-7')

        eq_(response.status_code, 404)
        data_api_client.get_supplier.assert_called_with('1234')
        data_api_client.get_framework.assert_called_with('g-cloud-7')
Beispiel #7
0
    def test_should_show_no_suppliers_page_if_api_returns_404(self):
        self.data_api_client.find_suppliers.side_effect = APIError(
            mock.Mock(status_code=404))

        res = self.client.get('/g-cloud/suppliers')
        assert res.status_code == 404