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

[Ellipsis] Create tests #12

Merged
merged 1 commit into from Mar 9, 2024

Conversation

ellipsis-dev[bot]
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot commented Mar 9, 2024

Summary:

⚠️ We couldn't build/test your project to verify our changes. Add a Dockerfile to significantly improve code quality.

Issue: #10

Implementation:

  1. Create a new test file
    • Create a new Python file named 'test_dispatch_to_qa.py' in the 'test/' folder. This file will contain the unit tests for the 'dispatch_to_qa.py' file.
  2. Import necessary modules and define setup
    • In the 'test_dispatch_to_qa.py' file, import the 'pytest' module and the 'dispatch_to_qa.py' file. Then, define a setup function that prepares the necessary data for the tests. The setup function should create mock data for 'user_input', 'chat_history', 'vector_name', and 'stream'.
  3. Define test function for 'prep_request_payload'
    • In the 'test_dispatch_to_qa.py' file, define a test function for 'prep_request_payload'. The test function should call 'prep_request_payload' with the mock data from the setup and check the returned values. Make sure to cover different scenarios and edge cases.
  4. Define test function for 'send_to_qa'
    • In the 'test_dispatch_to_qa.py' file, define a test function for 'send_to_qa'. The test function should call 'send_to_qa' with the mock data from the setup and check the returned values. Make sure to cover different scenarios and edge cases.
  5. Define test function for 'send_to_qa_async'
    • In the 'test_dispatch_to_qa.py' file, define a test function for 'send_to_qa_async'. The test function should call 'send_to_qa_async' with the mock data from the setup and check the returned values. Make sure to cover different scenarios and edge cases.

Report:

Step Result Details
1
Create a new test fileCreated a new test file 'test_dispatch_to_qa.py' in the 'test/' directory. The file currently contains import statements for the necessary modules and placeholders for the setup function and the test functions.
2
Import necessary modules and define setupCreated a new test file 'test_dispatch_to_qa.py' in the 'test/' directory. The file currently contains import statements for the necessary modules and placeholders for the setup function and the test functions. The setup function prepares the necessary data for the tests, and the test functions test the 'prep_request_payload', 'send_to_qa', and 'send_to_qa_async' functions in the 'dispatch_to_qa.py' file.
3
Define test function for 'prep_request_payload'Implemented the test function for 'prep_request_payload'. It calls 'prep_request_payload' with the mock data from the setup and checks the returned 'qna_endpoint' and 'qna_data'.
4
Define test function for 'send_to_qa'Implemented the test function for 'send_to_qa' in the 'test_dispatch_to_qa.py' file. The function uses the 'requests_mock' module to mock a POST request to 'mock_qna_endpoint' that returns a 200 status code and a JSON response or a response content chunk, a 500 status code, or raises an exception. It then calls 'send_to_qa' with the mock data and checks that the returned value is as expected.
5
Define test function for 'send_to_qa_async'Implemented the test function for 'send_to_qa_async' in the 'test_dispatch_to_qa.py' file. The function uses the 'aiohttp' module to mock a POST request to 'mock_qna_endpoint' that returns a 200 status code and a JSON response, a 500 status code, or raises an exception. It then calls 'send_to_qa_async' with the mock data and checks that the returned value is as expected.

Something look wrong?: If this Pull Request doesn't contain the expected changes, add more information to #10. Then, add the ellipsis:create label to try again. For more information, check the documentation.

@MarkEdmondson1234 MarkEdmondson1234 merged commit 1e4cbd2 into main Mar 9, 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 this pull request may close these issues.

None yet

1 participant