diff --git a/sandbox/metabase.db/metabase.db.mv.db b/sandbox/metabase.db/metabase.db.mv.db index c3703daf..3d6c6c5b 100644 Binary files a/sandbox/metabase.db/metabase.db.mv.db and b/sandbox/metabase.db/metabase.db.mv.db differ diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 00000000..31b8113a --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,19 @@ +import pytest + +from tests._mocks import TMP_PATH, MockDbtMetabase, MockMetabase + + +@pytest.fixture(name="core") +def fixture_core() -> MockDbtMetabase: + c = MockDbtMetabase() + c._ModelsMixin__SYNC_PERIOD = 1 # type: ignore + return c + + +@pytest.fixture(name="metabase") +def fixture_metabase() -> MockMetabase: + return MockMetabase(url="http://localhost") + + +def setup_module(): + TMP_PATH.mkdir(exist_ok=True) diff --git a/tests/fixtures/api/card/27.json b/tests/fixtures/api/card/27.json index 5ddcd060..f09b302f 100644 --- a/tests/fixtures/api/card/27.json +++ b/tests/fixtures/api/card/27.json @@ -2,7 +2,7 @@ "cache_invalidated_at": null, "description": "Orders and customers", "archived": false, - "view_count": 446, + "view_count": 458, "collection_position": null, "table_id": 10, "can_run_adhoc_query": true, @@ -561,7 +561,7 @@ "creator": { "email": "dbtmetabase@example.com", "first_name": "dbtmetabase", - "last_login": "2024-11-02T04:41:42.402168Z", + "last_login": "2024-12-20T12:30:47.814008Z", "is_qbnewb": false, "is_superuser": true, "id": 1, diff --git a/tests/fixtures/api/card/28.json b/tests/fixtures/api/card/28.json index e9c5ef9d..4ecd8c3a 100644 --- a/tests/fixtures/api/card/28.json +++ b/tests/fixtures/api/card/28.json @@ -2,7 +2,7 @@ "cache_invalidated_at": null, "description": null, "archived": false, - "view_count": 223, + "view_count": 229, "collection_position": null, "table_id": 10, "can_run_adhoc_query": true, @@ -549,7 +549,7 @@ "creator": { "email": "dbtmetabase@example.com", "first_name": "dbtmetabase", - "last_login": "2024-11-02T04:41:42.402168Z", + "last_login": "2024-12-20T12:30:47.814008Z", "is_qbnewb": false, "is_superuser": true, "id": 1, diff --git a/tests/fixtures/api/card/29.json b/tests/fixtures/api/card/29.json index 6da1b8fc..afd5f0f5 100644 --- a/tests/fixtures/api/card/29.json +++ b/tests/fixtures/api/card/29.json @@ -2,7 +2,7 @@ "cache_invalidated_at": null, "description": null, "archived": false, - "view_count": 222, + "view_count": 228, "collection_position": null, "table_id": null, "can_run_adhoc_query": true, @@ -41,7 +41,7 @@ "creator": { "email": "dbtmetabase@example.com", "first_name": "dbtmetabase", - "last_login": "2024-11-02T04:41:42.402168Z", + "last_login": "2024-12-20T12:30:47.814008Z", "is_qbnewb": false, "is_superuser": true, "id": 1, diff --git a/tests/fixtures/api/card/30.json b/tests/fixtures/api/card/30.json index f9e5d52e..9ccbd2a3 100644 --- a/tests/fixtures/api/card/30.json +++ b/tests/fixtures/api/card/30.json @@ -2,7 +2,7 @@ "cache_invalidated_at": null, "description": "Dummy 1", "archived": false, - "view_count": 43, + "view_count": 47, "collection_position": null, "table_id": null, "can_run_adhoc_query": true, @@ -41,7 +41,7 @@ "creator": { "email": "dbtmetabase@example.com", "first_name": "dbtmetabase", - "last_login": "2024-11-02T04:41:42.402168Z", + "last_login": "2024-12-20T12:30:47.814008Z", "is_qbnewb": false, "is_superuser": true, "id": 1, diff --git a/tests/fixtures/api/card/31.json b/tests/fixtures/api/card/31.json index 1ace592c..14cdd2f4 100644 --- a/tests/fixtures/api/card/31.json +++ b/tests/fixtures/api/card/31.json @@ -2,7 +2,7 @@ "cache_invalidated_at": null, "description": "Dummy 2", "archived": false, - "view_count": 43, + "view_count": 47, "collection_position": null, "table_id": null, "can_run_adhoc_query": true, @@ -41,7 +41,7 @@ "creator": { "email": "dbtmetabase@example.com", "first_name": "dbtmetabase", - "last_login": "2024-11-02T04:41:42.402168Z", + "last_login": "2024-12-20T12:30:47.814008Z", "is_qbnewb": false, "is_superuser": true, "id": 1, diff --git a/tests/fixtures/api/card/32.json b/tests/fixtures/api/card/32.json index 44da566b..163790d1 100644 --- a/tests/fixtures/api/card/32.json +++ b/tests/fixtures/api/card/32.json @@ -2,7 +2,7 @@ "cache_invalidated_at": null, "description": "CTE SQL", "archived": false, - "view_count": 34, + "view_count": 38, "collection_position": null, "table_id": null, "can_run_adhoc_query": true, @@ -276,7 +276,7 @@ "creator": { "email": "dbtmetabase@example.com", "first_name": "dbtmetabase", - "last_login": "2024-11-02T04:41:42.402168Z", + "last_login": "2024-12-20T12:30:47.814008Z", "is_qbnewb": false, "is_superuser": true, "id": 1, diff --git a/tests/fixtures/api/card/33.json b/tests/fixtures/api/card/33.json index fcdf7663..3c7e5216 100644 --- a/tests/fixtures/api/card/33.json +++ b/tests/fixtures/api/card/33.json @@ -2,7 +2,7 @@ "cache_invalidated_at": null, "description": null, "archived": false, - "view_count": 15, + "view_count": 19, "collection_position": null, "table_id": 18, "can_run_adhoc_query": true, @@ -146,7 +146,7 @@ "creator": { "email": "dbtmetabase@example.com", "first_name": "dbtmetabase", - "last_login": "2024-11-02T04:41:42.402168Z", + "last_login": "2024-12-20T12:30:47.814008Z", "is_qbnewb": false, "is_superuser": true, "id": 1, @@ -158,17 +158,17 @@ "can_write": true, "database_id": 2, "enable_embedding": false, - "collection_id": null, + "collection_id": 3, "query_type": "query", "name": "Transactions", - "last_query_start": "2024-10-12T03:53:32.250619Z", + "last_query_start": "2024-12-20T12:30:05.862314Z", "dashboard_count": 0, - "last_used_at": "2024-10-12T03:43:09.869884Z", + "last_used_at": "2024-12-20T12:30:05.932096Z", "type": "question", - "average_query_time": 114.5, + "average_query_time": 134.33333333333334, "creator_id": 1, "moderation_reviews": [], - "updated_at": "2024-10-12T01:52:30.606845Z", + "updated_at": "2024-12-20T12:30:11.735631Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, @@ -189,18 +189,26 @@ "email": "dbtmetabase@example.com", "first_name": "dbtmetabase", "last_name": null, - "timestamp": "2024-10-11T23:46:29.299411Z" + "timestamp": "2024-12-20T12:30:11.782155Z" }, "visualization_settings": { "table.cell_column": "payment_id" }, "collection": { - "metabase.models.collection.root/is-root?": true, "authority_level": null, - "name": "Our analytics", + "description": null, + "archived": false, + "slug": "%D0%BA%D0%BE%D0%BB%D0%BB%D0%B5%D0%BA%D1%86%D0%B8%D1%8F", + "name": "\u041a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f", + "personal_owner_id": null, + "type": null, + "is_sample": false, + "id": 3, + "entity_id": "4Zdu-bk8RhwuFiEiRXuOH", + "location": "/", + "namespace": null, "is_personal": false, - "id": "root", - "can_write": true + "created_at": "2024-12-20T12:29:39.063908Z" }, "metabase_version": "v0.50.5 (48f6978)", "parameters": [], diff --git a/tests/fixtures/api/collection.json b/tests/fixtures/api/collection.json index addf935c..ad1e4db6 100644 --- a/tests/fixtures/api/collection.json +++ b/tests/fixtures/api/collection.json @@ -25,5 +25,22 @@ "namespace": null, "is_personal": true, "created_at": "2024-06-19T11:49:38.03895Z" + }, + { + "authority_level": null, + "description": null, + "archived": false, + "slug": "%D0%BA%D0%BE%D0%BB%D0%BB%D0%B5%D0%BA%D1%86%D0%B8%D1%8F", + "can_write": true, + "name": "\u041a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f", + "personal_owner_id": null, + "type": null, + "is_sample": false, + "id": 3, + "entity_id": "4Zdu-bk8RhwuFiEiRXuOH", + "location": "/", + "namespace": null, + "is_personal": false, + "created_at": "2024-12-20T12:29:39.063908Z" } ] \ No newline at end of file diff --git a/tests/fixtures/api/collection/3/items.json b/tests/fixtures/api/collection/3/items.json new file mode 100644 index 00000000..ceff80f4 --- /dev/null +++ b/tests/fixtures/api/collection/3/items.json @@ -0,0 +1,25 @@ +[ + { + "description": null, + "collection_position": null, + "can_write": true, + "database_id": 2, + "collection_id": 3, + "name": "Transactions", + "fully_parameterized": true, + "moderated_status": null, + "id": 33, + "display": "table", + "entity_id": "ZRX529pNYbPiCLCi8HvZ6", + "collection_preview": true, + "last-edit-info": { + "id": 1, + "last_name": null, + "first_name": "dbtmetabase", + "email": "dbtmetabase@example.com", + "timestamp": "2024-12-20T12:30:11.782155Z" + }, + "location": null, + "model": "card" + } +] \ No newline at end of file diff --git a/tests/fixtures/api/collection/root/items.json b/tests/fixtures/api/collection/root/items.json index 5cbf09b7..cfd11a59 100644 --- a/tests/fixtures/api/collection/root/items.json +++ b/tests/fixtures/api/collection/root/items.json @@ -155,28 +155,5 @@ }, "location": null, "model": "dashboard" - }, - { - "description": null, - "collection_position": null, - "can_write": true, - "database_id": 2, - "collection_id": null, - "name": "Transactions", - "fully_parameterized": true, - "moderated_status": null, - "id": 33, - "display": "table", - "entity_id": "ZRX529pNYbPiCLCi8HvZ6", - "collection_preview": true, - "last-edit-info": { - "id": 1, - "last_name": null, - "first_name": "dbtmetabase", - "email": "dbtmetabase@example.com", - "timestamp": "2024-10-11T23:46:29.299411Z" - }, - "location": null, - "model": "card" } ] \ No newline at end of file diff --git a/tests/fixtures/api/dashboard/2.json b/tests/fixtures/api/dashboard/2.json index faa2f8e9..0b89154e 100644 --- a/tests/fixtures/api/dashboard/2.json +++ b/tests/fixtures/api/dashboard/2.json @@ -1,7 +1,7 @@ { "description": "Dashboard is a dashboard is a dashboard", "archived": false, - "view_count": 118, + "view_count": 121, "collection_position": null, "dashcards": [ { @@ -14,7 +14,7 @@ "cache_invalidated_at": null, "description": "Orders and customers", "archived": false, - "view_count": 446, + "view_count": 458, "collection_position": null, "table_id": 10, "result_metadata": [ @@ -653,7 +653,7 @@ "cache_invalidated_at": null, "description": null, "archived": false, - "view_count": 223, + "view_count": 229, "collection_position": null, "table_id": 10, "result_metadata": [ @@ -1266,7 +1266,7 @@ "cache_invalidated_at": null, "description": null, "archived": false, - "view_count": 222, + "view_count": 228, "collection_position": null, "table_id": null, "result_metadata": [ diff --git a/tests/fixtures/api/database.json b/tests/fixtures/api/database.json index fd87b826..77cce777 100644 --- a/tests/fixtures/api/database.json +++ b/tests/fixtures/api/database.json @@ -55,7 +55,7 @@ "caveats": null, "creator_id": 1, "is_full_sync": true, - "updated_at": "2024-11-02T04:30:07.348325Z", + "updated_at": "2024-12-20T12:28:30.976262Z", "native_permissions": "write", "cache_ttl": null, "details": { diff --git a/tests/fixtures/api/database/2/metadata.json b/tests/fixtures/api/database/2/metadata.json index f475e7c8..785dc66f 100644 --- a/tests/fixtures/api/database/2/metadata.json +++ b/tests/fixtures/api/database/2/metadata.json @@ -412,7 +412,7 @@ ], "caveats": null, "segments": [], - "updated_at": "2024-11-02T04:33:23.804648Z", + "updated_at": "2024-12-20T12:28:32.299132Z", "active": true, "id": 12, "db_id": 2, @@ -941,7 +941,7 @@ ], "caveats": "Some facts are derived from payments", "segments": [], - "updated_at": "2024-11-02T04:33:23.804648Z", + "updated_at": "2024-12-20T12:28:32.299132Z", "active": true, "id": 10, "db_id": 2, @@ -1103,7 +1103,7 @@ ], "caveats": null, "segments": [], - "updated_at": "2024-11-02T04:33:23.804648Z", + "updated_at": "2024-12-20T12:28:32.299132Z", "active": true, "id": 13, "db_id": 2, @@ -1313,7 +1313,7 @@ ], "caveats": null, "segments": [], - "updated_at": "2024-11-02T04:33:23.804648Z", + "updated_at": "2024-12-20T12:28:32.299132Z", "active": true, "id": 14, "db_id": 2, @@ -1527,7 +1527,7 @@ ], "caveats": null, "segments": [], - "updated_at": "2024-11-02T04:33:23.804648Z", + "updated_at": "2024-12-20T12:28:32.299132Z", "active": true, "id": 11, "db_id": 2, @@ -1639,7 +1639,7 @@ ], "caveats": null, "segments": [], - "updated_at": "2024-11-02T04:33:23.804648Z", + "updated_at": "2024-12-20T12:28:32.299132Z", "active": true, "id": 19, "db_id": 2, @@ -2126,7 +2126,7 @@ ], "caveats": null, "segments": [], - "updated_at": "2024-11-02T04:33:23.804648Z", + "updated_at": "2024-12-20T12:28:32.299132Z", "active": true, "id": 15, "db_id": 2, @@ -2355,7 +2355,7 @@ ], "caveats": null, "segments": [], - "updated_at": "2024-11-02T04:33:23.804648Z", + "updated_at": "2024-12-20T12:28:32.299132Z", "active": true, "id": 9, "db_id": 2, @@ -2633,7 +2633,7 @@ ], "caveats": null, "segments": [], - "updated_at": "2024-11-02T04:33:23.804648Z", + "updated_at": "2024-12-20T12:28:32.299132Z", "active": true, "id": 18, "db_id": 2, @@ -2650,7 +2650,7 @@ ], "creator_id": 1, "is_full_sync": true, - "updated_at": "2024-11-02T04:30:07.348325Z", + "updated_at": "2024-12-20T12:28:30.976262Z", "cache_ttl": null, "details": { "ssl": false, diff --git a/tests/fixtures/api/table.json b/tests/fixtures/api/table.json index 72894d01..4f4171be 100644 --- a/tests/fixtures/api/table.json +++ b/tests/fixtures/api/table.json @@ -61,7 +61,7 @@ "caveats": null, "creator_id": 1, "is_full_sync": true, - "updated_at": "2024-11-02T04:30:07.348325Z", + "updated_at": "2024-12-20T12:28:30.976262Z", "cache_ttl": null, "details": { "ssl": false, @@ -96,7 +96,7 @@ "show_in_getting_started": false, "name": "customers", "caveats": null, - "updated_at": "2024-11-02T04:33:23.804648Z", + "updated_at": "2024-12-20T12:28:32.299132Z", "active": true, "id": 12, "db_id": 2, @@ -171,7 +171,7 @@ "caveats": null, "creator_id": 1, "is_full_sync": true, - "updated_at": "2024-11-02T04:30:07.348325Z", + "updated_at": "2024-12-20T12:28:30.976262Z", "cache_ttl": null, "details": { "ssl": false, @@ -206,7 +206,7 @@ "show_in_getting_started": false, "name": "orders", "caveats": "Some facts are derived from payments", - "updated_at": "2024-11-02T04:33:23.804648Z", + "updated_at": "2024-12-20T12:28:32.299132Z", "active": true, "id": 10, "db_id": 2, @@ -281,7 +281,7 @@ "caveats": null, "creator_id": 1, "is_full_sync": true, - "updated_at": "2024-11-02T04:30:07.348325Z", + "updated_at": "2024-12-20T12:28:30.976262Z", "cache_ttl": null, "details": { "ssl": false, @@ -316,7 +316,7 @@ "show_in_getting_started": false, "name": "raw_customers", "caveats": null, - "updated_at": "2024-11-02T04:33:23.804648Z", + "updated_at": "2024-12-20T12:28:32.299132Z", "active": true, "id": 13, "db_id": 2, @@ -391,7 +391,7 @@ "caveats": null, "creator_id": 1, "is_full_sync": true, - "updated_at": "2024-11-02T04:30:07.348325Z", + "updated_at": "2024-12-20T12:28:30.976262Z", "cache_ttl": null, "details": { "ssl": false, @@ -426,7 +426,7 @@ "show_in_getting_started": false, "name": "raw_orders", "caveats": null, - "updated_at": "2024-11-02T04:33:23.804648Z", + "updated_at": "2024-12-20T12:28:32.299132Z", "active": true, "id": 14, "db_id": 2, @@ -501,7 +501,7 @@ "caveats": null, "creator_id": 1, "is_full_sync": true, - "updated_at": "2024-11-02T04:30:07.348325Z", + "updated_at": "2024-12-20T12:28:30.976262Z", "cache_ttl": null, "details": { "ssl": false, @@ -536,7 +536,7 @@ "show_in_getting_started": false, "name": "raw_payments", "caveats": null, - "updated_at": "2024-11-02T04:33:23.804648Z", + "updated_at": "2024-12-20T12:28:32.299132Z", "active": true, "id": 11, "db_id": 2, @@ -611,7 +611,7 @@ "caveats": null, "creator_id": 1, "is_full_sync": true, - "updated_at": "2024-11-02T04:30:07.348325Z", + "updated_at": "2024-12-20T12:28:30.976262Z", "cache_ttl": null, "details": { "ssl": false, @@ -646,7 +646,7 @@ "show_in_getting_started": false, "name": "skus", "caveats": null, - "updated_at": "2024-11-02T04:33:23.804648Z", + "updated_at": "2024-12-20T12:28:32.299132Z", "active": true, "id": 19, "db_id": 2, @@ -721,7 +721,7 @@ "caveats": null, "creator_id": 1, "is_full_sync": true, - "updated_at": "2024-11-02T04:30:07.348325Z", + "updated_at": "2024-12-20T12:28:30.976262Z", "cache_ttl": null, "details": { "ssl": false, @@ -831,7 +831,7 @@ "caveats": null, "creator_id": 1, "is_full_sync": true, - "updated_at": "2024-11-02T04:30:07.348325Z", + "updated_at": "2024-12-20T12:28:30.976262Z", "cache_ttl": null, "details": { "ssl": false, @@ -866,7 +866,7 @@ "show_in_getting_started": false, "name": "stg_orders", "caveats": null, - "updated_at": "2024-11-02T04:33:23.804648Z", + "updated_at": "2024-12-20T12:28:32.299132Z", "active": true, "id": 15, "db_id": 2, @@ -941,7 +941,7 @@ "caveats": null, "creator_id": 1, "is_full_sync": true, - "updated_at": "2024-11-02T04:30:07.348325Z", + "updated_at": "2024-12-20T12:28:30.976262Z", "cache_ttl": null, "details": { "ssl": false, @@ -976,7 +976,7 @@ "show_in_getting_started": false, "name": "stg_payments", "caveats": null, - "updated_at": "2024-11-02T04:33:23.804648Z", + "updated_at": "2024-12-20T12:28:32.299132Z", "active": true, "id": 9, "db_id": 2, @@ -1051,7 +1051,7 @@ "caveats": null, "creator_id": 1, "is_full_sync": true, - "updated_at": "2024-11-02T04:30:07.348325Z", + "updated_at": "2024-12-20T12:28:30.976262Z", "cache_ttl": null, "details": { "ssl": false, @@ -1086,7 +1086,7 @@ "show_in_getting_started": false, "name": "transactions", "caveats": null, - "updated_at": "2024-11-02T04:33:23.804648Z", + "updated_at": "2024-12-20T12:28:32.299132Z", "active": true, "id": 18, "db_id": 2, diff --git a/tests/fixtures/api/user/1.json b/tests/fixtures/api/user/1.json index 50f7f8df..34137870 100644 --- a/tests/fixtures/api/user/1.json +++ b/tests/fixtures/api/user/1.json @@ -2,7 +2,7 @@ "email": "dbtmetabase@example.com", "first_name": "dbtmetabase", "locale": null, - "last_login": "2024-11-02T04:41:42.402168Z", + "last_login": "2024-12-20T12:30:47.814008Z", "is_active": true, "user_group_memberships": [ { @@ -13,7 +13,7 @@ } ], "is_qbnewb": false, - "updated_at": "2024-11-02T04:41:42.402168Z", + "updated_at": "2024-12-20T12:30:47.814008Z", "is_superuser": true, "login_attributes": null, "id": 1, diff --git a/tests/fixtures/exposure/collection/our_analytics.yml b/tests/fixtures/exposure/collection/our_analytics.yml index 11d1926d..22b329b5 100644 --- a/tests/fixtures/exposure/collection/our_analytics.yml +++ b/tests/fixtures/exposure/collection/our_analytics.yml @@ -184,29 +184,3 @@ exposures: - ref('orders') - ref('stg_orders') - ref('stg_payments') - - name: transactions - label: Transactions - description: '### Visualization: Table - - - No description provided in Metabase - - - #### Metadata - - - Metabase ID: __33__ - - - Created On: __2024-10-11T23:46:29.272117Z__' - type: analysis - url: http://localhost:3000/card/33 - maturity: medium - owner: - name: dbtmetabase - email: dbtmetabase@example.com - depends_on: - - ref('payments') - meta: - average_query_time: '0:00.115' - last_used_at: '2024-10-12T03:43:09.869884Z' diff --git "a/tests/fixtures/exposure/collection/\320\272\320\276\320\273\320\273\320\265\320\272\321\206\320\270\321\217.yml" "b/tests/fixtures/exposure/collection/\320\272\320\276\320\273\320\273\320\265\320\272\321\206\320\270\321\217.yml" new file mode 100644 index 00000000..e8411f1e --- /dev/null +++ "b/tests/fixtures/exposure/collection/\320\272\320\276\320\273\320\273\320\265\320\272\321\206\320\270\321\217.yml" @@ -0,0 +1,28 @@ +version: 2 +exposures: + - name: transactions + label: Transactions + description: '### Visualization: Table + + + No description provided in Metabase + + + #### Metadata + + + Metabase ID: __33__ + + + Created On: __2024-10-11T23:46:29.272117Z__' + type: analysis + url: http://localhost:3000/card/33 + maturity: medium + owner: + name: dbtmetabase + email: dbtmetabase@example.com + depends_on: + - ref('payments') + meta: + average_query_time: '0:00.134' + last_used_at: '2024-12-20T12:30:05.932096Z' diff --git a/tests/fixtures/exposure/default/exposures.yml b/tests/fixtures/exposure/default/exposures.yml index 2dca3392..58bcc6b1 100644 --- a/tests/fixtures/exposure/default/exposures.yml +++ b/tests/fixtures/exposure/default/exposures.yml @@ -222,7 +222,7 @@ exposures: depends_on: - ref('payments') meta: - average_query_time: '0:00.115' - last_used_at: '2024-10-12T03:43:09.869884Z' + average_query_time: '0:00.134' + last_used_at: '2024-12-20T12:30:05.932096Z' tags: - metabase diff --git a/tests/fixtures/exposure/type/card/33.yml b/tests/fixtures/exposure/type/card/33.yml index 2c037a86..e8411f1e 100644 --- a/tests/fixtures/exposure/type/card/33.yml +++ b/tests/fixtures/exposure/type/card/33.yml @@ -24,5 +24,5 @@ exposures: depends_on: - ref('payments') meta: - average_query_time: '0:00.115' - last_used_at: '2024-10-12T03:43:09.869884Z' + average_query_time: '0:00.134' + last_used_at: '2024-12-20T12:30:05.932096Z' diff --git a/tests/test_exposures.py b/tests/test_exposures.py index 6cd941f4..6a6bed65 100644 --- a/tests/test_exposures.py +++ b/tests/test_exposures.py @@ -7,15 +7,6 @@ from tests._mocks import FIXTURES_PATH, TMP_PATH, MockDbtMetabase -def setup_module(): - TMP_PATH.mkdir(exist_ok=True) - - -@pytest.fixture(name="core") -def fixture_core() -> MockDbtMetabase: - return MockDbtMetabase() - - def _assert_exposures(expected_path: Path, actual_path: Path): with open(expected_path, encoding="utf-8") as f: expected = yaml.safe_load(f) diff --git a/tests/test_metabase.py b/tests/test_metabase.py index 4b7c8411..a81329e5 100644 --- a/tests/test_metabase.py +++ b/tests/test_metabase.py @@ -1,13 +1,6 @@ -import pytest - from tests._mocks import MockMetabase -@pytest.fixture(name="metabase") -def fixture_metabase() -> MockMetabase: - return MockMetabase(url="http://localhost") - - def test_metabase_find_database(metabase: MockMetabase): db = metabase.find_database(name="dbtmetabase") assert db @@ -17,10 +10,10 @@ def test_metabase_find_database(metabase: MockMetabase): def test_metabase_get_collections(metabase: MockMetabase): excluded = metabase.get_collections(exclude_personal=True) - assert len(excluded) == 1 + assert len(excluded) == 2 included = metabase.get_collections(exclude_personal=False) - assert len(included) == 2 + assert len(included) == 3 def test_metabase_get_collection_items(metabase: MockMetabase): diff --git a/tests/test_models.py b/tests/test_models.py index 48496573..88cf954c 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -1,18 +1,9 @@ from typing import MutableSequence, cast -import pytest - from dbtmetabase.manifest import Column from tests._mocks import MockDbtMetabase -@pytest.fixture(name="core") -def fixture_core() -> MockDbtMetabase: - c = MockDbtMetabase() - c._ModelsMixin__SYNC_PERIOD = 1 # type: ignore - return c - - def test_export(core: MockDbtMetabase): core.export_models( metabase_database="dbtmetabase",