GetAccountsByIds
This commit is contained in:
@@ -277,3 +277,49 @@ func TestPostgresqlStorage_GetAccounts(t *testing.T) {
|
||||
fmt.Println(account)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPostgresqlStorage_GetAccountsByIds(t *testing.T) {
|
||||
db, err := NewPostgresqlStorage(cfg)
|
||||
if err != nil {
|
||||
t.Errorf("failed to create new psql connection")
|
||||
}
|
||||
account := Account{
|
||||
ID: "772315f1-8113-486a-90c7-9073410065bd",
|
||||
Namespace: "oo",
|
||||
Authentication: AccountAuth{
|
||||
Local: LocalAuth{
|
||||
Username: "username",
|
||||
Password: "password",
|
||||
Email: "salim@test.com",
|
||||
EmailValidation: Validation{
|
||||
Validated: true,
|
||||
ValidationCode: "123",
|
||||
},
|
||||
PhoneNumber: "12345",
|
||||
PhoneNumberValidation: Validation{
|
||||
Validated: true,
|
||||
ValidationCode: "1233",
|
||||
},
|
||||
},
|
||||
},
|
||||
Data: map[string]any{
|
||||
"key1": "salim1",
|
||||
"key2": "salim2",
|
||||
},
|
||||
Metadata: map[string]any{
|
||||
"key1": "salim1",
|
||||
"key2": "salim2",
|
||||
},
|
||||
}
|
||||
err = db.CreateAccount(account)
|
||||
if err != nil {
|
||||
t.Errorf("Failed to create account")
|
||||
}
|
||||
accounts, err := db.GetAccountsByIds([]string{"772315f1-8113-486a-90c7-9073410065bd"})
|
||||
if err != nil {
|
||||
t.Errorf("Failed to get account by ID")
|
||||
}
|
||||
for _, acc := range accounts {
|
||||
fmt.Println(acc)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user