mirror of
https://github.com/cssgunc/compass.git
synced 2025-04-21 18:59:49 -04:00
Compare commits
1 Commits
a4940bfd1c
...
abb53cdb6e
Author | SHA1 | Date | |
---|---|---|---|
|
abb53cdb6e |
|
@ -155,6 +155,6 @@ class ResourceService:
|
||||||
entities = self._session.scalars(query).all()
|
entities = self._session.scalars(query).all()
|
||||||
|
|
||||||
if not entities:
|
if not entities:
|
||||||
return []
|
raise ResourceNotFoundException(f"No resource found with matching slug: {search_string}")
|
||||||
|
|
||||||
return [entity.to_model() for entity in entities]
|
return [entity.to_model() for entity in entities]
|
|
@ -106,14 +106,14 @@ def test_get_by_slug(resource_svc: ResourceService):
|
||||||
def test_get_by_slug_not_found(resource_svc: ResourceService):
|
def test_get_by_slug_not_found(resource_svc: ResourceService):
|
||||||
""" Test getting a resource that does not exist """
|
""" Test getting a resource that does not exist """
|
||||||
slug = "Not Found"
|
slug = "Not Found"
|
||||||
resources = resource_svc.get_by_slug(user_test_data.admin, slug)
|
with pytest.raises(ResourceNotFoundException):
|
||||||
assert len(resources) == 0
|
resources = resource_svc.get_by_slug(user_test_data.admin, slug)
|
||||||
assert resources == []
|
pytest.fail()
|
||||||
|
|
||||||
|
|
||||||
def test_get_by_slug_no_permission(resource_svc: ResourceService):
|
def test_get_by_slug_no_permission(resource_svc: ResourceService):
|
||||||
""" Test getting a resource the user does not have access to """
|
""" Test getting a resource the user does not have access to """
|
||||||
slug = "Resource 2"
|
slug = "Resource 2"
|
||||||
resources = resource_svc.get_by_slug(user_test_data.employee, slug)
|
with pytest.raises(ResourceNotFoundException):
|
||||||
assert len(resources) == 0
|
resources = resource_svc.get_by_slug(user_test_data.employee, slug)
|
||||||
assert resources == []
|
pytest.fail()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user