Added BaseDomainClass with a get
method.
The BaseDomainClass.get can accept any number of keyword arguments and will add a filter to the query for each kwarg. This will allow the caller to scope the query as needed with kwargs.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import pytest
|
||||
from uuid import uuid4
|
||||
|
||||
from atst.domain.applications import Applications
|
||||
from atst.domain.exceptions import NotFoundError
|
||||
@@ -70,6 +71,16 @@ def test_get_excludes_deleted():
|
||||
Applications.get(app.id)
|
||||
|
||||
|
||||
def test_get_application():
|
||||
app = ApplicationFactory.create()
|
||||
assert Applications.get(app.id) == app
|
||||
assert Applications.get(app.id, portfolio_id=app.portfolio_id) == app
|
||||
with pytest.raises(NotFoundError):
|
||||
# make the uuid a string like you'd get from a route
|
||||
rando_id = str(uuid4())
|
||||
Applications.get(app.id, portfolio_id=rando_id)
|
||||
|
||||
|
||||
def test_delete_application(session):
|
||||
app = ApplicationFactory.create()
|
||||
app_role = ApplicationRoleFactory.create(user=UserFactory.create(), application=app)
|
||||
|
Reference in New Issue
Block a user