Skip to content

Commit d54e0a7

Browse files
committed
draft 1 finished
1 parent b17fead commit d54e0a7

3 files changed

Lines changed: 21 additions & 11 deletions

File tree

f5/bigip/resource.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ def __init__(self, container):
217217
self._set_meta_data_uri()
218218
# Supported versions for each class will be defined here.
219219
# List can be modified downstream in each sub-class
220-
print('about to set the "minimum_version" for %s' % self.__class__.__name__)
221220
self._meta_data['minimum_version'] = '11.5.0'
222221
# Commands you can run on a resource or collection, we define it here
223222
self._meta_data['allowed_commands'] = []
@@ -1014,5 +1013,3 @@ def modify(self, **kwargs):
10141013
raise UnsupportedMethod(
10151014
"%s does not support the modify method" % self.__class__.__name__
10161015
)
1017-
1018-
pass

f5/bigip/test/test_resource.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -781,15 +781,23 @@ def test_modify_raises(self):
781781
def test_load(self):
782782
r = Virtual(mock.MagicMock())
783783
r._meta_data['allowed_lazy_attributes'] = []
784-
mockuri = "https://localhost:443/mgmt/tm/ltm/virtual"
785-
attrs = {'get.return_value':
786-
MockResponse(
784+
attrs = {'get.side_effect':
785+
[MockResponse(
787786
{
788787
u"generation": 0,
789-
u"selfLink": mockuri,
788+
u"selfLink": "https://localhost:443"
789+
"/mgmt/tm/ltm/virtual",
790790
u"kind": u"tm:ltm:virtual:virtualstate"
791-
}
792-
)}
791+
}),
792+
MockResponse(
793+
{
794+
u"generation": 0,
795+
u"selfLink": u'https://localhost'
796+
'/mgmt/tm/ltm/virtual/'
797+
'~Common~modtest1/stats?ver=11.6.0',
798+
u"kind": u"tm:ltm:virtual:virtualstats"
799+
})
800+
]}
793801
mock_session = mock.MagicMock(**attrs)
794802
r._meta_data['bigip']._meta_data =\
795803
{'icr_session': mock_session,
@@ -801,5 +809,9 @@ def test_load(self):
801809
x = r.load(partition='Common', name='test_load')
802810
assert x.selfLink == 'https://localhost:443/mgmt/tm/ltm/virtual'
803811
assert x._meta_data['allowed_lazy_attributes'] == [Profiles_s, Stats]
804-
pp(x.raw)
805-
x.stats
812+
statsfactory = x.stats
813+
assert 'selfLink' not in statsfactory.__dict__
814+
statsobj = statsfactory.load()
815+
assert statsobj.selfLink ==\
816+
u'https://localhost/mgmt/tm/ltm/virtual/'\
817+
'~Common~modtest1/stats?ver=11.6.0'

test/functional/tm/ltm/test_virtual.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def test_stats(self, request, mgmt_root, setup_device_snapshot):
8383
request, mgmt_root, 'Common', 'modtest1'
8484
)
8585
stats = virtual1.stats.load()
86+
pp(stats.raw)
8687
assert virtual1.cmpEnabled == u'yes'
8788
assert stats.entries['cmpEnabled']['description'] == u'enabled'
8889
virtual1.modify(cmpEnabled=u'no')

0 commit comments

Comments
 (0)