mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-08 05:39:13 +00:00
Add additional unit tests to verify behavior of unsubscribed/subscribed users
This commit is contained in:
@@ -102,6 +102,24 @@ def default_user3():
|
||||
return user
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@pytest.fixture
|
||||
def default_user4():
|
||||
"""
|
||||
This user should not have a valid subscription
|
||||
"""
|
||||
if KhojUser.objects.filter(username="default4").exists():
|
||||
return KhojUser.objects.get(username="default4")
|
||||
|
||||
user = KhojUser.objects.create(
|
||||
username="default4",
|
||||
email="default4@example.com",
|
||||
password="default4",
|
||||
)
|
||||
SubscriptionFactory(user=user, renewal_date=None)
|
||||
return user
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@pytest.fixture
|
||||
def api_user(default_user):
|
||||
@@ -141,6 +159,19 @@ def api_user3(default_user3):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@pytest.fixture
|
||||
def api_user4(default_user4):
|
||||
if KhojApiUser.objects.filter(user=default_user4).exists():
|
||||
return KhojApiUser.objects.get(user=default_user4)
|
||||
|
||||
return KhojApiUser.objects.create(
|
||||
user=default_user4,
|
||||
name="api-key",
|
||||
token="kk-diff-secret-4",
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def search_models(search_config: SearchConfig):
|
||||
search_models = SearchModels()
|
||||
|
||||
Reference in New Issue
Block a user