def test_unsupported_schema(): try: app = livetest.TestApp('localhost', scheme='ldap') except ValueError: pass else: raise AssertionError("unsupported scheme should fail")
def __init__(self, http, host=None, scheme='http'): # daddy self._http = http self._host = host self._scheme = scheme # the livetest app if host: self.app = livetest.TestApp(host, scheme=scheme) else: self.app = None # the last request self.response = None # requirements for the next request # None -> no requirements # True -> request should succeed # False -> request should not succeed # string -> response status code should startwith(string) self.next_request_should = None # setup new http context self.post_process_request(None)
def test_https(): app = livetest.TestApp('www.google.com', scheme='https') resp = app.get('https://www.google.com') assert resp.status_int == 302