Skip to content

test: fix test failures caused by HTTP status codes differences#16

Open
shuuji3 wants to merge 1 commit into
prabhath6:masterfrom
shuuji3:test/replace-403-with-401
Open

test: fix test failures caused by HTTP status codes differences#16
shuuji3 wants to merge 1 commit into
prabhath6:masterfrom
shuuji3:test/replace-403-with-401

Conversation

@shuuji3

@shuuji3 shuuji3 commented Mar 3, 2024

Copy link
Copy Markdown

fixes #14

The tests were failing due to the differences in HTTP response codes. Now, the API server returns 401 Unauthorized when the API token is incorrect.

Test results in local

[theguardian-api-python]  test/replace-403-with-401 (9eb136d) via  v3.11.5
|> python test.py -v
test_content_get_result_with_exception (test_content.TestContent.test_content_get_result_with_exception) ... ok
test_content_response_failure_incorrect_api_key (test_content.TestContent.test_content_response_failure_incorrect_api_key) ... ok
test_content_response_header (test_content.TestContent.test_content_response_header) ... ok
test_content_response_success_correct_details (test_content.TestContent.test_content_response_success_correct_details) ... ok
test_content_results (test_content.TestContent.test_content_results) ... ok
test_content_with_headers (test_content.TestContent.test_content_with_headers) ... ok
test_contents_find_by_id_correct_url (test_content.TestContent.test_contents_find_by_id_correct_url) ... ok
test_contents_find_by_id_incorrect_url (test_content.TestContent.test_contents_find_by_id_incorrect_url) ... ok
test_section_get_references_correct_pages (test_content.TestContent.test_section_get_references_correct_pages) ... ok
test_section_get_references_incorrect_pages (test_content.TestContent.test_section_get_references_incorrect_pages) ... ok
test_edition_get_direct_content (test_edition.TestEdition.test_edition_get_direct_content) ... ok
test_edition_get_indirect_content (test_edition.TestEdition.test_edition_get_indirect_content) ... ok
test_edition_get_indirect_content_invalid_credentials (test_edition.TestEdition.test_edition_get_indirect_content_invalid_credentials) ... ok
test_edition_get_response_section_count (test_edition.TestEdition.test_edition_get_response_section_count) ... ok
test_edition_get_result_with_exception (test_edition.TestEdition.test_edition_get_result_with_exception) ... ok
test_edition_get_result_without_exception (test_edition.TestEdition.test_edition_get_result_without_exception) ... ok
test_edition_response_failure_incorrect_api_key (test_edition.TestEdition.test_edition_response_failure_incorrect_api_key) ... ok
test_edition_response_success_correct_details (test_edition.TestEdition.test_edition_response_success_correct_details) ... ok
test_edition_url (test_edition.TestEdition.test_edition_url) ... ok
test_section_get_direct_content (test_section.TestSection.test_section_get_direct_content) ... ok
test_section_get_indirect_content (test_section.TestSection.test_section_get_indirect_content) ... ok
test_section_get_indirect_content_invalid_credentials (test_section.TestSection.test_section_get_indirect_content_invalid_credentials) ... ok
test_section_get_result_with_exception (test_section.TestSection.test_section_get_result_with_exception) ... ok
test_section_get_result_without_exception (test_section.TestSection.test_section_get_result_without_exception) ... ok
test_section_response_failure_incorrect_api_key (test_section.TestSection.test_section_response_failure_incorrect_api_key) ... ok
test_section_response_success_correct_details (test_section.TestSection.test_section_response_success_correct_details) ... ok
test_section_get_references_correct_pages (test_tag.TestTag.test_section_get_references_correct_pages) ... ok
test_section_get_references_incorrect_pages (test_tag.TestTag.test_section_get_references_incorrect_pages) ... ok
test_tag_get_direct_content (test_tag.TestTag.test_tag_get_direct_content) ... ok
test_tag_get_indirect_content (test_tag.TestTag.test_tag_get_indirect_content) ... ok
test_tag_get_indirect_content_invalid_credentials (test_tag.TestTag.test_tag_get_indirect_content_invalid_credentials) ... ok
test_tag_get_result_with_exception (test_tag.TestTag.test_tag_get_result_with_exception) ... ok
test_tag_get_result_without_exception (test_tag.TestTag.test_tag_get_result_without_exception) ... ok
test_tag_response_failure_incorrect_api_key (test_tag.TestTag.test_tag_response_failure_incorrect_api_key) ... ok
test_tag_response_success_correct_details (test_tag.TestTag.test_tag_response_success_correct_details) ... ok
test_tag_url (test_tag.TestTag.test_tag_url) ... ok

----------------------------------------------------------------------
Ran 36 tests in 37.939s

OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tests failing

1 participant