def test_tenant_view_query_for_tenant_unpacks_singleton_result(patch_post): patch_post({"data": {"tenant": [1]}}) assert TenantView._query_for_tenant(where={}) == 1
def test_tenant_view_query_for_tenant_errors_on_multiple_tenants(patch_post): patch_post({"data": {"tenant": [1, 2]}}) with pytest.raises(ValueError, match=r"multiple \(2\) tenants"): TenantView._query_for_tenant(where={})