|
16 | 16 | from f5.bigip.resource import MissingRequiredCreationParameter |
17 | 17 | from f5.bigip.resource import MissingRequiredReadParameter |
18 | 18 |
|
19 | | -from distutils.version import LooseVersion |
20 | 19 | from pprint import pprint as pp |
21 | 20 | import pytest |
22 | 21 |
|
@@ -56,61 +55,48 @@ def test_virtual_create_refresh_update_delete_load( |
56 | 55 | assert virtual2.selfLink == virtual1.selfLink |
57 | 56 |
|
58 | 57 |
|
59 | | -@pytest.mark.skipif( |
60 | | - LooseVersion(pytest.config.getoption('--release')) |
61 | | - < LooseVersion('11.6.0'), |
62 | | - reason='Profiles do not need a partition in 11.6.0 and up.' |
63 | | -) |
64 | | -def test_profiles_CE_and_greater( |
| 58 | +def test_profiles_CE( |
65 | 59 | mgmt_root, opt_release, setup_device_snapshot |
66 | 60 | ): |
67 | 61 | v1 = mgmt_root.tm.ltm.virtuals.virtual.create( |
68 | 62 | name="tv1", partition="Common" |
69 | 63 | ) |
70 | | - p1 = v1.profiles_s.profiles.create(name="http") |
| 64 | + p1 = v1.profiles_s.profiles.create(name="http", partition='Common') |
71 | 65 | test_profiles_s = v1.profiles_s |
72 | 66 | test_profiles_s.context = 'all' |
73 | 67 | assert p1.selfLink ==\ |
74 | 68 | u"https://localhost/mgmt/tm/ltm/virtual/"\ |
75 | | - "~Common~tv1/profiles/http?ver="+opt_release |
| 69 | + "~Common~tv1/profiles/~Common~http?ver="+opt_release |
76 | 70 |
|
77 | 71 | p2 = v1.profiles_s.profiles |
78 | | - assert p2.exists(name='http') |
| 72 | + assert p2.exists(name='http', partition='Common') |
79 | 73 |
|
80 | 74 | v1.delete() |
81 | 75 |
|
82 | 76 |
|
83 | | -@pytest.mark.skipif( |
84 | | - LooseVersion(pytest.config.getoption('--release')) |
85 | | - >= LooseVersion('11.6.0'), |
86 | | - reason='Profiles are created with a partition in 11.5.4.' |
87 | | -) |
88 | | -def test_profiles_CE_11_5_4_and_less( |
89 | | - mgmt_root, opt_release, setup_device_snapshot |
90 | | -): |
| 77 | +def test_profiles_CE_check_create_params(mgmt_root, setup_device_snapshot): |
91 | 78 | v1 = mgmt_root.tm.ltm.virtuals.virtual.create( |
92 | 79 | name="tv2", partition="Common" |
93 | 80 | ) |
94 | | - # Ensure we cannot create a profile without partition in 11.5.4 |
95 | 81 | with pytest.raises(MissingRequiredCreationParameter) as ex: |
96 | 82 | v1.profiles_s.profiles.create(name="http") |
97 | 83 | assert "Missing required params: ['partition']" in ex.value.message |
| 84 | + v1.delete() |
98 | 85 |
|
99 | | - # Create the profile with the partition given |
| 86 | + |
| 87 | +def test_profiles_CE_check_load_params(mgmt_root, setup_device_snapshot): |
| 88 | + v1 = mgmt_root.tm.ltm.virtuals.virtual.create( |
| 89 | + name="tv3", partition="Common" |
| 90 | + ) |
100 | 91 | p1 = v1.profiles_s.profiles.create(name="http", partition="Common") |
101 | | - test_profiles_s = v1.profiles_s |
102 | | - test_profiles_s.context = 'all' |
103 | | - assert p1.selfLink ==\ |
104 | | - u"https://localhost/mgmt/tm/ltm/virtual/"\ |
105 | | - "~Common~tv2/profiles/~Common~http?ver="+opt_release |
106 | 92 |
|
107 | | - p2 = v1.profiles_s.profiles |
108 | | - # Ensure we cannot check for existence without partition in 11.5.4 |
109 | 93 | with pytest.raises(MissingRequiredReadParameter) as ex: |
110 | | - assert p2.exists(name='http') |
| 94 | + assert v1.profiles_s.profiles.load(name='http') |
111 | 95 | assert "Missing required params: ['partition']" in ex.value.message |
112 | 96 |
|
| 97 | + v1.profiles_s.profiles.load(name="http", partition="Common") |
| 98 | + |
113 | 99 | # Check for existence with partition given |
114 | | - p2.exists(name='http', partition='Common') |
| 100 | + p1.exists(name='http', partition='Common') |
115 | 101 |
|
116 | 102 | v1.delete() |
0 commit comments