Skip to content

Commit

Permalink
EPMUII-7850 modify integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
wvxiw8 committed Jun 5, 2024
1 parent da17a8d commit 299362c
Showing 1 changed file with 4 additions and 24 deletions.
28 changes: 4 additions & 24 deletions internal/integration-tests/user/register_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestIntegration_RegisterUser(t *testing.T) {
params.SetHTTPClient(http.DefaultClient)

t.Run("user person register ok", func(t *testing.T) {
// login, password, type required, name and email also
// login, password, type required
user, err := c.Users.PostUser(params)
require.NoError(t, err)

Expand Down Expand Up @@ -148,30 +148,10 @@ func TestIntegration_RegisterUser(t *testing.T) {
assert.Equal(t, errExp, err)
})

t.Run("name validation error", func(t *testing.T) {
userType = "person"
data = &models.UserRegister{
ActiveAreas: []int64{3},
Login: &l,
Password: &p,
Type: &userType,
Name: "",
Email: strfmt.Email(gofakeit.Email()),
}
params.SetData(data)

t.Run("name absence is ok", func(t *testing.T) {
data.Name = ""
_, err := c.Users.PostUser(params)
require.Error(t, err)

errExp := users.NewPostUserDefault(http.StatusInternalServerError)
codeExp := int32(http.StatusInternalServerError)
errExp.Payload = &models.SwaggerError{
Code: &codeExp,
Message: &messages.ErrCreateUser,
Details: "ent: validator failed for field \"User.name\": value is less than the required length",
}

assert.Equal(t, errExp, err)
require.NoError(t, err)
})

t.Run("email validation error", func(t *testing.T) {
Expand Down

0 comments on commit 299362c

Please sign in to comment.