Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_enable_engine():
pook.get('server.com/foo').reply(204)
res = requests.get('http://server.com/foo')
assert res.status_code == 204
pook.disable()
def test_enable_engine():
pook.get('server.com/foo').reply(204)
res = requests.get('http://server.com/foo')
assert res.status_code == 204
pook.disable()
m = pook.get('http://httpbin.org/ip?foo=bar')
m.type('application/json')
m.type('application/xml')
m.reply(404).json({'error': 'not found'})
# Testing
pook.activate()
res = requests.get('http://httpbin.org/ip?foo=bar&baz=foo')
print('Status:', res.status_code)
print('Headers:', res.headers)
print('Body:', res.text)
# res = requests.get('http://httpbin.org/ip?foo=bar')
print('Mock:', m)
pook.disable()
# res = requests.get('http://httpbin.org/ip')