lock the _mfas and _otps delete api rule, fixed flaky tests, fixed jsvm types example

This commit is contained in:
Gani Georgiev
2024-10-24 21:59:00 +03:00
parent 0b7741f1f7
commit 8c45d4d92d
13 changed files with 5639 additions and 5307 deletions

View File

@@ -170,7 +170,7 @@ func TestRecordCrudMFADelete(t *testing.T) {
t.Fatal(err)
}
},
ExpectedStatus: 404,
ExpectedStatus: 403,
ExpectedContent: []string{`"data":{}`},
ExpectedEvents: map[string]int{"*": 0},
},
@@ -187,7 +187,7 @@ func TestRecordCrudMFADelete(t *testing.T) {
t.Fatal(err)
}
},
ExpectedStatus: 404,
ExpectedStatus: 403,
ExpectedContent: []string{`"data":{}`},
ExpectedEvents: map[string]int{"*": 0},
},
@@ -204,6 +204,23 @@ func TestRecordCrudMFADelete(t *testing.T) {
t.Fatal(err)
}
},
ExpectedStatus: 403,
ExpectedContent: []string{`"data":{}`},
ExpectedEvents: map[string]int{"*": 0},
},
{
Name: "superusers auth",
Method: http.MethodDelete,
URL: "/api/collections/" + core.CollectionNameMFAs + "/records/user1_0",
Headers: map[string]string{
// superusers, test@example.com
"Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhdXRoIiwiY29sbGVjdGlvbklkIjoiX3BiY18zMzIzODY2MzM5IiwiZXhwIjoyNTI0NjA0NDYxLCJyZWZyZXNoYWJsZSI6dHJ1ZX0.v_bMAygr6hXPwD2DpPrFpNQ7dd68Q3pGstmYAsvNBJg",
},
BeforeTestFunc: func(t testing.TB, app *tests.TestApp, e *core.ServeEvent) {
if err := tests.StubMFARecords(app); err != nil {
t.Fatal(err)
}
},
ExpectedStatus: 204,
ExpectedEvents: map[string]int{
"*": 0,