diff --git a/tests/tests_unit/test_data_classes/test_capabilities.py b/tests/tests_unit/test_data_classes/test_capabilities.py index 3839ff9d25..13d53b0a1c 100644 --- a/tests/tests_unit/test_data_classes/test_capabilities.py +++ b/tests/tests_unit/test_data_classes/test_capabilities.py @@ -249,13 +249,13 @@ def test_create_capability_forget_initializing_scope(self): assert grp1.dump() == grp2.dump() def test_create_capability_forget_initializing_scope__not_supported(self): - with pytest.raises(ValueError, match="^DataSetsAcl got an unknown scope"): + with pytest.raises(ValueError, match="DataSetsAcl got an unknown scope"): DataSetsAcl(actions=[DataSetsAcl.Action.Read], scope=CurrentUserScope) - with pytest.raises(ValueError, match="^DataSetsAcl got an unknown scope"): + with pytest.raises(ValueError, match="DataSetsAcl got an unknown scope"): DataSetsAcl(actions=[DataSetsAcl.Action.Read], scope=GroupsAcl.Scope.CurrentUser) - with pytest.raises(ValueError, match="^ExperimentsAcl got an unknown scope"): + with pytest.raises(ValueError, match="ExperimentsAcl got an unknown scope"): ExperimentsAcl(actions=[ExperimentsAcl.Action.Use], scope=AllScope) @@ -412,8 +412,8 @@ def test_idscopes_camel_case(): with pytest.raises(ValueError) as err: Capability.load(dct) assert err.value.args[0].startswith( - "DataSetsAcl got an unknown scope: IDScopeLowerCase(ids=[2495]), expected an instance of one of: " - "[DataSetsAcl.Scope.All, DataSetsAcl.Scope.ID]" + "Could not instantiate DataSetsAcl due to: DataSetsAcl got an unknown scope: IDScopeLowerCase(ids=[2495]), " + "expected an instance of one of: [DataSetsAcl.Scope.All, DataSetsAcl.Scope.ID]" ) diff --git a/tests/tests_unit/test_data_classes/test_groups.py b/tests/tests_unit/test_data_classes/test_groups.py index 8ad5ef2518..48925fac99 100644 --- a/tests/tests_unit/test_data_classes/test_groups.py +++ b/tests/tests_unit/test_data_classes/test_groups.py @@ -5,6 +5,7 @@ import pytest from cognite.client.data_classes import Group, GroupList +from cognite.client.data_classes.capabilities import DataModelInstancesAcl def raw_groups(): @@ -39,6 +40,10 @@ def raw_groups(): class TestGroups: + def test_group_init__accept_single_acl(self) -> None: + acl = DataModelInstancesAcl([DataModelInstancesAcl.Action.Write], DataModelInstancesAcl.Scope.All()) + assert Group(name="a", capabilities=acl) == Group(name="a", capabilities=[acl]) + @pytest.mark.parametrize("raw", list(raw_groups())) def test_load_dump_unknown_group(self, raw: dict[str, Any]) -> None: group = Group.load(raw)