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

added pytests for config, api and dependency testing #56

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

iam-yashpradhan
Copy link
Collaborator

Added running commands in tests/init.py

"/process-prompt",
json={"user_prompt_text": "Test prompt"}
)
assert response.status_code == 200

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
json={"user_prompt_text": "Test prompt"}
)
assert response.status_code == 200
assert "generated_response" in response.json()

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
"/process-prompt",
json={"user_prompt_text": ""}
)
assert response.status_code == 422

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
"/process-prompt",
json={"user_prompt_text": "a" * 1001}
)
assert response.status_code == 422

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.

with patch.dict(os.environ, test_env_vars):
processor = PromptProcessor()
assert processor.OPENAI_API_KEY == 'test-openai-key'

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.

context_segments, keywords = processor.search_weaviate("test query")
assert isinstance(context_segments, list)
assert isinstance(keywords, list)

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
json={"user_prompt_text": test_prompt}
)

assert response.status_code == 200

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
)

assert response.status_code == 200
assert "generated_response" in response.json()

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.

assert response.status_code == 200
assert "generated_response" in response.json()
assert "context_segments" in response.json()

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
assert response.status_code == 200
assert "generated_response" in response.json()
assert "context_segments" in response.json()
assert "keywords" in response.json()

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
@neal-logan neal-logan merged commit 8187707 into main Nov 25, 2024
5 of 7 checks passed
@neal-logan neal-logan deleted the backend-pytests branch November 25, 2024 01:05
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.

2 participants