Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Tests that Use Local Tokens to Actually Hit the Dev Server and Lis Server #1096

Open
1 task
CarsonDavis opened this issue Nov 18, 2024 · 1 comment · May be fixed by #1104
Open
1 task

API Tests that Use Local Tokens to Actually Hit the Dev Server and Lis Server #1096

CarsonDavis opened this issue Nov 18, 2024 · 1 comment · May be fixed by #1104
Assignees

Comments

@CarsonDavis
Copy link
Collaborator

CarsonDavis commented Nov 18, 2024

Description

  • integration test that uses tokens to actually hit the servers
  • pagination works on query endpoint
  • servers return data in the expected format
  • need to test both xli and lrm

Implementation Considerations

Deliverable

Dependencies

depends on #

Acceptance Criteria

@saifrk
Copy link
Collaborator

saifrk commented Nov 26, 2024

Updated Api tests have been included in PR #1104, which tests the following:

-test_process_response_success: Validates that the process_response method correctly handles successful HTTP responses by returning the expected JSON data.
-test_process_response_failure: Ensures that the process_response method raises an exception when the HTTP status code indicates a failure (e.g., 500 Internal Server Error).
-test_query: Checks that the query method sends the correct payload to the backend and processes the response appropriately, expecting a successful result.
-test_sql_query: Tests the execution of SQL queries via the API, including the correct processing and updating of returned data based on a specified SQL command and collection.
-test_get_full_texts: Assesses the functionality for fetching full texts from the API, ensuring that data retrieval and subsequent processing are handled as expected.
-test_process_and_update_data: Verifies that data received from the API is processed correctly and then updated in the database, checking the correctness of the operation by querying the database.
-test_fetch_and_replace_full_text: Evaluates the Celery task responsible for fetching and replacing full text, ensuring that it processes and updates records correctly.
-test_api_init: Validates the initialization of the Api class with different configurations, ensuring it handles both valid and invalid configurations appropriately.
-test_query_dev_server_authentication: Tests the query functionality on development servers that require authentication, ensuring the correct credentials are appended to the request URL.
-test_sql_query_pagination: Tests the SQL query functionality with pagination, making sure that the method handles multiple pages of results correctly.
-test_process_full_text_response: Checks that the _process_full_text_response method correctly processes the batch data, transforming it into the expected format.
-test_process_full_text_response_with_invalid_data: Tests error handling in the _process_full_text_response method, verifying it raises a ValueError when data is missing required elements or the 'Rows' key is absent.
-test_sql_query_missing_token: Ensures that the sql_query method raises an error when no authentication token is available, which is required for accessing the SQL endpoint.

Note: The objective of these tests is also to assess how the server behaves and responds, ensuring that we are informed of any changes from the server end. Since potential changes are already accommodated through error handling in the code, there is no need to hit the actual servers.

@saifrk saifrk linked a pull request Nov 26, 2024 that will close this issue
saifrk pushed a commit that referenced this issue Nov 26, 2024
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 a pull request may close this issue.

2 participants