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-08 07:46:57 -04:00
|
|
|
import sys
|
2019-01-15 12:19:58 -05:00
|
|
|
|
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-06-08 07:46:57 -04:00
|
|
|
class TestFetch(DenoTestCase):
|
2019-05-30 16:40:40 -04:00
|
|
|
def test_fetch(self):
|
|
|
|
deno_dir = mkdtemp()
|
|
|
|
try:
|
|
|
|
t = os.path.join(tests_path, "006_url_imports.ts")
|
2019-06-08 07:46:57 -04:00
|
|
|
result = run_output([self.deno_exe, "fetch", t],
|
|
|
|
quiet=True,
|
2019-05-30 16:40:40 -04:00
|
|
|
merge_env={"DENO_DIR": deno_dir})
|
2019-06-08 07:46:57 -04:00
|
|
|
self.assertEqual(result.out, "")
|
|
|
|
self.assertEqual(result.code, 0)
|
2019-05-30 16:40:40 -04:00
|
|
|
# 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-09-19 14:48:05 -04:00
|
|
|
run_tests()
|