fix test cases for user data
This commit is contained in:
@@ -2,6 +2,7 @@ package test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/authorizerdev/authorizer/server/constants"
|
||||
"github.com/authorizerdev/authorizer/server/db"
|
||||
@@ -21,6 +22,7 @@ func forgotPasswordTest(t *testing.T, s TestSetup) {
|
||||
ConfirmPassword: s.TestInfo.Password,
|
||||
})
|
||||
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
_, err = resolvers.ForgotPasswordResolver(ctx, model.ForgotPasswordInput{
|
||||
Email: email,
|
||||
})
|
||||
|
@@ -5,7 +5,6 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/authorizerdev/authorizer/server/constants"
|
||||
"github.com/authorizerdev/authorizer/server/db"
|
||||
@@ -37,7 +36,7 @@ func TestResolvers(t *testing.T) {
|
||||
} else {
|
||||
t.Log("waiting for docker containers to start...")
|
||||
// wait for docker containers to spun up
|
||||
time.Sleep(30 * time.Second)
|
||||
// time.Sleep(30 * time.Second)
|
||||
}
|
||||
|
||||
testDb := "authorizer_test"
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/authorizerdev/authorizer/server/constants"
|
||||
@@ -55,6 +56,9 @@ func signupTests(t *testing.T, s TestSetup) {
|
||||
ConfirmPassword: s.TestInfo.Password,
|
||||
})
|
||||
|
||||
fmt.Println("err", err)
|
||||
fmt.Println("res", res)
|
||||
|
||||
assert.NotNil(t, err, "should throw duplicate email error")
|
||||
|
||||
verificationRequest, err := db.Provider.GetVerificationRequestByEmail(ctx, email, constants.VerificationTypeBasicAuthSignup)
|
||||
|
@@ -108,8 +108,10 @@ func testSetup() TestSetup {
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeySmtpPassword, "test")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeySenderEmail, "info@yopmail.com")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyProtectedRoles, "admin")
|
||||
fmt.Println("called test suite before")
|
||||
|
||||
err = db.InitDB()
|
||||
fmt.Println("called test suite")
|
||||
if err != nil {
|
||||
log.Fatal("Error loading db: ", err)
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@ package test
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/authorizerdev/authorizer/server/constants"
|
||||
"github.com/authorizerdev/authorizer/server/db"
|
||||
@@ -41,9 +42,12 @@ func updateAllUsersTest(t *testing.T, s TestSetup) {
|
||||
Offset: 0,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
|
||||
for _, u := range listUsers.Users {
|
||||
assert.True(t, refs.BoolValue(u.IsMultiFactorAuthEnabled))
|
||||
}
|
||||
time.Sleep(1 * time.Second)
|
||||
|
||||
// // update few users
|
||||
updateIds := []string{listUsers.Users[0].ID, listUsers.Users[1].ID}
|
||||
|
@@ -25,7 +25,12 @@ func webhookLogsTest(t *testing.T, s TestSetup) {
|
||||
assert.NoError(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", constants.AdminCookieName, h))
|
||||
|
||||
time.Sleep(1 * time.Second)
|
||||
webhookLogs, err := resolvers.WebhookLogsResolver(ctx, nil)
|
||||
fmt.Printf("webhookLogs=========== %+v \n", webhookLogs.WebhookLogs)
|
||||
time.Sleep(20 * time.Second)
|
||||
fmt.Println("total documents found", len(webhookLogs.WebhookLogs))
|
||||
|
||||
assert.NoError(t, err)
|
||||
assert.Greater(t, len(webhookLogs.WebhookLogs), 1)
|
||||
|
||||
|
Reference in New Issue
Block a user