Skip to content

Commit 3be1719

Browse files
authored
add auth and secret block to response test for hmac (#28283)
1 parent 047ec75 commit 3be1719

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

audit/hashstructure_test.go

+26
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,24 @@ func TestHashResponse(t *testing.T) {
269269
CreationTime: now,
270270
WrappedAccessor: "bar",
271271
},
272+
Auth: &logical.Auth{
273+
ClientToken: "hvs.QWERTY-T1q5lEjIWux1Tjx-VGqAYJdd4FZtbp1wpD5Ym9pGh4KHGh2cy5TSjRndGoxaU44NzNscm5MSlRLQXZ0ZGg",
274+
Accessor: "ABClk9ZNLGOCuTrOEIAooJG3",
275+
TokenType: logical.TokenTypeService,
276+
},
277+
Secret: &logical.Secret{
278+
LeaseOptions: logical.LeaseOptions{
279+
TTL: 3,
280+
MaxTTL: 5,
281+
Renewable: false,
282+
Increment: 1,
283+
IssueTime: now,
284+
},
285+
InternalData: map[string]any{
286+
"foo": "bar",
287+
},
288+
LeaseID: "abc",
289+
},
272290
}
273291

274292
req := &logical.Request{MountPoint: "/foo/bar"}
@@ -280,6 +298,11 @@ func TestHashResponse(t *testing.T) {
280298
nonHMACDataKeys := []string{"baz"}
281299

282300
expected := &response{
301+
Auth: &auth{
302+
Accessor: "hmac-sha256:253184715b2d5a6c3a2fc7afe0d2294085f5e886a1275ca735646a6f23be2587",
303+
ClientToken: "hmac-sha256:2ce541100a8bcd687e8ec7712c8bb4c975a8d8599c02d98945e63ecd413bf0f3",
304+
TokenType: "service",
305+
},
283306
Data: map[string]interface{}{
284307
"foo": "hmac-sha256:f9320baf0249169e73850cd6156ded0106e2bb6ad8cab01b7bbbebe6d1065317",
285308
"baz": "foobar",
@@ -298,6 +321,9 @@ func TestHashResponse(t *testing.T) {
298321
MountPoint: "/foo/bar",
299322
MountRunningVersion: "123",
300323
MountRunningSha256: "256-256!",
324+
Secret: &secret{
325+
LeaseID: "abc",
326+
},
301327
}
302328

303329
inmemStorage := &logical.InmemStorage{}

0 commit comments

Comments
 (0)