Skip to content

Commit

Permalink
fix: updat test
Browse files Browse the repository at this point in the history
  • Loading branch information
J0 committed Sep 12, 2024
1 parent f9270df commit b9e1ee3
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions internal/api/admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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
Expand Down

0 comments on commit b9e1ee3

Please sign in to comment.