def test_truesendall_after_mocket_session(): Mocket.enable() Mocket.disable() url = "https://httpbin.org/ip" resp = requests.get(url) assert resp.status_code == 200
def test_truesendall_after_mocket_session(): Mocket.enable() Mocket.disable() url = 'https://mockbin.com/ip' resp = requests.get(url) assert resp.status_code == 200
def test_truesendall_after_mocket_session(): Mocket.enable() Mocket.disable() url = 'https://httpbin.org/ip' resp = requests.get(url) assert resp.status_code == 200
def skyx(data_dir, request): """Create TheSkyX class but don't connect.t If running with a real connection TheSkyX then the Mokcet will be disabled here. """ # Use `--with-hardware thesky` on cli to run without mock Mocket.enable('theskyx', data_dir) if 'theskyx' in request.config.getoption('--with-hardware'): Mocket.disable() theskyx = TheSkyX(connect=False) yield theskyx
def skyx(request): """Create TheSkyX class but don't connect.t If running with a real connection TheSkyX then the Mokcet will be disabled here. """ # Use `--with-hardware thesky` on cli to run without mock Mocket.enable( 'theskyx', '{}/panoptes-utils/panoptes/utils/tests/data'.format( os.getenv('PANDIR'))) if 'theskyx' in request.config.getoption('--with-hardware'): Mocket.disable() theskyx = TheSkyX(connect=False) yield theskyx
def test_gethostbyname(self): host = socket.gethostbyname('localhost') Mocket.enable() self.assertEqual(socket.gethostbyname('localhost'), '127.0.0.1') Mocket.disable() self.assertEqual(socket.gethostbyname('localhost'), host)
def test_gethostname(self): hostname = socket.gethostname() Mocket.enable() self.assertEqual(socket.gethostname(), 'localhost') Mocket.disable() self.assertEqual(socket.gethostname(), hostname)
def test_gethostbyname(self): host = socket.gethostbyname("localhost") Mocket.enable() self.assertEqual(socket.gethostbyname("localhost"), "127.0.0.1") Mocket.disable() self.assertEqual(socket.gethostbyname("localhost"), host)
async def __aexit__(self, type, value, tb): if self.instance: self.check_and_call("mocketize_teardown") Mocket.disable()
def test_gethostbyname(self): host = socket.gethostbyname('localhost') Mocket.enable() self.assertEqual(socket.gethostbyname('localhost'), '127.0.0.1') Mocket.disable() self.assertEqual(socket.gethostbyname('localhost'), host)
def test_gethostname(self): hostname = socket.gethostname() Mocket.enable() self.assertEqual(socket.gethostname(), 'localhost') Mocket.disable() self.assertEqual(socket.gethostname(), hostname)