genofire/hs_monolith
genofire
/
hs_monolith
Archived
1
0
Fork 0
This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
hs_monolith/lib/log/log_test.go

25 lines
635 B
Go
Raw Normal View History

2017-04-28 10:14:59 +02:00
// Package log provides the
// functionality to start und initialize to logger
package log
2017-03-30 14:49:14 +02:00
import (
"net/http"
"testing"
2017-03-30 17:02:20 +02:00
2017-03-30 14:49:14 +02:00
"github.com/stretchr/testify/assert"
)
2017-04-28 10:14:59 +02:00
// Function to test the logging
// Input: pointer to teh testing object
2017-03-30 14:49:14 +02:00
func TestLog(t *testing.T) {
assertion := assert.New(t)
2017-03-30 17:02:20 +02:00
2017-03-30 14:49:14 +02:00
req, _ := http.NewRequest("GET", "https://google.com/lola/duda?q=wasd", nil)
log := HTTP(req)
2017-03-30 14:49:14 +02:00
_, ok := log.Data["remote"]
2017-03-30 17:02:20 +02:00
assertion.NotNil(ok, "remote address not set in logger")
2017-03-30 14:49:14 +02:00
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")
}