mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-06 13:22:12 +00:00
Add a test to verify that a user without data sucessfully returns a respones to the /search endpoint
This commit is contained in:
@@ -85,6 +85,22 @@ def default_user2():
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@pytest.fixture
|
||||
def default_user3():
|
||||
"""
|
||||
This user should not have any data associated with it
|
||||
"""
|
||||
if KhojUser.objects.filter(username="default3").exists():
|
||||
return KhojUser.objects.get(username="default3")
|
||||
|
||||
return KhojUser.objects.create(
|
||||
username="default3",
|
||||
email="default3@example.com",
|
||||
password="default3",
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@pytest.fixture
|
||||
def api_user(default_user):
|
||||
@@ -111,6 +127,19 @@ def api_user2(default_user2):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@pytest.fixture
|
||||
def api_user3(default_user3):
|
||||
if KhojApiUser.objects.filter(user=default_user3).exists():
|
||||
return KhojApiUser.objects.get(user=default_user3)
|
||||
|
||||
return KhojApiUser.objects.create(
|
||||
user=default_user3,
|
||||
name="api-key",
|
||||
token="kk-diff-secret-3",
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def search_models(search_config: SearchConfig):
|
||||
search_models = SearchModels()
|
||||
|
||||
Reference in New Issue
Block a user