From e1ee36b9792813f0e9f01c17222e0e2ac9bde85f Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Wed, 21 Feb 2024 17:41:57 +0300 Subject: [PATCH] [#318] Fix tests Signed-off-by: Denis Kirillov --- api/auth/center_test.go | 8 ++++---- api/router_mock_test.go | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/api/auth/center_test.go b/api/auth/center_test.go index 69ef9d4..acca1ae 100644 --- a/api/auth/center_test.go +++ b/api/auth/center_test.go @@ -45,7 +45,7 @@ func TestAuthHeaderParse(t *testing.T) { }, } { authHeader, err := center.parseAuthHeader(tc.header) - require.Equal(t, tc.err, err, tc.header) + require.ErrorIs(t, err, tc.err, tc.header) require.Equal(t, tc.expected, authHeader, tc.header) } } @@ -82,8 +82,8 @@ func TestAuthHeaderGetAddress(t *testing.T) { err: defaulErr, }, } { - _, err := tc.authHeader.getAddress() - require.Equal(t, tc.err, err, tc.authHeader.AccessKeyID) + _, err := getAddress(tc.authHeader.AccessKeyID) + require.ErrorIs(t, err, tc.err, tc.authHeader.AccessKeyID) } } @@ -141,7 +141,7 @@ func TestCheckFormatContentSHA256(t *testing.T) { } { t.Run(tc.name, func(t *testing.T) { err := checkFormatHashContentSHA256(tc.hash) - require.Equal(t, tc.error, err) + require.ErrorIs(t, err, tc.error) }) } } diff --git a/api/router_mock_test.go b/api/router_mock_test.go index f29dcf2..7baa3a6 100644 --- a/api/router_mock_test.go +++ b/api/router_mock_test.go @@ -44,6 +44,7 @@ func (c *centerMock) Authenticate(*http.Request) (*middleware.Box, error) { } return &middleware.Box{ + AuthHeaders: &middleware.AuthHeader{}, AccessBox: &accessbox.Box{ Gate: &accessbox.GateData{ BearerToken: token,