You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ariatosca.apache.org by em...@apache.org on 2017/04/05 15:58:24 UTC
[4/6] incubator-ariatosca git commit:
ARIA-132-fixed-support-for-cascading-deletion
ARIA-132-fixed-support-for-cascading-deletion
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/e7ffc735
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/e7ffc735
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/e7ffc735
Branch: refs/heads/ARIA-134-populate-workflows
Commit: e7ffc7353dd2f23fdffde22bdb2ffac20542d601
Parents: 369323b
Author: max-orlov <ma...@gigaspaces.com>
Authored: Tue Apr 4 12:22:12 2017 +0300
Committer: max-orlov <ma...@gigaspaces.com>
Committed: Tue Apr 4 12:22:12 2017 +0300
----------------------------------------------------------------------
aria/modeling/relationship.py | 3 ++-
tests/storage/test_model_storage.py | 13 +++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/e7ffc735/aria/modeling/relationship.py
----------------------------------------------------------------------
diff --git a/aria/modeling/relationship.py b/aria/modeling/relationship.py
index ac1de28..e6830b8 100644
--- a/aria/modeling/relationship.py
+++ b/aria/modeling/relationship.py
@@ -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,
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/e7ffc735/tests/storage/test_model_storage.py
----------------------------------------------------------------------
diff --git a/tests/storage/test_model_storage.py b/tests/storage/test_model_storage.py
index fa57e6f..e4f3eba 100644
--- a/tests/storage/test_model_storage.py
+++ b/tests/storage/test_model_storage.py
@@ -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))