From b9e1ee375396b5b7b11172a5361dea55d14ad0e5 Mon Sep 17 00:00:00 2001 From: joel Date: Thu, 12 Sep 2024 15:26:12 +0300 Subject: [PATCH] fix: updat test --- internal/api/admin_test.go | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/internal/api/admin_test.go b/internal/api/admin_test.go index e2904d8bf..a2070d7e2 100644 --- a/internal/api/admin_test.go +++ b/internal/api/admin_test.go @@ -816,7 +816,7 @@ func (ts *AdminTestSuite) TestAdminUserUpdateFactor() { require.NoError(ts.T(), err, "Error making new user") require.NoError(ts.T(), ts.API.db.Create(u), "Error creating user") - f := models.NewTOTPFactor(u, "testSimpleName") + f := models.NewPhoneFactor(u, "123456789", "testSimpleName") require.NoError(ts.T(), f.SetSecret("secretkey", ts.Config.Security.DBEncryption.Encrypt, ts.Config.Security.DBEncryption.EncryptionKeyID, ts.Config.Security.DBEncryption.EncryptionKey)) require.NoError(ts.T(), ts.API.db.Create(f), "Error saving new test factor") @@ -833,20 +833,12 @@ func (ts *AdminTestSuite) TestAdminUserUpdateFactor() { ExpectedCode: http.StatusOK, }, { - Desc: "Update factor: valid factor type", + Desc: "Update Factor phone number", FactorData: map[string]interface{}{ - "friendly_name": "john", - "factor_type": models.TOTP, + "phone": "+1976154321", }, ExpectedCode: http.StatusOK, }, - { - Desc: "Update factor: invalid factor", - FactorData: map[string]interface{}{ - "factor_type": "invalid_factor", - }, - ExpectedCode: http.StatusBadRequest, - }, } // Initialize factor data