Skip to content

Commit bf3a942

Browse files
authored
Merge pull request #563 from pjbreaux/bugfix.user_create_11_5_4
Bugfix.user create 11 5 4
2 parents c407e62 + 9fd40bd commit bf3a942

1 file changed

Lines changed: 36 additions & 1 deletion

File tree

test/functional/auth/test_user.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414
#
1515

16+
from distutils.version import LooseVersion
1617
import pytest
1718

1819
from f5.bigip.resource import MissingRequiredCreationParameter
@@ -69,7 +70,14 @@ def test_create_no_args(self, bigip):
6970
with pytest.raises(MissingRequiredCreationParameter):
7071
user1.create()
7172

72-
def test_create_min_args(self, request, bigip):
73+
@pytest.mark.skipif(
74+
LooseVersion(
75+
pytest.config.getoption('--release')
76+
) < LooseVersion('11.6.0'),
77+
reason='Skip test if on a version below 11.6.0. The '
78+
'next test will implement the same logic for 11.5.4 '
79+
'and below.')
80+
def test_create_min_args_11_6_greater(self, request, bigip):
7381
'''Test that user.create() with only required arguments work.
7482
7583
This will also test that the default values are set correctly and are
@@ -94,6 +102,33 @@ def test_create_min_args(self, request, bigip):
94102
role='no-access'
95103
)]
96104

105+
@pytest.mark.skipif(
106+
LooseVersion(
107+
pytest.config.getoption('--release')
108+
) >= LooseVersion('11.6.0'),
109+
reason='Skip test if on a version greater than or equal to 11.6.0')
110+
def test_create_min_args_11_5_4_and_lower(self, request, bigip):
111+
'''Test that user.create() with only required arguments work.
112+
113+
This will also test that the default values are set correctly and are
114+
part of the user object after creating the instance on the BigIP
115+
'''
116+
setup_create_test(request, bigip)
117+
118+
user1 = bigip.auth.users.user.create(name='user1')
119+
120+
assert user1.name == 'user1'
121+
assert user1.generation is not None \
122+
and isinstance(user1.generation, int)
123+
assert user1.fullPath == 'user1'
124+
assert user1.selfLink.startswith(
125+
'https://localhost/mgmt/tm/auth/user/user1')
126+
127+
# Default Values
128+
assert user1.description == 'user1'
129+
assert user1.encryptedPassword == '!!'
130+
assert user1.partitionAccess == 'Common'
131+
97132
def test_create_description(self, request, bigip, USER):
98133
setup_create_test(request, bigip)
99134
USER1 = USER.create(name='user1', description='foo')

0 commit comments

Comments
 (0)