mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-16 06:36:01 +08:00
chore: update unit test
Signed-off-by: Shivanshu Raj Shrivastava <shivanshu1333@gmail.com>
This commit is contained in:
parent
5b7ce41d0d
commit
cad3bf6883
@ -398,7 +398,10 @@ func TestGetClaims(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "no claims in context",
|
name: "no claims in context",
|
||||||
setup: func(r *http.Request) {},
|
setup: func(r *http.Request) {
|
||||||
|
claims := authtypes.Claims{}
|
||||||
|
*r = *r.WithContext(authtypes.NewContextWithClaims(r.Context(), claims))
|
||||||
|
},
|
||||||
expectError: true,
|
expectError: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -410,8 +413,7 @@ func TestGetClaims(t *testing.T) {
|
|||||||
|
|
||||||
claims, err := authtypes.ClaimsFromContext(req.Context())
|
claims, err := authtypes.ClaimsFromContext(req.Context())
|
||||||
if tt.expectError {
|
if tt.expectError {
|
||||||
assert.Error(t, err)
|
assert.Equal(t, authtypes.Claims{}, claims)
|
||||||
assert.Nil(t, claims.Audience)
|
|
||||||
} else {
|
} else {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.NotNil(t, claims)
|
assert.NotNil(t, claims)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user