| | 105 | |
|---|
| | 106 | def test_navigability_at_interface(self): |
|---|
| | 107 | """Test association end navigability connected to an interface""" |
|---|
| | 108 | c1 = self.create(InterfaceItem, UML.Interface) |
|---|
| | 109 | c2 = self.create(InterfaceItem, UML.Interface) |
|---|
| | 110 | |
|---|
| | 111 | a = self.create(AssociationItem) |
|---|
| | 112 | |
|---|
| | 113 | adapter = component.queryMultiAdapter((c1, a), IConnect) |
|---|
| | 114 | assert adapter |
|---|
| | 115 | adapter.connect(a.head) |
|---|
| | 116 | assert a.head.connected_to |
|---|
| | 117 | |
|---|
| | 118 | adapter = component.queryMultiAdapter((c2, a), IConnect) |
|---|
| | 119 | adapter.connect(a.tail) |
|---|
| | 120 | assert a.tail.connected_to |
|---|
| | 121 | |
|---|
| | 122 | head = a._head_end |
|---|
| | 123 | |
|---|
| | 124 | head._set_navigability(True) |
|---|
| | 125 | assert head.subject.interface_ == c2.subject |
|---|
| | 126 | assert head.subject.owningAssociation is None |
|---|
| | 127 | |
|---|
| | 128 | head._set_navigability(False) |
|---|
| | 129 | assert head.subject.interface_ is None |
|---|
| | 130 | assert head.subject.owningAssociation == a.subject |
|---|
| | 131 | |
|---|
| | 132 | head._set_navigability(None) |
|---|
| | 133 | assert head.subject.interface_ is None |
|---|
| | 134 | assert head.subject.owningAssociation is None |
|---|
| | 135 | |
|---|