1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-23 15:19:41 +02:00

fix: Tools Shouldn't Be Unique Across Groups (#2505)

* fixed type/abc errors in tests

* fixed false positive multitentant tests

* fix tools not allowing unique slugs across groups

* fixed alembic refs

---------

Co-authored-by: Hayden <64056131+hay-kot@users.noreply.github.com>
This commit is contained in:
Michael Genson 2023-08-21 15:39:23 -05:00 committed by GitHub
parent 99e7717fec
commit c9cc7a93c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 62 additions and 29 deletions

View file

@ -19,12 +19,12 @@ all_cases = [
]
@pytest.mark.parametrize("test_case", all_cases)
@pytest.mark.parametrize("test_case_type", all_cases)
def test_multitenant_cases_get_all(
api_client: TestClient,
multitenants: MultiTenant,
database: AllRepositories,
test_case: type[ABCMultiTenantTestCase],
test_case_type: type[ABCMultiTenantTestCase],
):
"""
This test will run all the multitenant test cases and validate that they return only the data for their group.
@ -34,11 +34,11 @@ def test_multitenant_cases_get_all(
user1 = multitenants.user_one
user2 = multitenants.user_two
test_case = test_case(database, api_client)
test_case = test_case_type(database, api_client)
with test_case:
expected_ids = test_case.seed_action(user1.group_id)
expected_results = [
expected_results: list = [
(user1.token, expected_ids),
(user2.token, []),
]
@ -56,12 +56,12 @@ def test_multitenant_cases_get_all(
assert item["id"] in item_ids
@pytest.mark.parametrize("test_case", all_cases)
@pytest.mark.parametrize("test_case_type", all_cases)
def test_multitenant_cases_same_named_resources(
api_client: TestClient,
multitenants: MultiTenant,
database: AllRepositories,
test_case: type[ABCMultiTenantTestCase],
test_case_type: type[ABCMultiTenantTestCase],
):
"""
This test is used to ensure that the same resource can be created with the same values in different tenants.
@ -71,7 +71,7 @@ def test_multitenant_cases_same_named_resources(
user1 = multitenants.user_one
user2 = multitenants.user_two
test_case = test_case(database, api_client)
test_case = test_case_type(database, api_client)
with test_case:
expected_ids, expected_ids2 = test_case.seed_multi(user1.group_id, user2.group_id)