Created
June 2, 2016 18:27
-
-
Save zancas/d2e8b822ac999e71eeac1dbba961a1f8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
from icontrol.session import iControlRESTSession | |
@pytest.fixture | |
def fakeicontrolsession(monkeypatch): | |
class Response(object): | |
def json(self): | |
return {'selfLink': 'https://localhost/mgmt/tm/sys?ver=11.6.0'} | |
fakesessionclass = mock.create_autospec(iControlRESTSession, spec_set=True) | |
fakesessioninstance =\ | |
mock.create_autospec(iControlRESTSession('A', 'B'), spec_set=True) | |
fakesessioninstance.get = mock.MagicMock(return_value=Response()) | |
fakesessionclass.return_value = fakesessioninstance | |
monkeypatch.setattr('f5.bigip.iControlRESTSession', fakesessionclass) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment