def test_urlfetch_normal(self, server_settings): with file(os.path.join(server_settings['home'], 'index.html')) as index: index_content = index.read() url = "http://{}:{}/index.html".format(server_settings['host'], server_settings['port']) content, encoding, mimetype = urlfetch(url, timeout=3) assert index_content == content assert encoding == "utf-8" assert mimetype.startswith('text/html')
def test_urlfetch_bad(self, server_settings): url = "http://{}:{}/index.html".format("NOT_EXIST_DOMAIN", server_settings['port']) fetched = urlfetch(url, timeout=3) assert fetched == None