From e2488841b45c77844bd3797e6bac1b8b95ea43fc Mon Sep 17 00:00:00 2001 From: HFO4 <912394456@qq.com> Date: Tue, 2 Mar 2021 12:45:54 +0800 Subject: [PATCH] Test: #765 --- models/user_test.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/models/user_test.go b/models/user_test.go index ea346a2..5b4d375 100644 --- a/models/user_test.go +++ b/models/user_test.go @@ -352,10 +352,20 @@ func TestUser_IncreaseStorageWithoutCheck(t *testing.T) { } } -func TestGetUserByEmail(t *testing.T) { +func TestGetActiveUserByEmail(t *testing.T) { asserts := assert.New(t) mock.ExpectQuery("SELECT(.+)").WithArgs(Active, "abslant@foxmail.com").WillReturnRows(sqlmock.NewRows([]string{"id", "email"})) + _, err := GetActiveUserByEmail("abslant@foxmail.com") + + asserts.Error(err) + asserts.NoError(mock.ExpectationsWereMet()) +} + +func TestGetUserByEmail(t *testing.T) { + asserts := assert.New(t) + + mock.ExpectQuery("SELECT(.+)").WithArgs("abslant@foxmail.com").WillReturnRows(sqlmock.NewRows([]string{"id", "email"})) _, err := GetUserByEmail("abslant@foxmail.com") asserts.Error(err)