Skip to content

Commit

Permalink
monkeypatch _find_scope_by_id method
Browse files Browse the repository at this point in the history
  • Loading branch information
pstokkink committed Feb 26, 2025
1 parent c997479 commit f5803b5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from rest_framework.test import APIClient, APIRequestFactory
from schematools.contrib.django.models import Dataset, DynamicModel, Profile
from schematools.loaders import FileSystemProfileLoader, FileSystemSchemaLoader
from schematools.types import DatasetSchema
from schematools.types import DatasetSchema, Scope

from rest_framework_dso.crs import RD_NEW
from tests.test_rest_framework_dso.models import Actor, Category, Location, Movie, MovieUser
Expand All @@ -30,6 +30,13 @@
DATE_2021_JUNE = datetime(2021, 6, 11, 10, 0, tzinfo=get_current_timezone())


# In test files we use a lot of non-existent scopes, so instead of writing scope
# json files we monkeypatch this method.
@pytest.fixture(autouse=True)
def patch_find_scope_by_id(monkeypatch):
monkeypatch.setattr(DatasetSchema, "_find_scope_by_id", Scope.from_string)


@pytest.fixture()
def api_rf() -> APIRequestFactory:
"""Request factory for APIView classes"""
Expand Down

0 comments on commit f5803b5

Please sign in to comment.