Skip to content

Commit

Permalink
cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
jnussbaum committed Oct 22, 2024
1 parent 14d6c18 commit 19456b0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
3 changes: 2 additions & 1 deletion dsp_permissions_scripts/models/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from dsp_permissions_scripts.models.group import PROJECT_ADMIN
from dsp_permissions_scripts.models.group import PROJECT_MEMBER
from dsp_permissions_scripts.models.group import UNKNOWN_USER
from dsp_permissions_scripts.models.group import CustomGroup
from dsp_permissions_scripts.models.group import GroupType
from dsp_permissions_scripts.models.group import get_prefixed_iri_from_full_iri
from dsp_permissions_scripts.models.group import group_builder
Expand Down Expand Up @@ -151,6 +152,6 @@ def remove(

LIMC_OPEN = PermissionScope.create(
CR=[PROJECT_ADMIN],
D=[group_builder("limc:limc-editors")],
D=[CustomGroup(prefixed_iri="limc:limc-editors")],
V=[PROJECT_MEMBER, KNOWN_USER, UNKNOWN_USER],
)
3 changes: 1 addition & 2 deletions tests/test_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ def dsp_client_with_2_groups(new_custom_group_iri: str, old_custom_group_iri: st
{"id": old_custom_group_iri, "name": "Thing searcher", "project": {"shortname": "anything"}},
]
}
dsp_client = Mock(spec=DspClient)
dsp_client.get = Mock(return_value=get_response)
dsp_client = Mock(spec=DspClient, get=Mock(return_value=get_response))
return dsp_client


Expand Down
9 changes: 4 additions & 5 deletions tests/test_scope_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from dsp_permissions_scripts.models.group import PROJECT_MEMBER
from dsp_permissions_scripts.models.group import SYSTEM_ADMIN
from dsp_permissions_scripts.models.group import UNKNOWN_USER
from dsp_permissions_scripts.models.group import group_builder
from dsp_permissions_scripts.models.group import CustomGroup
from dsp_permissions_scripts.models.scope import PermissionScope
from dsp_permissions_scripts.utils.dsp_client import DspClient
from dsp_permissions_scripts.utils.scope_serialization import create_admin_route_object_from_scope
Expand All @@ -26,11 +26,10 @@

@pytest.fixture
def dsp_client() -> DspClient:
dsp_client = Mock(spec=DspClient)
get_response = {
"groups": [{"id": CUSTOM_GROUP_FULL_IRI, "name": CUSTOM_GROUP_NAME, "project": {"shortname": SHORTNAME}}]
}
dsp_client.get = Mock(return_value=get_response)
dsp_client = Mock(spec=DspClient, get=Mock(return_value=get_response))
return dsp_client


Expand Down Expand Up @@ -74,7 +73,7 @@ class TestScopeSerialization:
scopes = (
PermissionScope.create(
CR=[SYSTEM_ADMIN],
V=[group_builder(f"{SHORTNAME}:{CUSTOM_GROUP_NAME}")],
V=[CustomGroup(prefixed_iri=f"{SHORTNAME}:{CUSTOM_GROUP_NAME}")],
),
PermissionScope.create(
D=[PROJECT_ADMIN],
Expand Down Expand Up @@ -110,7 +109,7 @@ def test_create_string_from_scope(self) -> None:

def test_create_admin_route_object_from_scope(self) -> None:
get_response = {
"groups": [{"name": CUSTOM_GROUP_NAME, "id": CUSTOM_GROUP_FULL_IRI, "project": {"shortname": SHORTNAME}}]
"groups": [{"id": CUSTOM_GROUP_FULL_IRI, "name": CUSTOM_GROUP_NAME, "project": {"shortname": SHORTNAME}}]
}
dsp_client_mock = Mock(spec=DspClient, get=Mock(return_value=get_response))
for admin_route_object, scope, index in zip(self.admin_route_objects, self.scopes, range(len(self.scopes))):
Expand Down

0 comments on commit 19456b0

Please sign in to comment.