From ac8374fd17e30fca9a7773a2a6f690a7ea4d2ec9 Mon Sep 17 00:00:00 2001 From: Grayson Koonce Date: Wed, 12 Oct 2016 11:04:26 -0700 Subject: Rework as HTTP server (#15) --- handler_test.go | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 handler_test.go (limited to 'handler_test.go') diff --git a/handler_test.go b/handler_test.go new file mode 100644 index 0000000..9f2eca8 --- /dev/null +++ b/handler_test.go @@ -0,0 +1,102 @@ +package main + +import "testing" + +var config = ` + +url: go.uber.org +packages: + yarpc: + repo: github.com/yarpc/yarpc-go + thriftrw: + repo: github.com/thriftrw/thriftrw-go + +` + +func TestIndex(t *testing.T) { + rr := CallAndRecord(t, config, "/") + AssertResponse(t, rr, 200, ` + + + + + + +`) +} + +func TestPackageShouldExist(t *testing.T) { + rr := CallAndRecord(t, config, "/yarpc") + AssertResponse(t, rr, 200, ` + + + + + + + + + Nothing to see here. Please move along. + + +`) +} + +func TestNonExistentPackageShould404(t *testing.T) { + rr := CallAndRecord(t, config, "/nonexistent") + AssertResponse(t, rr, 404, ` +404 page not found +`) +} + +func TestTrailingSlash(t *testing.T) { + rr := CallAndRecord(t, config, "/yarpc/") + AssertResponse(t, rr, 200, ` + + + + + + + + + Nothing to see here. Please move along. + + +`) +} + +func TestDeepImports(t *testing.T) { + rr := CallAndRecord(t, config, "/yarpc/heeheehee") + AssertResponse(t, rr, 200, ` + + + + + + + + + Nothing to see here. Please move along. + + +`) + + rr = CallAndRecord(t, config, "/yarpc/heehee/hawhaw") + AssertResponse(t, rr, 200, ` + + + + + + + + + Nothing to see here. Please move along. + + +`) +} -- cgit v1.2.3