Пример #1
0
def test_truesendall_after_mocket_session():
    Mocket.enable()
    Mocket.disable()

    url = "https://httpbin.org/ip"
    resp = requests.get(url)
    assert resp.status_code == 200
Пример #2
0
def test_truesendall_after_mocket_session():
    Mocket.enable()
    Mocket.disable()

    url = 'https://mockbin.com/ip'
    resp = requests.get(url)
    assert resp.status_code == 200
Пример #3
0
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
Пример #6
0
 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)
Пример #7
0
 def test_gethostname(self):
     hostname = socket.gethostname()
     Mocket.enable()
     self.assertEqual(socket.gethostname(), 'localhost')
     Mocket.disable()
     self.assertEqual(socket.gethostname(), hostname)
Пример #8
0
 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)
Пример #9
0
 async def __aexit__(self, type, value, tb):
     if self.instance:
         self.check_and_call("mocketize_teardown")
     Mocket.disable()
Пример #10
0
 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)
Пример #11
0
 def test_gethostname(self):
     hostname = socket.gethostname()
     Mocket.enable()
     self.assertEqual(socket.gethostname(), 'localhost')
     Mocket.disable()
     self.assertEqual(socket.gethostname(), hostname)