mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-14 17:03:29 +03:00
f578b2fa00
# Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. ## Checklist before requesting a review Please delete options that are not relevant. - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented hard-to-understand areas - [ ] I have ideally added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged ## Screenshots (if appropriate):
74 lines
2.1 KiB
Python
74 lines
2.1 KiB
Python
from modules.onboarding.service.onboarding_service import OnboardingService
|
|
|
|
onboardingService = OnboardingService()
|
|
|
|
|
|
def test_remove_onboarding(client, api_key):
|
|
response = client.put(
|
|
"/onboarding",
|
|
headers={"Authorization": "Bearer " + api_key},
|
|
json={
|
|
"onboarding_a": False,
|
|
"onboarding_b1": False,
|
|
"onboarding_b2": False,
|
|
"onboarding_b3": False,
|
|
},
|
|
)
|
|
assert response.status_code == 404
|
|
assert response.json() == {"detail": "User onboarding not updated"}
|
|
|
|
|
|
def test_create_onboarding(client, api_key):
|
|
response = client.get("/user", headers={"Authorization": "Bearer " + api_key})
|
|
|
|
create_user_onboarding_response = onboardingService.create_user_onboarding(
|
|
response.json().get("id")
|
|
)
|
|
assert create_user_onboarding_response == {
|
|
"onboarding_a": True,
|
|
"onboarding_b1": True,
|
|
"onboarding_b2": True,
|
|
"onboarding_b3": True,
|
|
}
|
|
|
|
|
|
def test_get_onboarding(client, api_key):
|
|
response = client.get(
|
|
"/onboarding",
|
|
headers={"Authorization": "Bearer " + api_key},
|
|
)
|
|
assert response.status_code == 200
|
|
assert "onboarding_a" in response.json()
|
|
assert "onboarding_b1" in response.json()
|
|
assert "onboarding_b2" in response.json()
|
|
assert "onboarding_b3" in response.json()
|
|
|
|
|
|
def test_update_onboarding_to_false(client, api_key):
|
|
response = client.put(
|
|
"/onboarding",
|
|
headers={"Authorization": "Bearer " + api_key},
|
|
json={
|
|
"onboarding_a": False,
|
|
"onboarding_b1": False,
|
|
"onboarding_b2": False,
|
|
"onboarding_b3": False,
|
|
},
|
|
)
|
|
assert response.status_code == 200
|
|
assert response.json() == {
|
|
"onboarding_a": False,
|
|
"onboarding_b1": False,
|
|
"onboarding_b2": False,
|
|
"onboarding_b3": False,
|
|
}
|
|
|
|
|
|
def test_onboarding_empty(client, api_key):
|
|
response = client.get(
|
|
"/onboarding",
|
|
headers={"Authorization": "Bearer " + api_key},
|
|
)
|
|
assert response.status_code == 200
|
|
assert response.json() == None
|