def test_post_with_headers(henry_post_bucket): r = ProxyRequests(henry_post_bucket + '/post') r.set_headers({'name': 'rootVIII', 'secret_message': '7Yufs9KIfj33d'}) r.post_with_headers({'key1': 'value1', 'key2': 'value2'}) assert r.get_status_code() == 200 assert 'Thank you' in r.__str__() print(r.get_proxy_used())
def test_get(): r = ProxyRequests('https://api.ipify.org') r.get() assert r.get_status_code() == 200 try: inet_aton(r.__str__()) except Exception: pytest.fail('Invalid IP address in response') print(r.get_proxy_used())
def test_post_file(henry_post_bucket): with open('/var/tmp/proxy_requests_testing.txt', 'w') as f_out: f_out.write('testing') r = ProxyRequests(henry_post_bucket + '/post') r.set_file('/var/tmp/proxy_requests_testing.txt') r.post_file() assert r.get_status_code() == 200 assert 'Thank you' in r.__str__() print(henry_post_bucket) print(r.get_proxy_used())
def test_post_file_with_headers(henry_post_bucket): with open('/var/tmp/proxy_requests_testing.txt', 'w') as f_out: f_out.write('testing') h = {'User-Agent': 'NCSA Mosaic/3.0 (Windows 95)'} r = ProxyRequests(henry_post_bucket + '/post') r.set_headers(h) r.set_file('/var/tmp/proxy_requests_testing.txt') r.post_file_with_headers() assert r.get_status_code() == 200 assert 'Thank you' in r.__str__() print(henry_post_bucket) print(r.get_proxy_used())
def test_post(henry_post_bucket): r = ProxyRequests(henry_post_bucket + '/post') r.post({'key1': 'value1', 'key2': 'value2'}) assert r.get_status_code() == 200 assert 'Thank you' in r.__str__() print(r.get_proxy_used())