From 5c26e551a1977f7195d108b5448763d9fa0c5c18 Mon Sep 17 00:00:00 2001 From: Ricki <141253288+RickiJay-WMDE@users.noreply.github.com> Date: Tue, 8 Oct 2024 12:16:28 +0200 Subject: [PATCH 1/2] Enums & Consistency Fixes (#35) * Use Enums * str * Consistent Optional * Return Stats * Fix Tests --- model/database/wikibase_category_model.py | 3 +++ model/database/wikibase_model.py | 8 +++++--- model/enum/wikibase_category_enum.py | 8 +++----- model/enum/wikibase_log_type_enum.py | 3 +++ model/enum/wikibase_user_type_enum.py | 3 +++ .../observation/log/wikibase_log_collection.py | 15 ++++++++------- model/strawberry/output/wikibase.py | 12 +++++------- model/strawberry/output/wikibase_location.py | 2 +- model/strawberry/output/wikibase_url_set.py | 8 ++++++++ tests/test_query/test_wikibase_list_query.py | 4 +++- 10 files changed, 42 insertions(+), 24 deletions(-) diff --git a/model/database/wikibase_category_model.py b/model/database/wikibase_category_model.py index e818db5e..c1827571 100644 --- a/model/database/wikibase_category_model.py +++ b/model/database/wikibase_category_model.py @@ -27,3 +27,6 @@ class WikibaseCategoryModel(ModelBase): "category", Enum(WikibaseCategory), nullable=False ) """Category""" + + def __str__(self): + return f"WikibaseCategoryModel(id={self.id}, category={self.category})" diff --git a/model/database/wikibase_model.py b/model/database/wikibase_model.py index 8654df27..f39bb5cb 100644 --- a/model/database/wikibase_model.py +++ b/model/database/wikibase_model.py @@ -36,16 +36,18 @@ class WikibaseModel(ModelBase): ) """Organization""" - description: Mapped[str] = mapped_column("description", String, nullable=True) + description: Mapped[Optional[str]] = mapped_column( + "description", String, nullable=True + ) """Description""" country: Mapped[Optional[str]] = mapped_column("country", String, nullable=True) """Country""" - region: Mapped[str] = mapped_column("region", String, nullable=True) + region: Mapped[Optional[str]] = mapped_column("region", String, nullable=True) """Region""" - category_id: Mapped[int] = mapped_column( + category_id: Mapped[Optional[int]] = mapped_column( "wikibase_category_id", ForeignKey(column="wikibase_category.id", name="wikibase_category"), nullable=True, diff --git a/model/enum/wikibase_category_enum.py b/model/enum/wikibase_category_enum.py index fc991f7c..a1c52664 100644 --- a/model/enum/wikibase_category_enum.py +++ b/model/enum/wikibase_category_enum.py @@ -2,7 +2,10 @@ import enum +import strawberry + +@strawberry.enum class WikibaseCategory(enum.Enum): """Wikibase Category""" @@ -17,8 +20,3 @@ class WikibaseCategory(enum.Enum): SEMANTIC_AND_PROSOPOGRAPHIC_DATA = 9 SOCIAL_AND_ADVOCACY = 10 TECHNOLOGY_AND_OPEN_SOURCE = 11 - - -def wikibase_category_name(category: WikibaseCategory) -> str: - """Human-Readable Category""" - return category.name.replace("_", " ").title().replace("And", "and") diff --git a/model/enum/wikibase_log_type_enum.py b/model/enum/wikibase_log_type_enum.py index c23e2487..1179733a 100644 --- a/model/enum/wikibase_log_type_enum.py +++ b/model/enum/wikibase_log_type_enum.py @@ -4,7 +4,10 @@ import re from typing import Optional +import strawberry + +@strawberry.enum class WikibaseLogType(enum.Enum): """Wikibase Log Type""" diff --git a/model/enum/wikibase_user_type_enum.py b/model/enum/wikibase_user_type_enum.py index 909e15c4..89f0eab1 100644 --- a/model/enum/wikibase_user_type_enum.py +++ b/model/enum/wikibase_user_type_enum.py @@ -2,7 +2,10 @@ import enum +import strawberry + +@strawberry.enum class WikibaseUserType(enum.Enum): """Wikibase User Type""" diff --git a/model/strawberry/output/observation/log/wikibase_log_collection.py b/model/strawberry/output/observation/log/wikibase_log_collection.py index e4112a08..2e13f61d 100644 --- a/model/strawberry/output/observation/log/wikibase_log_collection.py +++ b/model/strawberry/output/observation/log/wikibase_log_collection.py @@ -9,6 +9,7 @@ WikibaseLogMonthObservationModel, WikibaseLogMonthUserTypeObservationModel, ) +from model.enum import WikibaseLogType, WikibaseUserType from model.strawberry.scalars import BigInt @@ -32,7 +33,7 @@ class WikibaseLogCollectionStrawberryModel: class WikibaseLogMonthLogTypeStrawberryModel(WikibaseLogCollectionStrawberryModel): """Wikibase Log Month, specific Log Type""" - log_type: str = strawberry.field(description="Log Type") + log_type: WikibaseLogType = strawberry.field(description="Log Type") human_users: int = strawberry.field( description="Distinct (Probably) Human User Count", graphql_type=BigInt ) @@ -45,7 +46,7 @@ def marshal( return cls( id=strawberry.ID(model.id), - log_type=model.log_type.name, + log_type=model.log_type, log_count=model.log_count, all_users=model.user_count, human_users=model.human_user_count, @@ -58,17 +59,17 @@ def marshal( class WikibaseLogMonthUserTypeStrawberryModel(WikibaseLogCollectionStrawberryModel): """Wikibase Log Month, specific User Type""" - user_type: str = strawberry.field(description="User Type") + user_type: WikibaseUserType = strawberry.field(description="User Type") @classmethod def marshal( cls, model: WikibaseLogMonthUserTypeObservationModel - ) -> "WikibaseLogMonthLogTypeStrawberryModel": + ) -> "WikibaseLogMonthUserTypeStrawberryModel": """Coerce Database Model to Strawberry Model""" return cls( id=strawberry.ID(model.id), - user_type=model.user_type.name, + user_type=model.user_type, log_count=model.log_count, all_users=model.user_count, first_log_date=model.first_log_date, @@ -108,13 +109,13 @@ def marshal( WikibaseLogMonthLogTypeStrawberryModel.marshal(r) for r in model.log_type_records ], - key=lambda x: x.log_type, + key=lambda x: x.log_type.value, ), user_type_records=sorted( [ WikibaseLogMonthUserTypeStrawberryModel.marshal(r) for r in model.user_type_records ], - key=lambda x: x.user_type, + key=lambda x: x.user_type.value, ), ) diff --git a/model/strawberry/output/wikibase.py b/model/strawberry/output/wikibase.py index 4687edc8..cbe502bf 100644 --- a/model/strawberry/output/wikibase.py +++ b/model/strawberry/output/wikibase.py @@ -7,7 +7,7 @@ from data.database_connection import get_async_session from model.database import WikibaseModel -from model.enum.wikibase_category_enum import wikibase_category_name +from model.enum import WikibaseCategory from model.strawberry.output.observation import ( WikibaseConnectivityObservationStrawberryModel, WikibaseLogObservationStrawberryModel, @@ -30,7 +30,9 @@ class WikibaseStrawberryModel: title: str = strawberry.field(description="Wikibase Name") organization: Optional[str] = strawberry.field(description="Organization") description: Optional[str] = strawberry.field(description="Description") - category: Optional[str] = strawberry.field(description="Wikibase Category") + category: Optional[WikibaseCategory] = strawberry.field( + description="Wikibase Category" + ) location: WikibaseLocationStrawberryModel = strawberry.field( description="Wikibase Location" @@ -236,11 +238,7 @@ def marshal(cls, model: WikibaseModel) -> "WikibaseStrawberryModel": title=model.wikibase_name, organization=model.organization, description=model.description, - category=( - wikibase_category_name(model.category.category) - if model.category is not None - else None - ), + category=model.category.category if model.category is not None else None, location=WikibaseLocationStrawberryModel.marshal(model), urls=WikibaseURLSetStrawberryModel.marshal(model), ) diff --git a/model/strawberry/output/wikibase_location.py b/model/strawberry/output/wikibase_location.py index 79488084..ddc85f3a 100644 --- a/model/strawberry/output/wikibase_location.py +++ b/model/strawberry/output/wikibase_location.py @@ -11,7 +11,7 @@ class WikibaseLocationStrawberryModel: """Wikibase Location""" country: Optional[str] = strawberry.field(description="Country") - region: str = strawberry.field(description="Region") + region: Optional[str] = strawberry.field(description="Region") @classmethod def marshal(cls, model: WikibaseModel) -> "WikibaseLocationStrawberryModel": diff --git a/model/strawberry/output/wikibase_url_set.py b/model/strawberry/output/wikibase_url_set.py index 3d736351..833771a4 100644 --- a/model/strawberry/output/wikibase_url_set.py +++ b/model/strawberry/output/wikibase_url_set.py @@ -17,6 +17,9 @@ class WikibaseURLSetStrawberryModel: sparql_endpoint_url: Optional[str] = strawberry.field( description="SPARQL Endpoint URL" ) + special_statistics_url: Optional[str] = strawberry.field( + description="Special:Statistics URL" + ) special_version_url: Optional[str] = strawberry.field( description="Special:Version URL" ) @@ -43,6 +46,11 @@ def marshal(cls, model: WikibaseModel) -> "WikibaseURLSetStrawberryModel": if model.sparql_endpoint_url is not None else None ), + special_statistics_url=( + model.special_statistics_url.url + if model.special_statistics_url is not None + else None + ), special_version_url=( model.special_version_url.url if model.special_version_url is not None diff --git a/tests/test_query/test_wikibase_list_query.py b/tests/test_query/test_wikibase_list_query.py index 44bc784b..224276bc 100644 --- a/tests/test_query/test_wikibase_list_query.py +++ b/tests/test_query/test_wikibase_list_query.py @@ -24,6 +24,7 @@ indexApi sparqlEndpointUrl sparqlUrl + specialStatisticsUrl specialVersionUrl } connectivityObservations { @@ -96,7 +97,7 @@ async def test_wikibase_list_query(): assert_property_value(result_datum, "id", "1") assert_property_value(result_datum, "title", "Mock Wikibase") assert_property_value( - result_datum, "category", "Experimental and Prototype Projects" + result_datum, "category", "EXPERIMENTAL_AND_PROTOTYPE_PROJECTS" ) assert_property_value( result_datum, "description", "Mock wikibase for testing this codebase" @@ -113,6 +114,7 @@ async def test_wikibase_list_query(): ("indexApi", "example.com/w/index.php"), ("sparqlEndpointUrl", "query.example.com/sparql"), ("sparqlUrl", "query.example.com"), + ("specialStatisticsUrl", "example.com/wiki/Special:Statistics"), ("specialVersionUrl", "example.com/wiki/Special:Version"), ]: assert_layered_property_value(result_datum, ["urls", url_name], url) From 2b49183e8314bd03333b00ac4b6540a5ce24eae0 Mon Sep 17 00:00:00 2001 From: Ricki <141253288+RickiJay-WMDE@users.noreply.github.com> Date: Wed, 30 Oct 2024 10:18:39 +0100 Subject: [PATCH 2/2] feat: Input Wikibase (#34) * Use Enums * str * Optional, Variables * Add * Add Wikibase * Pass Tests * Remove Data * Format * Fixes * Alphabetize * Who Could Ask For Anything More * Typo * Test Add * Dependencies * String * Marker * Return Type * Greenlet Error * Optional Description * Optional * Specify --- data/wikibase-test-data.db | Bin 143360 -> 143360 bytes model/database/wikibase_model.py | 25 ++++++ model/strawberry/input/__init__.py | 3 + model/strawberry/input/wikibase_input.py | 28 ++++++ model/strawberry/input/wikibase_url_input.py | 23 +++++ model/strawberry/mutation.py | 6 ++ pytest.ini | 1 + requirements-dev.txt | 2 +- resolvers/__init__.py | 1 + resolvers/add_wikibase.py | 80 ++++++++++++++++++ .../test_create_connectivity_observation.py | 12 ++- .../test_create_log_observation.py | 4 +- ..._create_property_popularity_observation.py | 8 +- .../test_create_quantity_observation.py | 4 +- ...est_create_software_version_observation.py | 4 +- .../test_create_statistics_observation.py | 4 +- .../test_create_user_observation.py | 2 +- tests/test_mutation/__init__.py | 1 + tests/test_mutation/test_add_wikibase.py | 47 ++++++++++ tests/test_query/test_wikibase_list_query.py | 1 + 20 files changed, 244 insertions(+), 12 deletions(-) create mode 100644 model/strawberry/input/__init__.py create mode 100644 model/strawberry/input/wikibase_input.py create mode 100644 model/strawberry/input/wikibase_url_input.py create mode 100644 resolvers/add_wikibase.py create mode 100644 tests/test_mutation/__init__.py create mode 100644 tests/test_mutation/test_add_wikibase.py diff --git a/data/wikibase-test-data.db b/data/wikibase-test-data.db index e992498fbc9005231abd168596375a5c929feea1..9117fa0d8b15842f61957b6d7307d435d6afa314 100644 GIT binary patch delta 252 zcmZp8z|ru4V}g_rqY?uHgEA0{0x=^HiB8lpVq#Rjoma7{ZFS0BOP*~I;06_qExJp|9 delta 904 zcmaKqZ%7ki9LMjs-EF&Jd(^U7rd?Tby(a(1XTvu2OazQ~13LRoN6zGyCrBOX5 zdm`E>n`^_0x*SoY*jX`w=fRyK@m3qwd%N@cK0Y7{J-+{n`(z`Im#L$$GTF$AelF14 z748l3f$KTl*f`$WQ_#AJ%(Xbb#qqvQe~;h`{u5>6x@3&S8mw5+a8B@b^4I!8y73Ix5zI}#Jx4Jv>52!lm4Mmm+ICLlckKA`9jF#KWok=s1gbZ` z!Luc(1M0NRedVahmB1nM`v)i^58rV$XG)gg0Z>gg_msGqy1fQ_&5tWkk1<$=1.13 black>=24.8 freezegun>=1.5 -great-expectations>=1.0 +great-expectations>=1.0,<1.2 pylint>=3.3 pytest>=8.3 pytest-asyncio>=0.24 diff --git a/resolvers/__init__.py b/resolvers/__init__.py index 5ad8ac48..bef7e4ab 100644 --- a/resolvers/__init__.py +++ b/resolvers/__init__.py @@ -1,5 +1,6 @@ """Resolvers""" +from resolvers.add_wikibase import add_wikibase from resolvers.get_aggregate_created import get_aggregate_created from resolvers.get_aggregate_property_popularity import ( get_aggregate_property_popularity, diff --git a/resolvers/add_wikibase.py b/resolvers/add_wikibase.py new file mode 100644 index 00000000..e3c9b45f --- /dev/null +++ b/resolvers/add_wikibase.py @@ -0,0 +1,80 @@ +"""Add Wikibase""" + +from sqlalchemy import func, select +from data.database_connection import get_async_session +from model.database import WikibaseCategoryModel, WikibaseModel, WikibaseURLModel +from model.strawberry.input import WikibaseInput +from model.strawberry.output import WikibaseStrawberryModel + + +async def add_wikibase(wikibase_input: WikibaseInput) -> WikibaseStrawberryModel: + """Add Wikibase""" + + async with get_async_session() as async_session: + + assert ( + await async_session.scalar( + select(func.count()).where( # pylint: disable=not-callable + WikibaseModel.wikibase_name == wikibase_input.wikibase_name.strip() + ) + ) + ) == 0, ( + f"Wikibase with name {wikibase_input.wikibase_name.strip()} already exists" + ) + + for input_url in [ + wikibase_input.urls.action_api_url, + wikibase_input.urls.base_url, + wikibase_input.urls.index_api_url, + wikibase_input.urls.sparql_endpoint_url, + wikibase_input.urls.sparql_query_url, + wikibase_input.urls.special_statistics_url, + wikibase_input.urls.special_version_url, + ]: + if input_url is not None: + stripped_input_url: str = input_url.strip() + assert ( + await async_session.scalar( + select(func.count()).where( # pylint: disable=not-callable + WikibaseURLModel.url == stripped_input_url + ) + ) + ) == 0, f"URL {stripped_input_url} already exists" + + model = WikibaseModel( + wikibase_name=wikibase_input.wikibase_name, + description=wikibase_input.description, + organization=wikibase_input.organization, + country=wikibase_input.country, + region=wikibase_input.region, + base_url=wikibase_input.urls.base_url, + action_api_url=wikibase_input.urls.action_api_url, + index_api_url=wikibase_input.urls.index_api_url, + sparql_endpoint_url=wikibase_input.urls.sparql_endpoint_url, + sparql_query_url=wikibase_input.urls.sparql_query_url, + special_statistics_url=wikibase_input.urls.special_statistics_url, + special_version_url=wikibase_input.urls.special_version_url, + ) + model.checked = True + model.category = ( + ( + await async_session.scalars( + select(WikibaseCategoryModel).where( + WikibaseCategoryModel.category == wikibase_input.category.name + ) + ) + ).one() + if wikibase_input.category is not None + else None + ) + + async_session.add(model) + + await async_session.flush() + await async_session.refresh(model) + + returning = WikibaseStrawberryModel.marshal(model) + + await async_session.commit() + + return returning diff --git a/tests/test_create_observation/test_create_connectivity_observation.py b/tests/test_create_observation/test_create_connectivity_observation.py index 9cd0d40e..647f6a51 100644 --- a/tests/test_create_observation/test_create_connectivity_observation.py +++ b/tests/test_create_observation/test_create_connectivity_observation.py @@ -8,7 +8,9 @@ @pytest.mark.asyncio @pytest.mark.connectivity -@pytest.mark.dependency(name="connectivity-success-simple") +@pytest.mark.dependency( + name="connectivity-success-simple", depends=["add-wikibase"], scope="session" +) @pytest.mark.sparql @pytest.mark.parametrize( ["links"], @@ -51,7 +53,9 @@ async def test_create_connectivity_observation_success( @pytest.mark.asyncio @pytest.mark.connectivity -@pytest.mark.dependency(name="connectivity-success-complex") +@pytest.mark.dependency( + name="connectivity-success-complex", depends=["add-wikibase"], scope="session" +) @pytest.mark.sparql async def test_create_connectivity_observation_success_complex(mocker): """Test""" @@ -81,7 +85,9 @@ async def test_create_connectivity_observation_success_complex(mocker): @pytest.mark.asyncio @pytest.mark.connectivity -@pytest.mark.dependency(name="connectivity-failure") +@pytest.mark.dependency( + name="connectivity-failure", depends=["add-wikibase"], scope="session" +) @pytest.mark.sparql async def test_create_connectivity_observation_failure(mocker): """Test""" diff --git a/tests/test_create_observation/test_create_log_observation/test_create_log_observation.py b/tests/test_create_observation/test_create_log_observation/test_create_log_observation.py index 76b714d6..7a4f3926 100644 --- a/tests/test_create_observation/test_create_log_observation/test_create_log_observation.py +++ b/tests/test_create_observation/test_create_log_observation/test_create_log_observation.py @@ -13,7 +13,7 @@ @freeze_time("2024-03-01") @pytest.mark.asyncio -@pytest.mark.dependency(name="log-success-1") +@pytest.mark.dependency(name="log-success-1", depends=["add-wikibase"], scope="session") @pytest.mark.log async def test_create_log_observation(mocker): """Test One-Pull Per Month, Data Returned Scenario""" @@ -59,7 +59,7 @@ async def test_create_log_observation(mocker): @freeze_time("2024-03-01") @pytest.mark.asyncio -@pytest.mark.dependency(name="log-failure") +@pytest.mark.dependency(name="log-failure", depends=["add-wikibase"], scope="session") @pytest.mark.log async def test_create_log_observation_error(mocker): """Test One-Pull Per Month, Error Returned Scenario""" diff --git a/tests/test_create_observation/test_create_property_popularity_observation.py b/tests/test_create_observation/test_create_property_popularity_observation.py index f338c8b7..ee6ec509 100644 --- a/tests/test_create_observation/test_create_property_popularity_observation.py +++ b/tests/test_create_observation/test_create_property_popularity_observation.py @@ -6,7 +6,9 @@ @pytest.mark.asyncio -@pytest.mark.dependency(name="property-popularity-success") +@pytest.mark.dependency( + name="property-popularity-success", depends=["add-wikibase"], scope="session" +) @pytest.mark.property @pytest.mark.sparql async def test_create_property_popularity_observation_success(mocker): @@ -30,7 +32,9 @@ async def test_create_property_popularity_observation_success(mocker): @pytest.mark.asyncio -@pytest.mark.dependency(name="property-popularity-failure") +@pytest.mark.dependency( + name="property-popularity-failure", depends=["add-wikibase"], scope="session" +) @pytest.mark.property @pytest.mark.sparql async def test_create_property_popularity_observation_failure(mocker): diff --git a/tests/test_create_observation/test_create_quantity_observation.py b/tests/test_create_observation/test_create_quantity_observation.py index 3e6dc044..06a5bd76 100644 --- a/tests/test_create_observation/test_create_quantity_observation.py +++ b/tests/test_create_observation/test_create_quantity_observation.py @@ -7,7 +7,9 @@ @pytest.mark.asyncio -@pytest.mark.dependency(name="quantity-success") +@pytest.mark.dependency( + name="quantity-success", depends=["add-wikibase"], scope="session" +) @pytest.mark.quantity @pytest.mark.sparql async def test_create_quantity_observation_success(mocker): diff --git a/tests/test_create_observation/test_create_software_version_observation/test_create_software_version_observation.py b/tests/test_create_observation/test_create_software_version_observation/test_create_software_version_observation.py index 69c8f92d..687127da 100644 --- a/tests/test_create_observation/test_create_software_version_observation/test_create_software_version_observation.py +++ b/tests/test_create_observation/test_create_software_version_observation/test_create_software_version_observation.py @@ -14,7 +14,9 @@ @pytest.mark.asyncio -@pytest.mark.dependency(name="software-version-success") +@pytest.mark.dependency( + name="software-version-success", depends=["add-wikibase"], scope="session" +) @pytest.mark.version async def test_create_software_version_observation_success(mocker): """Test Data Returned Scenario""" diff --git a/tests/test_create_observation/test_create_statistics_observation/test_create_statistics_observation.py b/tests/test_create_observation/test_create_statistics_observation/test_create_statistics_observation.py index 5d524912..d0ee7168 100644 --- a/tests/test_create_observation/test_create_statistics_observation/test_create_statistics_observation.py +++ b/tests/test_create_observation/test_create_statistics_observation/test_create_statistics_observation.py @@ -12,7 +12,9 @@ @pytest.mark.asyncio -@pytest.mark.dependency(name="statistics-success") +@pytest.mark.dependency( + name="statistics-success", depends=["add-wikibase"], scope="session" +) @pytest.mark.statistics async def test_create_statistics_observation_success(mocker): """Test Data Returned Scenario""" diff --git a/tests/test_create_observation/test_create_user_observation.py b/tests/test_create_observation/test_create_user_observation.py index 32859819..bab73cf2 100644 --- a/tests/test_create_observation/test_create_user_observation.py +++ b/tests/test_create_observation/test_create_user_observation.py @@ -13,7 +13,7 @@ @pytest.mark.asyncio -@pytest.mark.dependency(name="user-empty") +@pytest.mark.dependency(name="user-empty", depends=["add-wikibase"], scope="session") @pytest.mark.user async def test_create_user_observation_empty(mocker): """Test No-Data Scenario""" diff --git a/tests/test_mutation/__init__.py b/tests/test_mutation/__init__.py new file mode 100644 index 00000000..8a5e488b --- /dev/null +++ b/tests/test_mutation/__init__.py @@ -0,0 +1 @@ +"""Test Mutation""" diff --git a/tests/test_mutation/test_add_wikibase.py b/tests/test_mutation/test_add_wikibase.py new file mode 100644 index 00000000..47ad581b --- /dev/null +++ b/tests/test_mutation/test_add_wikibase.py @@ -0,0 +1,47 @@ +"""Test Add Wikibase""" + +import pytest +from tests.test_schema import test_schema +from tests.utils import assert_layered_property_value + + +ADD_WIKIBASE_QUERY = """ +mutation MyMutation($wikibaseInput: WikibaseInput!) { + addWikibase(wikibaseInput: $wikibaseInput) { + id + } +}""" + + +@pytest.mark.asyncio +@pytest.mark.mutation +@pytest.mark.dependency(name="add-wikibase") +async def test_add_wikibase_mutation(): + """Test Add Wikibase""" + + result = await test_schema.execute( + ADD_WIKIBASE_QUERY, + variable_values={ + "wikibaseInput": { + "wikibaseName": "Mock Wikibase", + "description": "Mock wikibase for testing this codebase", + "organization": "Wikibase Mockery International", + "country": "Germany", + "region": "Europe", + "category": "EXPERIMENTAL_AND_PROTOTYPE_PROJECTS", + "urls": { + "baseUrl": "example.com", + "actionApiUrl": "example.com/w/api.php", + "indexApiUrl": "example.com/w/index.php", + "sparqlEndpointUrl": "query.example.com/sparql", + "sparqlQueryUrl": "query.example.com", + "specialStatisticsUrl": "example.com/wiki/Special:Statistics", + "specialVersionUrl": "example.com/wiki/Special:Version", + }, + } + }, + ) + + assert result.errors is None + assert result.data is not None + assert_layered_property_value(result.data, ["addWikibase", "id"], "1") diff --git a/tests/test_query/test_wikibase_list_query.py b/tests/test_query/test_wikibase_list_query.py index 224276bc..02f95101 100644 --- a/tests/test_query/test_wikibase_list_query.py +++ b/tests/test_query/test_wikibase_list_query.py @@ -70,6 +70,7 @@ @pytest.mark.asyncio @pytest.mark.query +@pytest.mark.dependency(depends=["add-wikibase"], scope="session") async def test_wikibase_list_query(): """Test Wikibase List"""