File: attributes_test.go

package info (click to toggle)
golang-github-zitadel-logging 0.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid, trixie
  • size: 156 kB
  • sloc: javascript: 8; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 431 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package logging

import (
	"net/http/httptest"
	"testing"

	"github.com/stretchr/testify/assert"
)

func Test_requestToAttr(t *testing.T) {
	out, logger := newTestLogger()
	logger.Info("test", requestToAttr(
		httptest.NewRequest("GET", "/taget", nil),
	))

	want := `{
		"level":"INFO",
		"msg":"test",
		"time":"not",
		"request":{
			"method":"GET",
			"url":"/taget"
		}
	}`
	got := out.String()
	assert.JSONEq(t, want, got)
}