forked from pocketbase/pocketbase
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pocketbase#396] updated tests helpers
- Loading branch information
1 parent
b79a798
commit 4bc28ab
Showing
21 changed files
with
117 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,7 +119,7 @@ func TestAdminRequestPasswordReset(t *testing.T) { | |
Body: strings.NewReader(`{"email":"[email protected]"}`), | ||
Delay: 100 * time.Millisecond, | ||
ExpectedStatus: 204, | ||
BeforeFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { | ||
BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { | ||
// simulate recent password request | ||
admin, err := app.Dao().FindAdminByEmail("[email protected]") | ||
if err != nil { | ||
|
@@ -446,7 +446,7 @@ func TestAdminDelete(t *testing.T) { | |
RequestHeaders: map[string]string{ | ||
"Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", | ||
}, | ||
BeforeFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { | ||
BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { | ||
// delete all admins except the authorized one | ||
adminModel := &models.Admin{} | ||
_, err := app.Dao().DB().Delete(adminModel.TableName(), dbx.Not(dbx.HashExp{ | ||
|
@@ -483,7 +483,7 @@ func TestAdminCreate(t *testing.T) { | |
Method: http.MethodPost, | ||
Url: "/api/admins", | ||
Body: strings.NewReader(`{"email":"[email protected]","password":"1234567890","passwordConfirm":"1234567890","avatar":3}`), | ||
BeforeFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { | ||
BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { | ||
// delete all admins | ||
_, err := app.Dao().DB().NewQuery("DELETE FROM {{_admins}}").Execute() | ||
if err != nil { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.