Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests for 404 for more methods #84

Merged
merged 2 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Ignore everything to make sure we don't get extra cruft
**
# Unignore the directory with source code
!vardef_client/
# Unignore the directories with domain code
!vardef_client/api/
!vardef_client/docs/
!vardef_client/models/
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
vardef_client/__init__.py
vardef_client/api/__init__.py
vardef_client/api/data_migration_api.py
vardef_client/api/draft_variable_definitions_api.py
vardef_client/api/patches_api.py
vardef_client/api/public_api.py
vardef_client/api/validity_periods_api.py
vardef_client/api/variable_definitions_api.py
vardef_client/api_client.py
vardef_client/api_response.py
vardef_client/configuration.py
vardef_client/exceptions.py
vardef_client/models/__init__.py
vardef_client/models/complete_response.py
vardef_client/models/contact.py
Expand All @@ -26,5 +21,3 @@ vardef_client/models/supported_languages.py
vardef_client/models/update_draft.py
vardef_client/models/validity_period.py
vardef_client/models/variable_status.py
vardef_client/py.typed
vardef_client/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def create_patch(

_response_types_map: dict[str, str | None] = {
"201": "CompleteResponse",
"404": "Problem",
"400": "Problem",
"405": "Problem",
}
Expand Down Expand Up @@ -200,6 +201,7 @@ def create_patch_with_http_info(

_response_types_map: dict[str, str | None] = {
"201": "CompleteResponse",
"404": "Problem",
"400": "Problem",
"405": "Problem",
}
Expand Down Expand Up @@ -287,6 +289,7 @@ def create_patch_without_preload_content(

_response_types_map: dict[str, str | None] = {
"201": "CompleteResponse",
"404": "Problem",
"400": "Problem",
"405": "Problem",
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def create_validity_period(

_response_types_map: dict[str, str | None] = {
"201": "CompleteResponse",
"404": "Problem",
"400": "Problem",
"405": "Problem",
}
Expand Down Expand Up @@ -183,6 +184,7 @@ def create_validity_period_with_http_info(

_response_types_map: dict[str, str | None] = {
"201": "CompleteResponse",
"404": "Problem",
"400": "Problem",
"405": "Problem",
}
Expand Down Expand Up @@ -261,6 +263,7 @@ def create_validity_period_without_preload_content(

_response_types_map: dict[str, str | None] = {
"201": "CompleteResponse",
"404": "Problem",
"400": "Problem",
"405": "Problem",
}
Expand Down Expand Up @@ -673,6 +676,7 @@ def list_validity_periods(

_response_types_map: dict[str, str | None] = {
"200": "List[CompleteResponse]",
"404": "Problem",
}
response_data = self.api_client.call_api(
*_param,
Expand Down Expand Up @@ -738,6 +742,7 @@ def list_validity_periods_with_http_info(

_response_types_map: dict[str, str | None] = {
"200": "List[CompleteResponse]",
"404": "Problem",
}
response_data = self.api_client.call_api(
*_param,
Expand Down Expand Up @@ -803,6 +808,7 @@ def list_validity_periods_without_preload_content(

_response_types_map: dict[str, str | None] = {
"200": "List[CompleteResponse]",
"404": "Problem",
}
response_data = self.api_client.call_api(
*_param,
Expand Down Expand Up @@ -845,6 +851,7 @@ def _list_validity_periods_serialize(
_header_params["Accept"] = self.api_client.select_header_accept(
[
"application/json",
"application/problem+json",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class VariableStatus(str, Enum):
DRAFT = "DRAFT"
PUBLISHED_INTERNAL = "PUBLISHED_INTERNAL"
PUBLISHED_EXTERNAL = "PUBLISHED_EXTERNAL"
DEPRECATED = "DEPRECATED"

@classmethod
def from_json(cls, json_str: str) -> Self:
Expand Down
1 change: 1 addition & 0 deletions tests/utils/constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from datetime import date

VARDEF_EXAMPLE_DEFINITION_ID = "wypvb3wd"
VARDEF_EXAMPLE_INVALID_ID = "invalid id"
VARDEF_EXAMPLE_ACTIVE_GROUP = "dapla-felles-developers"
VARDEF_EXAMPLE_DATE = date(1970, 1, 1)
JUPYTERHUB_USER = "JUPYTERHUB_USER"
Expand Down
28 changes: 21 additions & 7 deletions tests/variable_definitions/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
)
from dapla_metadata.variable_definitions.variable_definition import VariableDefinition
from tests.utils.constants import VARDEF_EXAMPLE_DEFINITION_ID
from tests.utils.constants import VARDEF_EXAMPLE_INVALID_ID
from tests.utils.microcks_testcontainer import MicrocksContainer


Expand Down Expand Up @@ -90,14 +91,13 @@ def draft(language_string_type, contact) -> Draft:
)


@pytest.fixture
def variable_definition(language_string_type, contact, owner) -> VariableDefinition:
def sample_variable_definition() -> VariableDefinition:
return VariableDefinition(
id=VARDEF_EXAMPLE_DEFINITION_ID,
patch_id=1,
name=language_string_type,
name=LanguageStringType(nb="test", nn="test", en="test"),
short_name="var_test",
definition=language_string_type,
definition=LanguageStringType(nb="test", nn="test", en="test"),
classification_reference="91",
unit_types=["01"],
subject_fields=["a", "b"],
Expand All @@ -107,17 +107,31 @@ def variable_definition(language_string_type, contact, owner) -> VariableDefinit
valid_from=date(2024, 11, 1),
valid_until=None,
external_reference_uri="http://www.example.com",
comment=language_string_type,
comment=LanguageStringType(nb="test", nn="test", en="test"),
related_variable_definition_uris=["http://www.example.com"],
contact=contact,
owner=owner,
contact=Contact(
title=LanguageStringType(nb="test", nn="test", en="test"),
email="[email protected]",
),
owner=Owner(team="my_team", groups=["my_team_developers"]),
created_at=date(2024, 11, 1),
created_by=Person(code="724", name="name"),
last_updated_at=date(2024, 11, 1),
last_updated_by=Person(code="724", name="name"),
)


def unknown_variable_definition() -> VariableDefinition:
unknown = sample_variable_definition()
unknown.id = VARDEF_EXAMPLE_INVALID_ID
return unknown


@pytest.fixture
def variable_definition() -> VariableDefinition:
return sample_variable_definition()


@pytest.fixture
def update_draft(language_string_type, contact, owner) -> UpdateDraft:
return UpdateDraft(
Expand Down
Loading
Loading