Extend PostgreSQL implementation and unit tests on MongoDB storage

This commit is contained in:
2023-05-02 00:34:33 +02:00
parent 1bf02aa132
commit c6ba00b74f
18 changed files with 870 additions and 752 deletions

67
storage/storage_test.go Normal file
View File

@@ -0,0 +1,67 @@
package storage
import "github.com/google/uuid"
var account1 = Account{
ID: uuid.NewString(),
Namespace: "namespace",
Authentication: AccountAuth{
Local: &LocalAuth{
Username: Ptr("test"),
Password: "hashedpassword",
Email: Ptr("test@test.com"),
EmailValidation: &Validation{
Validated: true,
ValidationCode: "",
},
PhoneNumber: Ptr("+3312345678"),
PhoneNumberValidation: &Validation{
Validated: true,
ValidationCode: "",
},
},
},
Data: map[string]any{
"key1": "value1",
"key2": "value2",
},
Metadata: map[string]any{
"key1": "value1",
"key2": "value2",
},
}
var account2 = Account{
ID: uuid.NewString(),
Namespace: "test",
Authentication: AccountAuth{
Local: &LocalAuth{
Username: Ptr("test2"),
Password: "hashedpassword",
},
},
Data: map[string]any{
"key1": "value3",
"key2": "value4",
},
Metadata: map[string]any{
"key1": "value5",
"key2": "value6",
},
}
var account3 = Account{
ID: uuid.NewString(),
Namespace: "other_namespace",
Authentication: AccountAuth{
Local: nil,
},
Data: map[string]any{
"key1": "value3",
"key2": "value4",
},
Metadata: map[string]any{
"key1": "value5",
"key2": "value6",
},
}