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#31] replaced the initial admin create interactive cli wit…
…h Installer web page
- Loading branch information
1 parent
460c684
commit 0739e90
Showing
28 changed files
with
812 additions
and
1,064 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
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 |
---|---|---|
|
@@ -456,12 +456,37 @@ func TestAdminDelete(t *testing.T) { | |
func TestAdminCreate(t *testing.T) { | ||
scenarios := []tests.ApiScenario{ | ||
{ | ||
Name: "unauthorized", | ||
Name: "unauthorized (while having at least 1 existing admin)", | ||
Method: http.MethodPost, | ||
Url: "/api/admins", | ||
ExpectedStatus: 401, | ||
ExpectedContent: []string{`"data":{}`}, | ||
}, | ||
{ | ||
Name: "unauthorized (while having 0 existing admins)", | ||
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) { | ||
// delete all admins | ||
_, err := app.Dao().DB().NewQuery("DELETE FROM {{_admins}}").Execute() | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
}, | ||
ExpectedStatus: 200, | ||
ExpectedContent: []string{ | ||
`"id":`, | ||
`"email":"[email protected]"`, | ||
`"avatar":3`, | ||
}, | ||
ExpectedEvents: map[string]int{ | ||
"OnModelBeforeCreate": 1, | ||
"OnModelAfterCreate": 1, | ||
"OnAdminBeforeCreateRequest": 1, | ||
"OnAdminAfterCreateRequest": 1, | ||
}, | ||
}, | ||
{ | ||
Name: "authorized as user", | ||
Method: http.MethodPost, | ||
|
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.