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:
parent
99e7717fec
commit
c9cc7a93c8
9 changed files with 62 additions and 29 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue