Skip to content

Commit

Permalink
Fix tests that fail locally when the search service is configured
Browse files Browse the repository at this point in the history
  • Loading branch information
magopian committed Nov 19, 2024
1 parent 2397515 commit f699f75
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion udata/tests/apiv2/test_datasets.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from datetime import datetime

from flask import url_for
from flask import current_app, url_for

import udata.core.organization.constants as org_constants
from udata.core.dataset.apiv2 import DEFAULT_PAGE_SIZE
Expand Down Expand Up @@ -53,6 +53,8 @@ def test_search_dataset(self):
_dataset_org = DatasetFactory(organization=org)
dataset_org_public_service = DatasetFactory(organization=org_public_service)

# This is needed or the test will fail if you have a search service configured in your udata.cfg file.
current_app.config["SEARCH_SERVICE_API_URL"] = ""
response = self.get(
url_for("apiv2.dataset_search", organization_badge=org_constants.PUBLIC_SERVICE)
)
Expand Down
4 changes: 4 additions & 0 deletions udata/tests/dataset/test_dataset_tasks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest
from flask import current_app

from udata.core.dataset import tasks

Expand All @@ -22,6 +23,9 @@ def test_purge_datasets():
Dataset.objects.create(title="keep me"),
]

# This is needed or the test will fail if you have a search service configured in your udata.cfg file.
current_app.config["SEARCH_SERVICE_API_URL"] = ""

topic = Topic.objects.create(name="test topic", datasets=datasets)

user = UserFactory()
Expand Down

0 comments on commit f699f75

Please sign in to comment.