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_test.go

24 lines
564 B
Go

package lib
import (
"net/http"
"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", nil)
log := LogHTTP(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")
}