| | 74 | def test_navigability_at_class(self): |
|---|
| | 75 | """Test association end navigability connected to a class""" |
|---|
| | 76 | c1 = self.create(ClassItem, UML.Class) |
|---|
| | 77 | c2 = self.create(ClassItem, UML.Class) |
|---|
| | 78 | |
|---|
| | 79 | a = self.create(AssociationItem) |
|---|
| | 80 | |
|---|
| | 81 | adapter = component.queryMultiAdapter((c1, a), IConnect) |
|---|
| | 82 | assert adapter |
|---|
| | 83 | adapter.connect(a.head) |
|---|
| | 84 | assert a.head.connected_to |
|---|
| | 85 | |
|---|
| | 86 | adapter = component.queryMultiAdapter((c2, a), IConnect) |
|---|
| | 87 | adapter.connect(a.tail) |
|---|
| | 88 | assert a.tail.connected_to |
|---|
| | 89 | |
|---|
| | 90 | head = a._head_end |
|---|
| | 91 | |
|---|
| | 92 | head._set_navigability(True) |
|---|
| | 93 | assert head.subject.class_ == c2.subject |
|---|
| | 94 | assert head.subject.owningAssociation is None |
|---|
| | 95 | |
|---|
| | 96 | head._set_navigability(False) |
|---|
| | 97 | assert head.subject.class_ is None |
|---|
| | 98 | assert head.subject.owningAssociation == a.subject |
|---|
| | 99 | |
|---|
| | 100 | head._set_navigability(None) |
|---|
| | 101 | assert head.subject.class_ is None |
|---|
| | 102 | assert head.subject.owningAssociation is None |
|---|
| | 103 | |
|---|