summaryrefslogtreecommitdiff
path: root/std/http/file_server_test.ts
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2020-05-04 14:23:06 -0400
committerGitHub <noreply@github.com>2020-05-04 14:23:06 -0400
commit6c02b061ce157b9fc3d20f9bcace0bc6638290d3 (patch)
tree811310674a76ee8ce5761cec3ee711012e542fcf /std/http/file_server_test.ts
parent191c59a5912121fb9062aff6a08b1cc110674044 (diff)
stabilize Deno.cwd and require --allow-read (#5068)
Diffstat (limited to 'std/http/file_server_test.ts')
-rw-r--r--std/http/file_server_test.ts42
1 files changed, 4 insertions, 38 deletions
diff --git a/std/http/file_server_test.ts b/std/http/file_server_test.ts
index d471c1519..7a3699337 100644
--- a/std/http/file_server_test.ts
+++ b/std/http/file_server_test.ts
@@ -1,5 +1,5 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-import { assert, assertEquals, assertStrContains } from "../testing/asserts.ts";
+import { assert, assertEquals } from "../testing/asserts.ts";
import { BufReader } from "../io/bufio.ts";
import { TextProtoReader } from "../textproto/mod.ts";
import { ServerRequest } from "./server.ts";
@@ -12,7 +12,6 @@ async function startFileServer(): Promise<void> {
cmd: [
Deno.execPath(),
"run",
- "--unstable",
"--allow-read",
"--allow-net",
"http/file_server.ts",
@@ -104,47 +103,14 @@ test("serveWithUnorthodoxFilename", async function (): Promise<void> {
}
});
-test("servePermissionDenied", async function (): Promise<void> {
- const deniedServer = Deno.run({
- // TODO(lucacasonato): remove unstable when stabilized
- cmd: [
- Deno.execPath(),
- "run",
- "--unstable",
- "--allow-net",
- "http/file_server.ts",
- ],
- stdout: "piped",
- stderr: "piped",
- });
- assert(deniedServer.stdout != null);
- const reader = new TextProtoReader(new BufReader(deniedServer.stdout));
- assert(deniedServer.stderr != null);
- const errReader = new TextProtoReader(new BufReader(deniedServer.stderr));
- const s = await reader.readLine();
- assert(s !== null && s.includes("server listening"));
-
- try {
- const res = await fetch("http://localhost:4500/");
- const _ = await res.text();
- assertStrContains(
- (await errReader.readLine()) as string,
- "run again with the --allow-read flag"
- );
- } finally {
- deniedServer.close();
- deniedServer.stdout.close();
- deniedServer.stderr.close();
- }
-});
-
test("printHelp", async function (): Promise<void> {
const helpProcess = Deno.run({
- // TODO(lucacasonato): remove unstable when stabilized
cmd: [
Deno.execPath(),
"run",
- "--unstable",
+ // TODO(ry) It ought to be possible to get the help output without
+ // --allow-read.
+ "--allow-read",
"http/file_server.ts",
"--help",
],