Add Dockerfile, Makefile, specs, SSL certs
This commit is contained in:
26
spec/nginx_spec.moon
Normal file
26
spec/nginx_spec.moon
Normal file
@@ -0,0 +1,26 @@
|
||||
http = require "luajit-curl-helper.http"
|
||||
|
||||
req = (url) ->
|
||||
request = http.init url
|
||||
st = request\perform!
|
||||
error request\lastError! if not st
|
||||
request
|
||||
|
||||
describe "test environment", ->
|
||||
it "can't connect to the internet", ->
|
||||
assert.has_error (-> req "http://example.org"),
|
||||
"Couldn't resolve host name"
|
||||
|
||||
describe "https://domain.abc", ->
|
||||
it "sends /index.html", ->
|
||||
request = req "https://domain.abc"
|
||||
assert.same request\statusCode!, 200
|
||||
assert.same request\statusMessage!, "OK"
|
||||
assert.same request\body!\match("<body>%s+(.-)%s+</body>"), "hello world!"
|
||||
|
||||
describe "http://domain.abc", ->
|
||||
it "redirects to https", ->
|
||||
request = req "http://domain.abc"
|
||||
assert.same request\statusCode!, 301
|
||||
assert.same request\statusMessage!, "Moved Permanently"
|
||||
assert.same request\header!.Location, "https://domain.abc/"
|
||||
Reference in New Issue
Block a user