chore(auth): #331 add tests for sign in
This commit is contained in:
@@ -47,7 +47,7 @@ func TestSignIn(t *testing.T) {
|
||||
|
||||
underTest := NewAuthImpl(mockAuthDb, mockRandom, mockClock, mockMail, &types.Settings{})
|
||||
|
||||
actualSession, actualUser, err := underTest.SignIn(user.Email, "password")
|
||||
actualSession, actualUser, err := underTest.SignIn(nil, user.Email, "password")
|
||||
assert.Nil(t, err)
|
||||
|
||||
assert.Equal(t, session, actualSession)
|
||||
@@ -78,7 +78,7 @@ func TestSignIn(t *testing.T) {
|
||||
|
||||
underTest := NewAuthImpl(mockAuthDb, mockRandom, mockClock, mockMail, &types.Settings{})
|
||||
|
||||
_, _, err := underTest.SignIn("test@test.de", "wrong password")
|
||||
_, _, err := underTest.SignIn(nil, "test@test.de", "wrong password")
|
||||
|
||||
assert.Equal(t, ErrInvalidCredentials, err)
|
||||
})
|
||||
@@ -93,7 +93,7 @@ func TestSignIn(t *testing.T) {
|
||||
|
||||
underTest := NewAuthImpl(mockAuthDb, mockRandom, mockClock, mockMail, &types.Settings{})
|
||||
|
||||
_, _, err := underTest.SignIn("test", "test")
|
||||
_, _, err := underTest.SignIn(nil, "test", "test")
|
||||
assert.Equal(t, ErrInvalidCredentials, err)
|
||||
})
|
||||
t.Run("should forward ErrInternal on any other error", func(t *testing.T) {
|
||||
@@ -107,7 +107,7 @@ func TestSignIn(t *testing.T) {
|
||||
|
||||
underTest := NewAuthImpl(mockAuthDb, mockRandom, mockClock, mockMail, &types.Settings{})
|
||||
|
||||
_, _, err := underTest.SignIn("test", "test")
|
||||
_, _, err := underTest.SignIn(nil, "test", "test")
|
||||
|
||||
assert.Equal(t, types.ErrInternal, err)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user