soft deletes available for applications and environments

- parent relation will not include applications or environments marked
  as deleted
- domain classes will exclude deleted objects from selections
- changed some test factories to use domain_word for resource names,
  because they were using person names and it bugged me
This commit is contained in:
dandds
2019-04-09 06:35:50 -04:00
parent c2a76c2504
commit 1c0c5dd9c5
11 changed files with 111 additions and 12 deletions

View File

@@ -1,6 +1,9 @@
import pytest
from atst.domain.applications import Applications
from tests.factories import UserFactory, PortfolioFactory
from atst.domain.portfolios import Portfolios
from atst.domain.exceptions import NotFoundError
from tests.factories import ApplicationFactory, UserFactory, PortfolioFactory
def test_create_application_with_multiple_environments():
@@ -53,3 +56,9 @@ def test_can_only_update_name_and_description():
assert application.description == "a new application"
assert len(application.environments) == 1
assert application.environments[0].name == env_name
def test_get_excludes_deleted():
app = ApplicationFactory.create(deleted=True)
with pytest.raises(NotFoundError):
Applications.get(app.id)