Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Pascal-Delange committed Mar 8, 2024
1 parent 423186f commit 06799a3
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions repositories/firebase/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ func (m *mockTokenCookieVerifier) VerifyIDToken(ctx context.Context, idToken str
return args.Get(0).(*auth.Token), args.Error(1)
}

func (m *mockTokenCookieVerifier) VerifySessionCookie(ctx context.Context, sessionCookie string) (*auth.Token, error) {
args := m.Called(ctx, sessionCookie)
return args.Get(0).(*auth.Token), args.Error(1)
}

func TestClient_VerifyFirebaseToken(t *testing.T) {
token := auth.Token{
Subject: "token_subject",
Expand Down Expand Up @@ -56,27 +51,6 @@ func TestClient_VerifyFirebaseToken(t *testing.T) {
mockVerifier := new(mockTokenCookieVerifier)
mockVerifier.On("VerifyIDToken", mock.Anything, "token").
Return(&auth.Token{}, assert.AnError)
mockVerifier.On("VerifySessionCookie", mock.Anything, "token").
Return(&token, nil)

c := Client{
verifier: mockVerifier,
}

identity, err := c.VerifyFirebaseToken(context.Background(), "token")
assert.NoError(t, err)
assert.Equal(t, models.FirebaseIdentity{
Email: "[email protected]",
}, identity)
mockVerifier.AssertExpectations(t)
})

t.Run("VerifySessionCookie error", func(t *testing.T) {
mockVerifier := new(mockTokenCookieVerifier)
mockVerifier.On("VerifyIDToken", mock.Anything, "token").
Return(&auth.Token{}, assert.AnError)
mockVerifier.On("VerifySessionCookie", mock.Anything, "token").
Return(&auth.Token{}, assert.AnError)

c := Client{
verifier: mockVerifier,
Expand Down

0 comments on commit 06799a3

Please sign in to comment.