|
13 | 13 | # limitations under the License. |
14 | 14 | # |
15 | 15 |
|
| 16 | +import pytest |
| 17 | + |
| 18 | +from distutils.version import LooseVersion |
16 | 19 | from requests.exceptions import HTTPError |
17 | 20 |
|
18 | 21 |
|
@@ -70,8 +73,13 @@ def test_create_base(self, request, mgmt_root): |
70 | 73 |
|
71 | 74 | ntp1 = ntp.restrict.create(name='r1', partition='Common') |
72 | 75 |
|
73 | | - assert ntp1.name == 'r1' |
74 | | - assert ntp1.partition == 'Common' |
| 76 | + if pytest.config.getoption('--release') < LooseVersion('11.6.1'): |
| 77 | + assert ntp1.name == 'r1' |
| 78 | + assert ntp1.partition == 'Common' |
| 79 | + else: |
| 80 | + assert ntp1.name == '/Common/r1' |
| 81 | + # The 'partition' attribute was removed in 11.6.1? |
| 82 | + |
75 | 83 | assert ntp1.defaultEntry == "disabled" |
76 | 84 | assert ntp1.ignore == "disabled" |
77 | 85 | assert ntp1.kod == "disabled" |
@@ -114,8 +122,18 @@ def test_create_full(self, request, mgmt_root): |
114 | 122 | ) |
115 | 123 | ntp1 = ntp.restrict.create(name='r2', partition='Common', **params) |
116 | 124 |
|
117 | | - assert ntp1.name == 'r2' |
118 | | - assert ntp1.partition == 'Common' |
| 125 | + # In 11.6.1 and later they started prepending the partition name |
| 126 | + # to the name attribute here. So we handle this case for our tests. |
| 127 | + # |
| 128 | + # According to Narendra, they should always have behaved this way |
| 129 | + # so this must have been a bugfix |
| 130 | + if pytest.config.getoption('--release') < LooseVersion('11.6.1'): |
| 131 | + assert ntp1.name == 'r2' |
| 132 | + assert ntp1.partition == 'Common' |
| 133 | + else: |
| 134 | + assert ntp1.name == '/Common/r2' |
| 135 | + # The 'partition' attribute was removed in 11.6.1? |
| 136 | + |
119 | 137 | assert ntp1.address == "192.168.1.0" |
120 | 138 | assert ntp1.defaultEntry == "enabled" |
121 | 139 | assert ntp1.ignore == "enabled" |
|
0 commit comments