From 299362c8787795bc879fe6dc12b46c2377e5d784 Mon Sep 17 00:00:00 2001 From: Maxim Ivanchenko Date: Wed, 5 Jun 2024 19:27:37 +0300 Subject: [PATCH] EPMUII-7850 modify integration test --- .../user/register_integration_test.go | 28 +++---------------- 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/internal/integration-tests/user/register_integration_test.go b/internal/integration-tests/user/register_integration_test.go index a7d6d14..53bc466 100644 --- a/internal/integration-tests/user/register_integration_test.go +++ b/internal/integration-tests/user/register_integration_test.go @@ -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) @@ -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) {