mirror of
https://github.com/pocketbase/pocketbase.git
synced 2025-02-09 12:14:03 +02:00
updated CHANGELOG and added t.Parallel to some of the tests
This commit is contained in:
parent
4f2492290e
commit
1fcc2d8683
19
CHANGELOG.md
19
CHANGELOG.md
@ -1,3 +1,22 @@
|
|||||||
|
## v0.20.3
|
||||||
|
|
||||||
|
- Fixed the `json` field query comparisons to work correctly with plain JSON values like `null`, `bool` `number`, etc. ([#4068](https://github.com/pocketbase/pocketbase/issues/4068)).
|
||||||
|
Since there are plans in the future to allow custom SQLite builds and also in some situations it may be useful to be able to distinguish `NULL` from `''`,
|
||||||
|
for the `json` fields (and for any other future non-standard field) we no longer apply `COALESCE` by default, aka.:
|
||||||
|
```
|
||||||
|
Dataset:
|
||||||
|
1) data: json(null)
|
||||||
|
2) data: json('')
|
||||||
|
|
||||||
|
For the filter "data = null" only 1) will resolve to TRUE.
|
||||||
|
For the filter "data = ''" only 2) will resolve to TRUE.
|
||||||
|
```
|
||||||
|
|
||||||
|
- Minor Go tests improvements
|
||||||
|
- Sorted the record cascade delete references to ensure that the delete operation will preserve the order of the fired events when running the tests.
|
||||||
|
- Marked some of the tests as safe for parallel execution to speed up a little the GitHub action build times.
|
||||||
|
|
||||||
|
|
||||||
## v0.20.2
|
## v0.20.2
|
||||||
|
|
||||||
- Added `sleep(milliseconds)` JSVM binding.
|
- Added `sleep(milliseconds)` JSVM binding.
|
||||||
|
@ -8,6 +8,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestAdminCreateCommand(t *testing.T) {
|
func TestAdminCreateCommand(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
app, _ := tests.NewTestApp()
|
app, _ := tests.NewTestApp()
|
||||||
defer app.Cleanup()
|
defer app.Cleanup()
|
||||||
|
|
||||||
|
@ -9,6 +9,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestSendAdminPasswordReset(t *testing.T) {
|
func TestSendAdminPasswordReset(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
testApp, _ := tests.NewTestApp()
|
testApp, _ := tests.NewTestApp()
|
||||||
defer testApp.Cleanup()
|
defer testApp.Cleanup()
|
||||||
|
|
||||||
|
@ -9,6 +9,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestSendRecordPasswordReset(t *testing.T) {
|
func TestSendRecordPasswordReset(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
testApp, _ := tests.NewTestApp()
|
testApp, _ := tests.NewTestApp()
|
||||||
defer testApp.Cleanup()
|
defer testApp.Cleanup()
|
||||||
|
|
||||||
@ -37,6 +39,8 @@ func TestSendRecordPasswordReset(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSendRecordVerification(t *testing.T) {
|
func TestSendRecordVerification(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
testApp, _ := tests.NewTestApp()
|
testApp, _ := tests.NewTestApp()
|
||||||
defer testApp.Cleanup()
|
defer testApp.Cleanup()
|
||||||
|
|
||||||
@ -62,6 +66,8 @@ func TestSendRecordVerification(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSendRecordChangeEmail(t *testing.T) {
|
func TestSendRecordChangeEmail(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
testApp, _ := tests.NewTestApp()
|
testApp, _ := tests.NewTestApp()
|
||||||
defer testApp.Cleanup()
|
defer testApp.Cleanup()
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestAdminTableName(t *testing.T) {
|
func TestAdminTableName(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
m := models.Admin{}
|
m := models.Admin{}
|
||||||
if m.TableName() != "_admins" {
|
if m.TableName() != "_admins" {
|
||||||
t.Fatalf("Unexpected table name, got %q", m.TableName())
|
t.Fatalf("Unexpected table name, got %q", m.TableName())
|
||||||
@ -15,6 +17,8 @@ func TestAdminTableName(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAdminValidatePassword(t *testing.T) {
|
func TestAdminValidatePassword(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
admin models.Admin
|
admin models.Admin
|
||||||
password string
|
password string
|
||||||
@ -61,6 +65,8 @@ func TestAdminValidatePassword(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAdminSetPassword(t *testing.T) {
|
func TestAdminSetPassword(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
m := models.Admin{
|
m := models.Admin{
|
||||||
// 123456
|
// 123456
|
||||||
PasswordHash: "$2a$10$SKk/Y/Yc925PBtsSYBvq3Ous9Jy18m4KTn6b/PQQ.Y9QVjy3o/Fv.",
|
PasswordHash: "$2a$10$SKk/Y/Yc925PBtsSYBvq3Ous9Jy18m4KTn6b/PQQ.Y9QVjy3o/Fv.",
|
||||||
@ -93,6 +99,8 @@ func TestAdminSetPassword(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAdminRefreshTokenKey(t *testing.T) {
|
func TestAdminRefreshTokenKey(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
m := models.Admin{TokenKey: "test"}
|
m := models.Admin{TokenKey: "test"}
|
||||||
|
|
||||||
m.RefreshTokenKey()
|
m.RefreshTokenKey()
|
||||||
|
@ -7,6 +7,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestBaseModelHasId(t *testing.T) {
|
func TestBaseModelHasId(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
model models.BaseModel
|
model models.BaseModel
|
||||||
expected bool
|
expected bool
|
||||||
@ -34,6 +36,8 @@ func TestBaseModelHasId(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestBaseModelId(t *testing.T) {
|
func TestBaseModelId(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
m := models.BaseModel{}
|
m := models.BaseModel{}
|
||||||
|
|
||||||
if m.GetId() != "" {
|
if m.GetId() != "" {
|
||||||
@ -54,6 +58,8 @@ func TestBaseModelId(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestBaseModelIsNew(t *testing.T) {
|
func TestBaseModelIsNew(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
m0 := models.BaseModel{}
|
m0 := models.BaseModel{}
|
||||||
m1 := models.BaseModel{Id: ""}
|
m1 := models.BaseModel{Id: ""}
|
||||||
m2 := models.BaseModel{Id: "test"}
|
m2 := models.BaseModel{Id: "test"}
|
||||||
@ -96,6 +102,8 @@ func TestBaseModelIsNew(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestBaseModelCreated(t *testing.T) {
|
func TestBaseModelCreated(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
m := models.BaseModel{}
|
m := models.BaseModel{}
|
||||||
|
|
||||||
if !m.GetCreated().IsZero() {
|
if !m.GetCreated().IsZero() {
|
||||||
@ -110,6 +118,8 @@ func TestBaseModelCreated(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestBaseModelUpdated(t *testing.T) {
|
func TestBaseModelUpdated(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
m := models.BaseModel{}
|
m := models.BaseModel{}
|
||||||
|
|
||||||
if !m.GetUpdated().IsZero() {
|
if !m.GetUpdated().IsZero() {
|
||||||
|
@ -11,6 +11,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestCollectionTableName(t *testing.T) {
|
func TestCollectionTableName(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
m := models.Collection{}
|
m := models.Collection{}
|
||||||
if m.TableName() != "_collections" {
|
if m.TableName() != "_collections" {
|
||||||
t.Fatalf("Unexpected table name, got %q", m.TableName())
|
t.Fatalf("Unexpected table name, got %q", m.TableName())
|
||||||
@ -18,6 +20,8 @@ func TestCollectionTableName(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCollectionBaseFilesPath(t *testing.T) {
|
func TestCollectionBaseFilesPath(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
m := models.Collection{}
|
m := models.Collection{}
|
||||||
|
|
||||||
m.RefreshId()
|
m.RefreshId()
|
||||||
@ -29,6 +33,8 @@ func TestCollectionBaseFilesPath(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCollectionIsBase(t *testing.T) {
|
func TestCollectionIsBase(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
collection models.Collection
|
collection models.Collection
|
||||||
expected bool
|
expected bool
|
||||||
@ -48,6 +54,8 @@ func TestCollectionIsBase(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCollectionIsAuth(t *testing.T) {
|
func TestCollectionIsAuth(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
collection models.Collection
|
collection models.Collection
|
||||||
expected bool
|
expected bool
|
||||||
@ -67,6 +75,8 @@ func TestCollectionIsAuth(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCollectionMarshalJSON(t *testing.T) {
|
func TestCollectionMarshalJSON(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
name string
|
name string
|
||||||
collection models.Collection
|
collection models.Collection
|
||||||
@ -109,6 +119,8 @@ func TestCollectionMarshalJSON(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCollectionBaseOptions(t *testing.T) {
|
func TestCollectionBaseOptions(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
name string
|
name string
|
||||||
collection models.Collection
|
collection models.Collection
|
||||||
@ -153,6 +165,8 @@ func TestCollectionBaseOptions(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCollectionAuthOptions(t *testing.T) {
|
func TestCollectionAuthOptions(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
options := types.JsonMap{"test": 123, "minPasswordLength": 4}
|
options := types.JsonMap{"test": 123, "minPasswordLength": 4}
|
||||||
expectedSerialization := `{"manageRule":null,"allowOAuth2Auth":false,"allowUsernameAuth":false,"allowEmailAuth":false,"requireEmail":false,"exceptEmailDomains":null,"onlyVerified":false,"onlyEmailDomains":null,"minPasswordLength":4}`
|
expectedSerialization := `{"manageRule":null,"allowOAuth2Auth":false,"allowUsernameAuth":false,"allowEmailAuth":false,"requireEmail":false,"exceptEmailDomains":null,"onlyVerified":false,"onlyEmailDomains":null,"minPasswordLength":4}`
|
||||||
|
|
||||||
@ -200,6 +214,8 @@ func TestCollectionAuthOptions(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCollectionViewOptions(t *testing.T) {
|
func TestCollectionViewOptions(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
options := types.JsonMap{"query": "select id from demo1", "minPasswordLength": 4}
|
options := types.JsonMap{"query": "select id from demo1", "minPasswordLength": 4}
|
||||||
expectedSerialization := `{"query":"select id from demo1"}`
|
expectedSerialization := `{"query":"select id from demo1"}`
|
||||||
|
|
||||||
@ -247,6 +263,8 @@ func TestCollectionViewOptions(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestNormalizeOptions(t *testing.T) {
|
func TestNormalizeOptions(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
name string
|
name string
|
||||||
collection models.Collection
|
collection models.Collection
|
||||||
@ -288,6 +306,8 @@ func TestNormalizeOptions(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDecodeOptions(t *testing.T) {
|
func TestDecodeOptions(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
m := models.Collection{
|
m := models.Collection{
|
||||||
Options: types.JsonMap{"test": 123},
|
Options: types.JsonMap{"test": 123},
|
||||||
}
|
}
|
||||||
@ -306,6 +326,8 @@ func TestDecodeOptions(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSetOptions(t *testing.T) {
|
func TestSetOptions(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
name string
|
name string
|
||||||
collection models.Collection
|
collection models.Collection
|
||||||
@ -357,6 +379,8 @@ func TestSetOptions(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCollectionBaseOptionsValidate(t *testing.T) {
|
func TestCollectionBaseOptionsValidate(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
opt := models.CollectionBaseOptions{}
|
opt := models.CollectionBaseOptions{}
|
||||||
if err := opt.Validate(); err != nil {
|
if err := opt.Validate(); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@ -364,6 +388,8 @@ func TestCollectionBaseOptionsValidate(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCollectionAuthOptionsValidate(t *testing.T) {
|
func TestCollectionAuthOptionsValidate(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
name string
|
name string
|
||||||
options models.CollectionAuthOptions
|
options models.CollectionAuthOptions
|
||||||
@ -451,6 +477,8 @@ func TestCollectionAuthOptionsValidate(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCollectionViewOptionsValidate(t *testing.T) {
|
func TestCollectionViewOptionsValidate(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
name string
|
name string
|
||||||
options models.CollectionViewOptions
|
options models.CollectionViewOptions
|
||||||
|
@ -7,6 +7,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestExternalAuthTableName(t *testing.T) {
|
func TestExternalAuthTableName(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
m := models.ExternalAuth{}
|
m := models.ExternalAuth{}
|
||||||
if m.TableName() != "_externalAuths" {
|
if m.TableName() != "_externalAuths" {
|
||||||
t.Fatalf("Unexpected table name, got %q", m.TableName())
|
t.Fatalf("Unexpected table name, got %q", m.TableName())
|
||||||
|
@ -7,6 +7,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestParamTableName(t *testing.T) {
|
func TestParamTableName(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
m := models.Param{}
|
m := models.Param{}
|
||||||
if m.TableName() != "_params" {
|
if m.TableName() != "_params" {
|
||||||
t.Fatalf("Unexpected table name, got %q", m.TableName())
|
t.Fatalf("Unexpected table name, got %q", m.TableName())
|
||||||
|
@ -15,6 +15,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestNewRecord(t *testing.T) {
|
func TestNewRecord(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
collection := &models.Collection{
|
collection := &models.Collection{
|
||||||
Name: "test_collection",
|
Name: "test_collection",
|
||||||
Schema: schema.NewSchema(
|
Schema: schema.NewSchema(
|
||||||
@ -37,6 +39,8 @@ func TestNewRecord(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestNewRecordFromNullStringMap(t *testing.T) {
|
func TestNewRecordFromNullStringMap(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
collection := &models.Collection{
|
collection := &models.Collection{
|
||||||
Name: "test",
|
Name: "test",
|
||||||
Schema: schema.NewSchema(
|
Schema: schema.NewSchema(
|
||||||
@ -200,6 +204,8 @@ func TestNewRecordFromNullStringMap(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestNewRecordsFromNullStringMaps(t *testing.T) {
|
func TestNewRecordsFromNullStringMaps(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
collection := &models.Collection{
|
collection := &models.Collection{
|
||||||
Name: "test",
|
Name: "test",
|
||||||
Schema: schema.NewSchema(
|
Schema: schema.NewSchema(
|
||||||
@ -310,6 +316,8 @@ func TestNewRecordsFromNullStringMaps(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordTableName(t *testing.T) {
|
func TestRecordTableName(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
collection := &models.Collection{}
|
collection := &models.Collection{}
|
||||||
collection.Name = "test"
|
collection.Name = "test"
|
||||||
collection.RefreshId()
|
collection.RefreshId()
|
||||||
@ -322,6 +330,8 @@ func TestRecordTableName(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordCollection(t *testing.T) {
|
func TestRecordCollection(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
collection := &models.Collection{}
|
collection := &models.Collection{}
|
||||||
collection.RefreshId()
|
collection.RefreshId()
|
||||||
|
|
||||||
@ -333,6 +343,8 @@ func TestRecordCollection(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordOriginalCopy(t *testing.T) {
|
func TestRecordOriginalCopy(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
m := models.NewRecord(&models.Collection{})
|
m := models.NewRecord(&models.Collection{})
|
||||||
m.Load(map[string]any{"f": "123"})
|
m.Load(map[string]any{"f": "123"})
|
||||||
|
|
||||||
@ -360,6 +372,8 @@ func TestRecordOriginalCopy(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordCleanCopy(t *testing.T) {
|
func TestRecordCleanCopy(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
m := models.NewRecord(&models.Collection{
|
m := models.NewRecord(&models.Collection{
|
||||||
Name: "cname",
|
Name: "cname",
|
||||||
Type: models.CollectionTypeAuth,
|
Type: models.CollectionTypeAuth,
|
||||||
@ -392,6 +406,8 @@ func TestRecordCleanCopy(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordSetAndGetExpand(t *testing.T) {
|
func TestRecordSetAndGetExpand(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
collection := &models.Collection{}
|
collection := &models.Collection{}
|
||||||
m := models.NewRecord(collection)
|
m := models.NewRecord(collection)
|
||||||
|
|
||||||
@ -409,6 +425,8 @@ func TestRecordSetAndGetExpand(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordMergeExpand(t *testing.T) {
|
func TestRecordMergeExpand(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
collection := &models.Collection{}
|
collection := &models.Collection{}
|
||||||
m := models.NewRecord(collection)
|
m := models.NewRecord(collection)
|
||||||
m.Id = "m"
|
m.Id = "m"
|
||||||
@ -501,6 +519,8 @@ func TestRecordMergeExpand(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordMergeExpandNilCheck(t *testing.T) {
|
func TestRecordMergeExpandNilCheck(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
collection := &models.Collection{}
|
collection := &models.Collection{}
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
@ -542,6 +562,8 @@ func TestRecordMergeExpandNilCheck(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordExpandedRel(t *testing.T) {
|
func TestRecordExpandedRel(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
collection := &models.Collection{}
|
collection := &models.Collection{}
|
||||||
|
|
||||||
main := models.NewRecord(collection)
|
main := models.NewRecord(collection)
|
||||||
@ -574,6 +596,8 @@ func TestRecordExpandedRel(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordExpandedAll(t *testing.T) {
|
func TestRecordExpandedAll(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
collection := &models.Collection{}
|
collection := &models.Collection{}
|
||||||
|
|
||||||
main := models.NewRecord(collection)
|
main := models.NewRecord(collection)
|
||||||
@ -606,6 +630,8 @@ func TestRecordExpandedAll(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordSchemaData(t *testing.T) {
|
func TestRecordSchemaData(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
collection := &models.Collection{
|
collection := &models.Collection{
|
||||||
Type: models.CollectionTypeAuth,
|
Type: models.CollectionTypeAuth,
|
||||||
Schema: schema.NewSchema(
|
Schema: schema.NewSchema(
|
||||||
@ -639,6 +665,8 @@ func TestRecordSchemaData(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordUnknownData(t *testing.T) {
|
func TestRecordUnknownData(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
collection := &models.Collection{
|
collection := &models.Collection{
|
||||||
Schema: schema.NewSchema(
|
Schema: schema.NewSchema(
|
||||||
&schema.SchemaField{
|
&schema.SchemaField{
|
||||||
@ -719,6 +747,8 @@ func TestRecordUnknownData(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordSetAndGet(t *testing.T) {
|
func TestRecordSetAndGet(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
collection := &models.Collection{
|
collection := &models.Collection{
|
||||||
Schema: schema.NewSchema(
|
Schema: schema.NewSchema(
|
||||||
&schema.SchemaField{
|
&schema.SchemaField{
|
||||||
@ -799,6 +829,8 @@ func TestRecordSetAndGet(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordGetBool(t *testing.T) {
|
func TestRecordGetBool(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
value any
|
value any
|
||||||
expected bool
|
expected bool
|
||||||
@ -830,6 +862,8 @@ func TestRecordGetBool(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordGetString(t *testing.T) {
|
func TestRecordGetString(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
value any
|
value any
|
||||||
expected string
|
expected string
|
||||||
@ -860,6 +894,8 @@ func TestRecordGetString(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordGetInt(t *testing.T) {
|
func TestRecordGetInt(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
value any
|
value any
|
||||||
expected int
|
expected int
|
||||||
@ -892,6 +928,8 @@ func TestRecordGetInt(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordGetFloat(t *testing.T) {
|
func TestRecordGetFloat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
value any
|
value any
|
||||||
expected float64
|
expected float64
|
||||||
@ -924,6 +962,8 @@ func TestRecordGetFloat(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordGetTime(t *testing.T) {
|
func TestRecordGetTime(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
nowTime := time.Now()
|
nowTime := time.Now()
|
||||||
testTime, _ := time.Parse(types.DefaultDateLayout, "2022-01-01 08:00:40.000Z")
|
testTime, _ := time.Parse(types.DefaultDateLayout, "2022-01-01 08:00:40.000Z")
|
||||||
|
|
||||||
@ -957,6 +997,8 @@ func TestRecordGetTime(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordGetDateTime(t *testing.T) {
|
func TestRecordGetDateTime(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
nowTime := time.Now()
|
nowTime := time.Now()
|
||||||
testTime, _ := time.Parse(types.DefaultDateLayout, "2022-01-01 08:00:40.000Z")
|
testTime, _ := time.Parse(types.DefaultDateLayout, "2022-01-01 08:00:40.000Z")
|
||||||
|
|
||||||
@ -990,6 +1032,8 @@ func TestRecordGetDateTime(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordGetStringSlice(t *testing.T) {
|
func TestRecordGetStringSlice(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
nowTime := time.Now()
|
nowTime := time.Now()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
@ -1031,6 +1075,8 @@ func TestRecordGetStringSlice(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordUnmarshalJSONField(t *testing.T) {
|
func TestRecordUnmarshalJSONField(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
collection := &models.Collection{
|
collection := &models.Collection{
|
||||||
Schema: schema.NewSchema(&schema.SchemaField{
|
Schema: schema.NewSchema(&schema.SchemaField{
|
||||||
Name: "field",
|
Name: "field",
|
||||||
@ -1086,6 +1132,8 @@ func TestRecordUnmarshalJSONField(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordBaseFilesPath(t *testing.T) {
|
func TestRecordBaseFilesPath(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
collection := &models.Collection{}
|
collection := &models.Collection{}
|
||||||
collection.RefreshId()
|
collection.RefreshId()
|
||||||
collection.Name = "test"
|
collection.Name = "test"
|
||||||
@ -1102,6 +1150,8 @@ func TestRecordBaseFilesPath(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordFindFileFieldByFile(t *testing.T) {
|
func TestRecordFindFileFieldByFile(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
collection := &models.Collection{
|
collection := &models.Collection{
|
||||||
Schema: schema.NewSchema(
|
Schema: schema.NewSchema(
|
||||||
&schema.SchemaField{
|
&schema.SchemaField{
|
||||||
@ -1159,6 +1209,8 @@ func TestRecordFindFileFieldByFile(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordLoadAndData(t *testing.T) {
|
func TestRecordLoadAndData(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
collection := &models.Collection{
|
collection := &models.Collection{
|
||||||
Schema: schema.NewSchema(
|
Schema: schema.NewSchema(
|
||||||
&schema.SchemaField{
|
&schema.SchemaField{
|
||||||
@ -1232,6 +1284,8 @@ func TestRecordLoadAndData(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordColumnValueMap(t *testing.T) {
|
func TestRecordColumnValueMap(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
collection := &models.Collection{
|
collection := &models.Collection{
|
||||||
Schema: schema.NewSchema(
|
Schema: schema.NewSchema(
|
||||||
&schema.SchemaField{
|
&schema.SchemaField{
|
||||||
@ -1319,6 +1373,8 @@ func TestRecordColumnValueMap(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordPublicExportAndMarshalJSON(t *testing.T) {
|
func TestRecordPublicExportAndMarshalJSON(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
collection := &models.Collection{
|
collection := &models.Collection{
|
||||||
Name: "c_name",
|
Name: "c_name",
|
||||||
Schema: schema.NewSchema(
|
Schema: schema.NewSchema(
|
||||||
@ -1463,6 +1519,8 @@ func TestRecordPublicExportAndMarshalJSON(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordUnmarshalJSON(t *testing.T) {
|
func TestRecordUnmarshalJSON(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
collection := &models.Collection{
|
collection := &models.Collection{
|
||||||
Schema: schema.NewSchema(
|
Schema: schema.NewSchema(
|
||||||
&schema.SchemaField{
|
&schema.SchemaField{
|
||||||
@ -1551,6 +1609,8 @@ func TestRecordUnmarshalJSON(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordReplaceModifers(t *testing.T) {
|
func TestRecordReplaceModifers(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
collection := &models.Collection{
|
collection := &models.Collection{
|
||||||
Schema: schema.NewSchema(
|
Schema: schema.NewSchema(
|
||||||
&schema.SchemaField{
|
&schema.SchemaField{
|
||||||
@ -1658,6 +1718,8 @@ func TestRecordReplaceModifers(t *testing.T) {
|
|||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
|
||||||
func TestRecordUsername(t *testing.T) {
|
func TestRecordUsername(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
collectionType string
|
collectionType string
|
||||||
expectError bool
|
expectError bool
|
||||||
@ -1699,6 +1761,8 @@ func TestRecordUsername(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordEmail(t *testing.T) {
|
func TestRecordEmail(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
collectionType string
|
collectionType string
|
||||||
expectError bool
|
expectError bool
|
||||||
@ -1740,6 +1804,8 @@ func TestRecordEmail(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordEmailVisibility(t *testing.T) {
|
func TestRecordEmailVisibility(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
collectionType string
|
collectionType string
|
||||||
value bool
|
value bool
|
||||||
@ -1782,6 +1848,8 @@ func TestRecordEmailVisibility(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordEmailVerified(t *testing.T) {
|
func TestRecordEmailVerified(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
collectionType string
|
collectionType string
|
||||||
value bool
|
value bool
|
||||||
@ -1824,6 +1892,8 @@ func TestRecordEmailVerified(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordTokenKey(t *testing.T) {
|
func TestRecordTokenKey(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
collectionType string
|
collectionType string
|
||||||
expectError bool
|
expectError bool
|
||||||
@ -1865,6 +1935,8 @@ func TestRecordTokenKey(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordRefreshTokenKey(t *testing.T) {
|
func TestRecordRefreshTokenKey(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
collectionType string
|
collectionType string
|
||||||
expectError bool
|
expectError bool
|
||||||
@ -1904,6 +1976,8 @@ func TestRecordRefreshTokenKey(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordLastResetSentAt(t *testing.T) {
|
func TestRecordLastResetSentAt(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
collectionType string
|
collectionType string
|
||||||
expectError bool
|
expectError bool
|
||||||
@ -1948,6 +2022,8 @@ func TestRecordLastResetSentAt(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordLastVerificationSentAt(t *testing.T) {
|
func TestRecordLastVerificationSentAt(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
collectionType string
|
collectionType string
|
||||||
expectError bool
|
expectError bool
|
||||||
@ -1992,6 +2068,8 @@ func TestRecordLastVerificationSentAt(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordPasswordHash(t *testing.T) {
|
func TestRecordPasswordHash(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
m := models.NewRecord(&models.Collection{})
|
m := models.NewRecord(&models.Collection{})
|
||||||
|
|
||||||
if v := m.PasswordHash(); v != "" {
|
if v := m.PasswordHash(); v != "" {
|
||||||
@ -2006,6 +2084,8 @@ func TestRecordPasswordHash(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordValidatePassword(t *testing.T) {
|
func TestRecordValidatePassword(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
// 123456
|
// 123456
|
||||||
hash := "$2a$10$YKU8mPP8sTE3xZrpuM.xQuq27KJ7aIJB2oUeKPsDDqZshbl5g5cDK"
|
hash := "$2a$10$YKU8mPP8sTE3xZrpuM.xQuq27KJ7aIJB2oUeKPsDDqZshbl5g5cDK"
|
||||||
|
|
||||||
@ -2034,6 +2114,8 @@ func TestRecordValidatePassword(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRecordSetPassword(t *testing.T) {
|
func TestRecordSetPassword(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
collectionType string
|
collectionType string
|
||||||
password string
|
password string
|
||||||
|
@ -11,6 +11,7 @@ const (
|
|||||||
RequestAuthRecord = "authRecord"
|
RequestAuthRecord = "authRecord"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Deprecated: Replaced by the Log model and will be removed in a future version.
|
||||||
type Request struct {
|
type Request struct {
|
||||||
BaseModel
|
BaseModel
|
||||||
|
|
||||||
|
@ -7,6 +7,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestRequestInfoHasModifierDataKeys(t *testing.T) {
|
func TestRequestInfoHasModifierDataKeys(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
scenarios := []struct {
|
scenarios := []struct {
|
||||||
name string
|
name string
|
||||||
requestInfo *models.RequestInfo
|
requestInfo *models.RequestInfo
|
||||||
|
@ -8,6 +8,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestNewAdminAuthToken(t *testing.T) {
|
func TestNewAdminAuthToken(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
app, _ := tests.NewTestApp()
|
app, _ := tests.NewTestApp()
|
||||||
defer app.Cleanup()
|
defer app.Cleanup()
|
||||||
|
|
||||||
@ -31,6 +33,8 @@ func TestNewAdminAuthToken(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestNewAdminResetPasswordToken(t *testing.T) {
|
func TestNewAdminResetPasswordToken(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
app, _ := tests.NewTestApp()
|
app, _ := tests.NewTestApp()
|
||||||
defer app.Cleanup()
|
defer app.Cleanup()
|
||||||
|
|
||||||
@ -54,6 +58,8 @@ func TestNewAdminResetPasswordToken(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestNewAdminFileToken(t *testing.T) {
|
func TestNewAdminFileToken(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
app, _ := tests.NewTestApp()
|
app, _ := tests.NewTestApp()
|
||||||
defer app.Cleanup()
|
defer app.Cleanup()
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestNewRecordAuthToken(t *testing.T) {
|
func TestNewRecordAuthToken(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
app, _ := tests.NewTestApp()
|
app, _ := tests.NewTestApp()
|
||||||
defer app.Cleanup()
|
defer app.Cleanup()
|
||||||
|
|
||||||
@ -31,6 +33,8 @@ func TestNewRecordAuthToken(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestNewRecordVerifyToken(t *testing.T) {
|
func TestNewRecordVerifyToken(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
app, _ := tests.NewTestApp()
|
app, _ := tests.NewTestApp()
|
||||||
defer app.Cleanup()
|
defer app.Cleanup()
|
||||||
|
|
||||||
@ -54,6 +58,8 @@ func TestNewRecordVerifyToken(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestNewRecordResetPasswordToken(t *testing.T) {
|
func TestNewRecordResetPasswordToken(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
app, _ := tests.NewTestApp()
|
app, _ := tests.NewTestApp()
|
||||||
defer app.Cleanup()
|
defer app.Cleanup()
|
||||||
|
|
||||||
@ -77,6 +83,8 @@ func TestNewRecordResetPasswordToken(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestNewRecordChangeEmailToken(t *testing.T) {
|
func TestNewRecordChangeEmailToken(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
app, _ := tests.NewTestApp()
|
app, _ := tests.NewTestApp()
|
||||||
defer app.Cleanup()
|
defer app.Cleanup()
|
||||||
|
|
||||||
@ -100,6 +108,8 @@ func TestNewRecordChangeEmailToken(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestNewRecordFileToken(t *testing.T) {
|
func TestNewRecordFileToken(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
app, _ := tests.NewTestApp()
|
app, _ := tests.NewTestApp()
|
||||||
defer app.Cleanup()
|
defer app.Cleanup()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user