Update tests
This commit is contained in:
@@ -28,7 +28,7 @@ func (p *provider) AddAuthenticator(ctx context.Context, authenticators *models.
|
||||
authenticatorsCollection, _ := p.db.Collection(ctx, models.Collections.Authenticators)
|
||||
meta, err := authenticatorsCollection.CreateDocument(arangoDriver.WithOverwrite(ctx), authenticators)
|
||||
if err != nil {
|
||||
return authenticators, err
|
||||
return nil, err
|
||||
}
|
||||
authenticators.Key = meta.Key
|
||||
authenticators.ID = meta.ID.String()
|
||||
@@ -42,7 +42,7 @@ func (p *provider) UpdateAuthenticator(ctx context.Context, authenticators *mode
|
||||
collection, _ := p.db.Collection(ctx, models.Collections.Authenticators)
|
||||
meta, err := collection.UpdateDocument(ctx, authenticators.Key, authenticators)
|
||||
if err != nil {
|
||||
return authenticators, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
authenticators.Key = meta.Key
|
||||
@@ -59,7 +59,7 @@ func (p *provider) GetAuthenticatorDetailsByUserId(ctx context.Context, userId s
|
||||
}
|
||||
cursor, err := p.db.Query(ctx, query, bindVars)
|
||||
if err != nil {
|
||||
return authenticators, err
|
||||
return nil, err
|
||||
}
|
||||
defer cursor.Close()
|
||||
for {
|
||||
@@ -71,7 +71,7 @@ func (p *provider) GetAuthenticatorDetailsByUserId(ctx context.Context, userId s
|
||||
}
|
||||
_, err := cursor.ReadDocument(ctx, &authenticators)
|
||||
if err != nil {
|
||||
return authenticators, err
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return authenticators, nil
|
||||
|
@@ -23,7 +23,7 @@ func (p *provider) AddEnv(ctx context.Context, env *models.Env) (*models.Env, er
|
||||
configCollection, _ := p.db.Collection(ctx, models.Collections.Env)
|
||||
meta, err := configCollection.CreateDocument(arangoDriver.WithOverwrite(ctx), env)
|
||||
if err != nil {
|
||||
return env, err
|
||||
return nil, err
|
||||
}
|
||||
env.Key = meta.Key
|
||||
env.ID = meta.ID.String()
|
||||
@@ -36,7 +36,7 @@ func (p *provider) UpdateEnv(ctx context.Context, env *models.Env) (*models.Env,
|
||||
collection, _ := p.db.Collection(ctx, models.Collections.Env)
|
||||
meta, err := collection.UpdateDocument(ctx, env.Key, env)
|
||||
if err != nil {
|
||||
return env, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
env.Key = meta.Key
|
||||
@@ -50,7 +50,7 @@ func (p *provider) GetEnv(ctx context.Context) (*models.Env, error) {
|
||||
query := fmt.Sprintf("FOR d in %s RETURN d", models.Collections.Env)
|
||||
cursor, err := p.db.Query(ctx, query, nil)
|
||||
if err != nil {
|
||||
return env, err
|
||||
return nil, err
|
||||
}
|
||||
defer cursor.Close()
|
||||
for {
|
||||
@@ -62,7 +62,7 @@ func (p *provider) GetEnv(ctx context.Context) (*models.Env, error) {
|
||||
}
|
||||
_, err := cursor.ReadDocument(ctx, &env)
|
||||
if err != nil {
|
||||
return env, err
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -27,7 +27,7 @@ func (p *provider) AddUser(ctx context.Context, user *models.User) (*models.User
|
||||
if user.Roles == "" {
|
||||
defaultRoles, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyDefaultRoles)
|
||||
if err != nil {
|
||||
return user, err
|
||||
return nil, err
|
||||
}
|
||||
user.Roles = defaultRoles
|
||||
}
|
||||
@@ -47,7 +47,7 @@ func (p *provider) AddUser(ctx context.Context, user *models.User) (*models.User
|
||||
userCollection, _ := p.db.Collection(ctx, models.Collections.User)
|
||||
meta, err := userCollection.CreateDocument(arangoDriver.WithOverwrite(ctx), user)
|
||||
if err != nil {
|
||||
return user, err
|
||||
return nil, err
|
||||
}
|
||||
user.Key = meta.Key
|
||||
user.ID = meta.ID.String()
|
||||
@@ -62,7 +62,7 @@ func (p *provider) UpdateUser(ctx context.Context, user *models.User) (*models.U
|
||||
collection, _ := p.db.Collection(ctx, models.Collections.User)
|
||||
meta, err := collection.UpdateDocument(ctx, user.Key, user)
|
||||
if err != nil {
|
||||
return user, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
user.Key = meta.Key
|
||||
@@ -129,19 +129,19 @@ func (p *provider) GetUserByEmail(ctx context.Context, email string) (*models.Us
|
||||
}
|
||||
cursor, err := p.db.Query(ctx, query, bindVars)
|
||||
if err != nil {
|
||||
return user, err
|
||||
return nil, err
|
||||
}
|
||||
defer cursor.Close()
|
||||
for {
|
||||
if !cursor.HasMore() {
|
||||
if user == nil {
|
||||
return user, fmt.Errorf("user not found")
|
||||
return nil, fmt.Errorf("user not found")
|
||||
}
|
||||
break
|
||||
}
|
||||
_, err := cursor.ReadDocument(ctx, &user)
|
||||
if err != nil {
|
||||
return user, err
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return user, nil
|
||||
@@ -156,19 +156,19 @@ func (p *provider) GetUserByID(ctx context.Context, id string) (*models.User, er
|
||||
}
|
||||
cursor, err := p.db.Query(ctx, query, bindVars)
|
||||
if err != nil {
|
||||
return user, err
|
||||
return nil, err
|
||||
}
|
||||
defer cursor.Close()
|
||||
for {
|
||||
if !cursor.HasMore() {
|
||||
if user == nil {
|
||||
return user, fmt.Errorf("user not found")
|
||||
return nil, fmt.Errorf("user not found")
|
||||
}
|
||||
break
|
||||
}
|
||||
_, err := cursor.ReadDocument(ctx, &user)
|
||||
if err != nil {
|
||||
return user, err
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return user, nil
|
||||
|
@@ -22,7 +22,7 @@ func (p *provider) AddVerificationRequest(ctx context.Context, verificationReque
|
||||
verificationRequestRequestCollection, _ := p.db.Collection(ctx, models.Collections.VerificationRequest)
|
||||
meta, err := verificationRequestRequestCollection.CreateDocument(ctx, verificationRequest)
|
||||
if err != nil {
|
||||
return verificationRequest, err
|
||||
return nil, err
|
||||
}
|
||||
verificationRequest.Key = meta.Key
|
||||
verificationRequest.ID = meta.ID.String()
|
||||
@@ -38,7 +38,7 @@ func (p *provider) GetVerificationRequestByToken(ctx context.Context, token stri
|
||||
}
|
||||
cursor, err := p.db.Query(ctx, query, bindVars)
|
||||
if err != nil {
|
||||
return verificationRequest, err
|
||||
return nil, err
|
||||
}
|
||||
defer cursor.Close()
|
||||
for {
|
||||
@@ -50,7 +50,7 @@ func (p *provider) GetVerificationRequestByToken(ctx context.Context, token stri
|
||||
}
|
||||
_, err := cursor.ReadDocument(ctx, &verificationRequest)
|
||||
if err != nil {
|
||||
return verificationRequest, err
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return verificationRequest, nil
|
||||
@@ -66,7 +66,7 @@ func (p *provider) GetVerificationRequestByEmail(ctx context.Context, email stri
|
||||
}
|
||||
cursor, err := p.db.Query(ctx, query, bindVars)
|
||||
if err != nil {
|
||||
return verificationRequest, err
|
||||
return nil, err
|
||||
}
|
||||
defer cursor.Close()
|
||||
for {
|
||||
@@ -78,7 +78,7 @@ func (p *provider) GetVerificationRequestByEmail(ctx context.Context, email stri
|
||||
}
|
||||
_, err := cursor.ReadDocument(ctx, &verificationRequest)
|
||||
if err != nil {
|
||||
return verificationRequest, err
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return verificationRequest, nil
|
||||
|
Reference in New Issue
Block a user