Esempio n. 1
0
 def test_actual_download(self, httpbin_both, httpbin):
     robots_txt = '/robots.txt'
     body = urlopen(httpbin + robots_txt).read().decode()
     env = TestEnvironment(stdin_isatty=True, stdout_isatty=False)
     r = http('--download', httpbin_both.url + robots_txt, env=env)
     assert 'Downloading' in r.stderr
     assert '[K' in r.stderr
     assert 'Done' in r.stderr
     assert body == r
 def test_actual_download(self, httpbin_both, httpbin):
     robots_txt = '/robots.txt'
     body = urlopen(httpbin + robots_txt).read().decode()
     env = MockEnvironment(stdin_isatty=True, stdout_isatty=False)
     r = http('--download', httpbin_both.url + robots_txt, env=env)
     assert 'Downloading' in r.stderr
     assert '[K' in r.stderr
     assert 'Done' in r.stderr
     assert body == r
Esempio n. 3
0
 def test_actual_download(self, httpbin):
     url = httpbin.url + '/robots.txt'
     body = urlopen(url).read().decode()
     env = TestEnvironment(stdin_isatty=True, stdout_isatty=False)
     r = http('--download', url, env=env)
     assert 'Downloading' in r.stderr
     assert '[K' in r.stderr
     assert 'Done' in r.stderr
     assert body == r
Esempio n. 4
0
 def test_actual_download(self):
     url = httpbin('/robots.txt')
     body = urlopen(url).read().decode()
     env = TestEnvironment(stdin_isatty=True, stdout_isatty=False)
     r = http('--download', url, env=env)
     assert 'Downloading' in r.stderr
     assert '[K' in r.stderr
     assert 'Done' in r.stderr
     assert body == r
Esempio n. 5
0
def test_output_option(httpbin, stdout_isatty):
    output_filename = os.path.join(gettempdir(), test_output_option.__name__)
    url = httpbin + "/robots.txt"

    r = http("--output", output_filename, url, env=TestEnvironment(stdout_isatty=stdout_isatty))
    assert r == ""

    expected_body = urlopen(url).read().decode()
    with open(output_filename, "r") as f:
        actual_body = f.read()

    assert actual_body == expected_body
def test_output_option(httpbin, stdout_isatty):
    output_filename = os.path.join(gettempdir(), test_output_option.__name__)
    url = httpbin + '/robots.txt'

    r = http('--output', output_filename, url,
             env=MockEnvironment(stdout_isatty=stdout_isatty))
    assert r == ''

    expected_body = urlopen(url).read().decode()
    with open(output_filename, 'r') as f:
        actual_body = f.read()

    assert actual_body == expected_body
Esempio n. 7
0
def test_output_option(httpbin, stdout_isatty):
    output_filename = os.path.join(gettempdir(), test_output_option.__name__)
    url = httpbin + '/robots.txt'

    r = http('--output', output_filename, url,
             env=TestEnvironment(stdout_isatty=stdout_isatty))
    assert r == ''

    expected_body = urlopen(url).read().decode()
    with open(output_filename, 'r') as f:
        actual_body = f.read()

    assert actual_body == expected_body
 def bindata(self):
     if not hasattr(self, '_bindata'):
         self._bindata = urlopen(self.url).read()
     return self._bindata
 def bindata(self):
     if not hasattr(self, '_bindata'):
         self._bindata = urlopen(self.url).read()
     return self._bindata