Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
ARIA-132-fixed-support-for-cascading-deletion
  • Loading branch information
mxmrlv committed Apr 4, 2017
1 parent 369323b commit e7ffc7353dd2f23fdffde22bdb2ffac20542d601
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
@@ -193,7 +193,8 @@ def one_to_many(model_class,
child_table,
back_populates=back_populates,
other_fk=child_fk,
dict_key=dict_key)
dict_key=dict_key,
relationship_kwargs=dict(cascade='all'))


def many_to_one(model_class,
@@ -108,6 +108,19 @@ def test_application_storage_factory():
tests_storage.release_sqlite_storage(storage)


def test_cascade_deletion(context):
service = context.model.service.list()[0]

assert len(context.model.service_template.list()) == 1
assert len(service.nodes) == len(context.model.node.list()) == 2

context.model.service.delete(service)

assert len(context.model.service_template.list()) == 1
assert len(context.model.service.list()) == 0
assert len(context.model.node.list()) == 0


@pytest.fixture
def context(tmpdir):
result = mock.context.simple(str(tmpdir))

0 comments on commit e7ffc73

Please sign in to comment.