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 sys
|
|
|
|
import shutil
|
|
|
|
|
2019-05-30 16:40:40 -04:00
|
|
|
from http_server import spawn
|
|
|
|
from util import DenoTestCase, mkdtemp, tests_path, run_output, test_main
|
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-05-30 16:40:40 -04:00
|
|
|
with spawn():
|
|
|
|
test_main()
|