Exemple #1
0
    def test_request_complaint_patch_with_optional_args(self, requests):
        tender_id = "test_tender_id"
        item_type = "test_item_type"
        item_id = "test_item_id"
        complaint_id = "test_complaint_id"
        data = {"test_data_field": "test_data_value"}
        client_request_id = "test-client-req-id"
        host = "https://test.host"
        cookies = {"test_cookie_name": "test_cookie_value"}

        url = get_cdb_complaint_url(tender_id, item_type, item_id,
                                    complaint_id)
        json = {"data": data}
        headers = get_cdb_request_headers(client_request_id=client_request_id,
                                          authorization=True)
        timeout = (CONNECT_TIMEOUT, READ_TIMEOUT)

        result = request_cdb_complaint_patch(
            tender_id,
            item_type,
            item_id,
            complaint_id,
            data,
            client_request_id=client_request_id,
            cookies=cookies,
        )

        self.assertEqual(result, requests.patch.return_value)

        requests.patch.assert_called_once_with(url,
                                               json=json,
                                               headers=headers,
                                               timeout=timeout,
                                               cookies=cookies)
Exemple #2
0
    def test_request_tender_data(self, requests):
        tender_id = "test_tender_id"

        url = get_cdb_tender_url(tender_id)
        headers = get_cdb_request_headers(authorization=False)
        timeout = (CONNECT_TIMEOUT, READ_TIMEOUT)

        result = request_cdb_tender_data(tender_id)

        self.assertEqual(result, requests.get.return_value)

        requests.get.assert_called_once_with(url,
                                             headers=headers,
                                             timeout=timeout,
                                             cookies=None)
Exemple #3
0
    def test_request_complaint_search(self, requests):
        complaint_pretty_id = "TEST-PRETTY-ID"

        url = get_cdb_complaint_search_url(complaint_pretty_id)
        headers = get_cdb_request_headers(authorization=True)
        timeout = (CONNECT_TIMEOUT, READ_TIMEOUT)

        result = request_cdb_complaint_search(complaint_pretty_id)

        self.assertEqual(result, requests.get.return_value)

        requests.get.assert_called_once_with(url,
                                             headers=headers,
                                             timeout=timeout,
                                             cookies=None)
Exemple #4
0
    def test_request_complaint_patch(self, requests):
        tender_id = "test_tender_id"
        item_type = "test_item_type"
        item_id = "test_item_id"
        complaint_id = "test_complaint_id"
        data = {"test_data_field": "test_data_value"}

        url = get_cdb_complaint_url(tender_id, item_type, item_id,
                                    complaint_id)
        json = {"data": data}
        headers = get_cdb_request_headers(authorization=True)
        timeout = (CONNECT_TIMEOUT, READ_TIMEOUT)

        result = request_cdb_complaint_patch(tender_id, item_type, item_id,
                                             complaint_id, data)

        self.assertEqual(result, requests.patch.return_value)

        requests.patch.assert_called_once_with(url,
                                               json=json,
                                               headers=headers,
                                               timeout=timeout,
                                               cookies=None)
Exemple #5
0
    def test_request_tender_data_with_optional_args(self, requests):
        tender_id = "test_tender_id"
        client_request_id = "test-client-req-id"
        host = "https://test.host"
        cookies = {"test_cookie_name": "test_cookie_value"}

        url = get_cdb_tender_url(tender_id)
        headers = get_cdb_request_headers(client_request_id=client_request_id,
                                          authorization=False)
        timeout = (CONNECT_TIMEOUT, READ_TIMEOUT)

        result = request_cdb_tender_data(
            tender_id,
            client_request_id=client_request_id,
            cookies=cookies,
        )

        self.assertEqual(result, requests.get.return_value)

        requests.get.assert_called_once_with(url,
                                             headers=headers,
                                             timeout=timeout,
                                             cookies=cookies)
Exemple #6
0
    def test_request_complaint_search_with_optional_args(self, requests):
        complaint_pretty_id = "TEST-PRETTY-ID"
        client_request_id = "test-client-req-id"
        host = "https://test.host"
        cookies = {"test_cookie_name": "test_cookie_value"}

        url = get_cdb_complaint_search_url(complaint_pretty_id)
        headers = get_cdb_request_headers(client_request_id=client_request_id,
                                          authorization=True)
        timeout = (CONNECT_TIMEOUT, READ_TIMEOUT)

        result = request_cdb_complaint_search(
            complaint_pretty_id,
            client_request_id=client_request_id,
            cookies=cookies,
        )

        self.assertEqual(result, requests.get.return_value)

        requests.get.assert_called_once_with(url,
                                             headers=headers,
                                             timeout=timeout,
                                             cookies=cookies)