domain methods for deleting apps and environments

This commit is contained in:
dandds
2019-04-09 11:02:47 -04:00
parent 1c0c5dd9c5
commit b58aef2c6b
4 changed files with 58 additions and 1 deletions

View File

@@ -202,3 +202,17 @@ def test_get_excludes_deleted():
)
with pytest.raises(NotFoundError):
Environments.get(env.id)
def test_delete_environment(session):
env = EnvironmentFactory.create(application=ApplicationFactory.create())
assert not env.deleted
Environments.delete(env)
assert env.deleted
# did not flush
assert env in session.dirty
Environments.delete(env, commit=True)
assert env.deleted
# flushed the change
assert not session.dirty