2019-01-15 12:19:58 -05:00
|
|
|
#!/usr/bin/env python
|
2019-01-21 14:03:30 -05:00
|
|
|
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
2019-01-15 12:19:58 -05:00
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
|
2019-06-03 12:35:55 -04:00
|
|
|
import http_server
|
|
|
|
from test_util import DenoTestCase, run_tests
|
|
|
|
from util import mkdtemp, tests_path, run_output
|
2019-01-15 12:19:58 -05:00
|
|
|
|
|
|
|
|
2019-05-30 16:40:40 -04:00
|
|
|
class FetchTest(DenoTestCase):
|
|
|
|
def test_fetch(self):
|
|
|
|
deno_dir = mkdtemp()
|
|
|
|
try:
|
|
|
|
t = os.path.join(tests_path, "006_url_imports.ts")
|
|
|
|
output = run_output([self.deno_exe, "fetch", t],
|
|
|
|
merge_env={"DENO_DIR": deno_dir})
|
|
|
|
assert output == ""
|
|
|
|
# Check that we actually did the prefetch.
|
|
|
|
os.path.exists(
|
|
|
|
os.path.join(
|
|
|
|
deno_dir,
|
|
|
|
"deps/http/localhost_PORT4545/tests/subdir/mod2.ts"))
|
|
|
|
finally:
|
|
|
|
shutil.rmtree(deno_dir)
|
2019-01-15 12:19:58 -05:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2019-06-03 12:35:55 -04:00
|
|
|
with http_server.spawn():
|
|
|
|
run_tests()
|