From ad1bb3ebde834c15c86a42184fc7405ea2c10c23 Mon Sep 17 00:00:00 2001 From: Geno Date: Thu, 30 Mar 2017 14:34:14 +0200 Subject: [PATCH] Create log_test.go --- lib/log_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 lib/log_test.go diff --git a/lib/log_test.go b/lib/log_test.go new file mode 100644 index 0000000..5f87326 --- /dev/null +++ b/lib/log_test.go @@ -0,0 +1,22 @@ +package lib + +import ( + "testing" + + "github.com/stretchr/testify/assert" + ) + +func TestLog(t *testing.T) { + assertion = assert.New(t) + + // No values check, just if it crashed or not + LogTimestamp(false) + + req, _ := http.NewRequest("GET", "https://google.com/lola/duda?q=wasd") + log := Log.GetHTTP(req) + _, ok := log.Data["remote"] + + assertion.NotNil(ok, "remote address not set in logger") + assertion.Equal("GET", log.Data["method"], "method not set in logger") + assertion.Equal("/lola/duda?q=wasd", log.Data["url"], "path not set in logger") +}