|
@@ -624,6 +624,17 @@ class TestModelverse(unittest.TestCase):
|
|
|
assert all_instances("users/user/test/a", "Class") == set(["A", "B", "C"])
|
|
|
assert all_instances("users/user/test/a", "Association") == set(["C"])
|
|
|
|
|
|
+ # Test M1 level
|
|
|
+ model_add("users/user/test/b", "users/user/test/a", """
|
|
|
+ A a {}
|
|
|
+ B b {}
|
|
|
+ C c(a, b) {}
|
|
|
+ A d {}
|
|
|
+ """)
|
|
|
+ assert all_instances("users/user/test/b", "A") == set(["a", "b", "d"])
|
|
|
+ assert all_instances("users/user/test/b", "B") == set(["b"])
|
|
|
+ assert all_instances("users/user/test/b", "C") == set(["c"])
|
|
|
+
|
|
|
# Test non-existing type
|
|
|
try:
|
|
|
all_instances("users/user/test/a", "non-existing")
|
|
@@ -633,22 +644,11 @@ class TestModelverse(unittest.TestCase):
|
|
|
|
|
|
# Test non-existing model
|
|
|
try:
|
|
|
- all_instances("users/user/test/b", "Class")
|
|
|
+ all_instances("users/user/test/c", "Class")
|
|
|
self.fail()
|
|
|
except UnknownModel:
|
|
|
pass
|
|
|
|
|
|
- # Test M1 level
|
|
|
- model_add("users/user/test/b", "users/user/test/a", """
|
|
|
- A a {}
|
|
|
- B b {}
|
|
|
- C c(a, b) {}
|
|
|
- A d {}
|
|
|
- """)
|
|
|
- assert all_instances("users/user/test/b", "A") == set(["a", "b", "d"])
|
|
|
- assert all_instances("users/user/test/b", "B") == set(["b"])
|
|
|
- assert all_instances("users/user/test/b", "C") == set(["c"])
|
|
|
-
|
|
|
# No read permission
|
|
|
try:
|
|
|
all_instances("administration/core", "Class")
|
|
@@ -2000,6 +2000,13 @@ class TestModelverse(unittest.TestCase):
|
|
|
# No write permissions, but can query
|
|
|
assert read_association_source("formalisms/SimpleClassDiagrams", "Association") == "Class"
|
|
|
|
|
|
+ # Not an association
|
|
|
+ try:
|
|
|
+ read_association_source("users/user/test/a", "A")
|
|
|
+ self.fail()
|
|
|
+ except NotAnAssociation:
|
|
|
+ pass
|
|
|
+
|
|
|
def test_op_read_association_destination(self):
|
|
|
model_add("users/user/test/a", "formalisms/SimpleClassDiagrams", """
|
|
|
SimpleAttribute String {}
|
|
@@ -2051,6 +2058,13 @@ class TestModelverse(unittest.TestCase):
|
|
|
# No write permissions, but can query
|
|
|
assert read_association_destination("formalisms/SimpleClassDiagrams", "Association") == "Class"
|
|
|
|
|
|
+ # Not an association
|
|
|
+ try:
|
|
|
+ read_association_source("users/user/test/a", "A")
|
|
|
+ self.fail()
|
|
|
+ except NotAnAssociation:
|
|
|
+ pass
|
|
|
+
|
|
|
def test_op_connections_between(self):
|
|
|
model_add("users/user/test/a", "formalisms/SimpleClassDiagrams", """
|
|
|
SimpleAttribute String {}
|