@@ -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'
0 commit comments