MCPcopy Create free account
hub / github.com/clouditor/clouditor / TestLogRequest

Function TestLogRequest

internal/logging/logging_test.go:104–205  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

102}
103
104func TestLogRequest(t *testing.T) {
105 type args struct {
106 level logrus.Level
107 reqType RequestType
108 req api.PayloadRequest
109 params []string
110 }
111 tests := []struct {
112 name string
113 args args
114 want string
115 }{
116 {
117 name: "Request missing",
118 args: args{
119 level: logrus.DebugLevel,
120 reqType: Register,
121 },
122 want: "",
123 },
124 {
125 name: "Register certification target",
126 args: args{
127 level: logrus.DebugLevel,
128 reqType: Register,
129 req: &orchestrator.RegisterCertificationTargetRequest{
130 CertificationTarget: &orchestrator.CertificationTarget{},
131 },
132 },
133 want: "level=debug msg=CertificationTarget registered.\n",
134 },
135
136 {
137 name: "Register certification target",
138 args: args{
139 level: logrus.DebugLevel,
140 reqType: Register,
141 req: &orchestrator.RegisterCertificationTargetRequest{
142 CertificationTarget: &orchestrator.CertificationTarget{Id: testdata.MockCertificationTargetID1},
143 },
144 },
145 want: "level=debug msg=CertificationTarget with ID '11111111-1111-1111-1111-111111111111' registered.\n",
146 },
147 {
148 name: "Create AuditScope",
149 args: args{
150 level: logrus.DebugLevel,
151 reqType: Update,
152 req: &orchestrator.UpdateAuditScopeRequest{
153 AuditScope: &orchestrator.AuditScope{
154 CertificationTargetId: testdata.MockCertificationTargetID1,
155 CatalogId: testdata.MockCatalogID,
156 },
157 },
158 },
159 want: "level=debug msg=AuditScope updated for Certification Target '11111111-1111-1111-1111-111111111111'.\n",
160 },
161 {

Callers

nothing calls this directly

Calls 3

EqualFunction · 0.92
LogRequestFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected