2026-02-16 16:26:43: merge [main:5ee9d8568258a2e35dfce4aba80a607d007c2f0c];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
This commit is contained in:
1 parent
aebc53174b
commit
0ad3e3dead
41 files changed
+1378
-239
No files matched your search
+32
-3
@@ -100,6 +100,8 @@ func (s *AuthTestSuite) TestLoginHappyPath() {
|
||||
|
||||
tokenInfo := SelectTokenEntityByToken(s.db, response.Token)
|
||||
s.Require().Equal(tokenInfo.UserId, id)
|
||||
|
||||
time.Sleep(1 * time.Second) // wait for go SaveAuditAsync()
|
||||
}
|
||||
|
||||
func (s *AuthTestSuite) TestLoginNotFound() {
|
||||
@@ -113,6 +115,8 @@ func (s *AuthTestSuite) TestLoginNotFound() {
|
||||
st, ok := status.FromError(err)
|
||||
s.Require().True(ok)
|
||||
s.Require().Equal(codes.Unauthenticated, st.Code())
|
||||
|
||||
time.Sleep(1 * time.Second) // wait for go SaveAuditAsync()
|
||||
}
|
||||
|
||||
func (s *AuthTestSuite) TestBlockedUser() {
|
||||
@@ -134,6 +138,8 @@ func (s *AuthTestSuite) TestBlockedUser() {
|
||||
st, ok := status.FromError(err)
|
||||
s.Require().True(ok)
|
||||
s.Require().Equal(codes.Unauthenticated, st.Code())
|
||||
|
||||
time.Sleep(1 * time.Second) // wait for go SaveAuditAsync()
|
||||
}
|
||||
|
||||
func (s *AuthTestSuite) TestLoginWrongPassword() {
|
||||
@@ -154,6 +160,8 @@ func (s *AuthTestSuite) TestLoginWrongPassword() {
|
||||
st, ok := status.FromError(err)
|
||||
s.Require().True(ok)
|
||||
s.Require().Equal(codes.Unauthenticated, st.Code())
|
||||
|
||||
time.Sleep(1 * time.Second) // wait for go SaveAuditAsync()
|
||||
}
|
||||
|
||||
func (s *AuthTestSuite) TestSudirLoginHappyPath() {
|
||||
@@ -167,11 +175,14 @@ func (s *AuthTestSuite) TestSudirLoginHappyPath() {
|
||||
Do(context.Background())
|
||||
s.Require().NoError(err)
|
||||
user := entity.User{}
|
||||
s.db.Must().SelectRow(&user, "select id, email from users where sudir_user_id = $1", "sudirUser1")
|
||||
s.db.Must().SelectRow(&user, "select id, email, full_name from users where sudir_user_id = $1", "sudirUser1")
|
||||
s.Require().Equal("sudir@email.ru", user.Email)
|
||||
s.Require().Equal("surname name patronymic", user.FullName)
|
||||
|
||||
tokenInfo := SelectTokenEntityByToken(s.db, response.Token)
|
||||
s.Require().Equal(tokenInfo.UserId, user.Id)
|
||||
|
||||
time.Sleep(1 * time.Second) // wait for go SaveAuditAsync()
|
||||
}
|
||||
|
||||
func (s *AuthTestSuite) Test_Logout_HappyPath() {
|
||||
@@ -190,6 +201,8 @@ func (s *AuthTestSuite) Test_Logout_HappyPath() {
|
||||
|
||||
tokenInfo := SelectTokenEntityByToken(s.db, "token-841297641213")
|
||||
s.Require().Equal(entity.TokenStatusRevoked, tokenInfo.Status)
|
||||
|
||||
time.Sleep(1 * time.Second) // wait for go SaveAuditAsync()
|
||||
}
|
||||
|
||||
func (s *AuthTestSuite) Test_Logout_NotFound() {
|
||||
@@ -200,10 +213,21 @@ func (s *AuthTestSuite) Test_Logout_NotFound() {
|
||||
|
||||
time.Sleep(time.Second)
|
||||
audit := repository.NewAudit(s.db)
|
||||
auditList, err := audit.All(context.Background(), 10, 0)
|
||||
auditList, err := audit.AllByRequest(context.Background(), domain.AuditPageRequest{
|
||||
LimitOffestParams: domain.LimitOffestParams{
|
||||
Limit: 10,
|
||||
Offset: 0,
|
||||
},
|
||||
Order: &domain.OrderParams{
|
||||
Field: "created_at",
|
||||
Type: "desc",
|
||||
},
|
||||
})
|
||||
s.Require().NoError(err)
|
||||
s.Require().Len(auditList, 1) //nolint:mnd
|
||||
s.Require().Len(auditList, 1)
|
||||
s.Require().Equal(entity.EventSuccessLogout, auditList[0].Event)
|
||||
|
||||
time.Sleep(1 * time.Second) // wait for go SaveAuditAsync()
|
||||
}
|
||||
|
||||
func (s *AuthTestSuite) Test_Logout_AlreadyRevoke() {
|
||||
@@ -222,6 +246,8 @@ func (s *AuthTestSuite) Test_Logout_AlreadyRevoke() {
|
||||
|
||||
tokenInfo := SelectTokenEntityByToken(s.db, "token-148623719462")
|
||||
s.Require().Equal(entity.TokenStatusRevoked, tokenInfo.Status)
|
||||
|
||||
time.Sleep(1 * time.Second) // wait for go SaveAuditAsync()
|
||||
}
|
||||
|
||||
func (s *AuthTestSuite) TestBruteForceLogin() {
|
||||
@@ -268,6 +294,8 @@ func (s *AuthTestSuite) TestBruteForceLogin() {
|
||||
|
||||
s.Require().EqualValues(97, tooManyRequestsErrorCount.Load())
|
||||
s.Require().EqualValues(3, unauthorizedErrorCount.Load())
|
||||
|
||||
time.Sleep(2 * time.Second) // wait for go SaveAuditAsync()
|
||||
}
|
||||
|
||||
func (s *AuthTestSuite) initMockSudir() (*httptest.Server, string) {
|
||||
@@ -291,6 +319,7 @@ func (s *AuthTestSuite) initMockSudir() (*httptest.Server, string) {
|
||||
Sub: "sudirUser1",
|
||||
GivenName: "name",
|
||||
FamilyName: "surname",
|
||||
Name: "surname name patronymic",
|
||||
}
|
||||
data, err := json.Marshal(res)
|
||||
s.Require().NoError(err) //nolint:testifylint
|
||||
|
||||
Reference in new issue
Block a user