GetAccounts

This commit is contained in:
2023-04-26 11:41:21 +02:00
parent ada858a738
commit cdda4b1c9c
2 changed files with 80 additions and 4 deletions

View File

@@ -10,6 +10,8 @@ import (
"testing"
)
// Tests must be run in order
var cfg *viper.Viper
func init() {
@@ -23,8 +25,8 @@ func init() {
func TestNewPostgresqlStorage(t *testing.T) {
storage, err := NewPostgresqlStorage(cfg)
storage.DbConnection.Exec("Delete from accounts;")
storage.DbConnection.Exec("Delete from account_auth;")
storage.DbConnection.Exec("Delete from account_auth ;")
storage.DbConnection.Exec("Delete from accounts ;")
if err != nil {
t.Errorf("error creating new PostgreSQL storage: %v", err)
}
@@ -261,3 +263,17 @@ func TestPostgresqlStorage_LocalAuthentication(t *testing.T) {
}
fmt.Println(accountByAll)
}
func TestPostgresqlStorage_GetAccounts(t *testing.T) {
db, err := NewPostgresqlStorage(cfg)
if err != nil {
t.Errorf("failed to create new psql connection")
}
accounts, err := db.GetAccounts([]string{"test_namespace", "salim", "namespace"})
if err != nil {
t.Errorf("Failed")
}
for _, account := range accounts {
fmt.Println(account)
}
}