Skip to content

Commit 72af69e

Browse files
author
pjbreaux
authored
Merge pull request #661 from caphrim007/feature.add-module-toggles-to-symbols
Add toggles for modules to symbols file
2 parents faac744 + e37136d commit 72af69e

3 files changed

Lines changed: 39 additions & 14 deletions

File tree

symbols.example.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
3+
bigip_netloc: "localhost"
4+
bigip_port: 10445
5+
bigip_username: "admin"
6+
bigip_password: "admin"
7+
modules:
8+
gtm: false
9+
ltm: true

test/functional/tm/gtm/test_datacenter.py

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,16 @@
1717

1818
from f5.bigip.resource import MissingRequiredCreationParameter
1919
from f5.bigip.tm.gtm.datacenter import Datacenter
20+
from pytest import symbols
2021
from requests.exceptions import HTTPError
2122

23+
pytestmark = pytest.mark.skipif(
24+
symbols
25+
and hasattr(symbols, 'modules')
26+
and not symbols.modules['gtm'],
27+
reason='The modules symbol for GTM is set to False.'
28+
)
29+
2230

2331
def delete_dc(mgmt_root, name, partition):
2432
try:
@@ -73,7 +81,7 @@ def test_create_optional_args(self, request, mgmt_root):
7381
contact="admin@root.local",
7482
description="A datacenter is fine too",
7583
location="Between the earth and the moon")
76-
assert False == dc1.enabled
84+
assert dc1.enabled is False
7785
assert "admin@root.local" == dc1.contact
7886
assert "A datacenter is fine too" == dc1.description
7987
assert "Between the earth and the moon" == dc1.location
@@ -93,15 +101,15 @@ def test_refresh(self, request, mgmt_root):
93101
name='dc1', partition='Common')
94102
d2 = mgmt_root.tm.gtm.datacenters.datacenter.load(
95103
name='dc1', partition='Common')
96-
assert True == d1.enabled
97-
assert True == d2.enabled
104+
assert d1.enabled is True
105+
assert d2.enabled is True
98106

99107
d2.update(enabled=False)
100-
assert False == d2.enabled
101-
assert True == d1.enabled
108+
assert d2.enabled is False
109+
assert d1.enabled is True
102110

103111
d1.refresh()
104-
assert False == d1.enabled
112+
assert d1.enabled is False
105113

106114

107115
class TestLoad(object):
@@ -115,27 +123,27 @@ def test_load(self, request, mgmt_root):
115123
setup_basic_test(request, mgmt_root, 'dc1', 'Common')
116124
dc1 = mgmt_root.tm.gtm.datacenters.datacenter.load(
117125
name='dc1', partition='Common')
118-
assert True == dc1.enabled
126+
assert dc1.enabled is True
119127
dc1.update(enabled=False)
120128
dc2 = mgmt_root.tm.gtm.datacenters.datacenter.load(
121129
name='dc1', partition='Common')
122-
assert False == dc1.enabled
123-
assert False == dc2.enabled
130+
assert dc1.enabled is False
131+
assert dc2.enabled is False
124132

125133

126134
class TestUpdate(object):
127135
def test_update(self, request, mgmt_root):
128136
dc1 = setup_basic_test(request, mgmt_root, 'dc1', 'Common')
129-
assert True == dc1.enabled
130-
assert False == dc1.disabled
137+
assert dc1.enabled is True
138+
assert dc1.disabled is False
131139
dc1.update(enabled=False)
132-
assert False == dc1.enabled
133-
assert True == dc1.disabled
140+
assert dc1.enabled is False
141+
assert dc1.disabled is True
134142

135143
def test_update_samevalue(self, request, mgmt_root):
136144
dc1 = setup_basic_test(request, mgmt_root, 'dc1', 'Common')
137145
dc1.update(enabled=True)
138-
assert False != dc1.enabled
146+
assert dc1.enabled is True
139147

140148

141149
class TestDelete(object):

test/functional/tm/gtm/test_rule.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,16 @@
1717

1818
from f5.bigip.resource import MissingRequiredCreationParameter
1919
from f5.bigip.tm.gtm.rule import Rule
20+
from pytest import symbols
2021
from requests.exceptions import HTTPError
2122

23+
pytestmark = pytest.mark.skipif(
24+
symbols
25+
and hasattr(symbols, 'modules')
26+
and not symbols.modules['gtm'],
27+
reason='The modules symbol for GTM is set to False.'
28+
)
29+
2230

2331
RULE = '''when LB_SELECTED {
2432
set wipHost [LB::server addr]

0 commit comments

Comments
 (0)