You've already forked pocketbase
mirror of
https://github.com/pocketbase/pocketbase.git
synced 2025-11-23 22:55:37 +02:00
logs refactoring
This commit is contained in:
@@ -97,7 +97,6 @@ func NewTestApp(optTestDataDir ...string) (*TestApp, error) {
|
||||
app := core.NewBaseApp(core.BaseAppConfig{
|
||||
DataDir: tempDir,
|
||||
EncryptionEnv: "pb_test_env",
|
||||
IsDebug: false,
|
||||
})
|
||||
|
||||
// load data dir and db connections
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,49 +1,31 @@
|
||||
package tests
|
||||
|
||||
func MockRequestLogsData(app *TestApp) error {
|
||||
func MockLogsData(app *TestApp) error {
|
||||
_, err := app.LogsDB().NewQuery(`
|
||||
delete from {{_requests}};
|
||||
delete from {{_logs}};
|
||||
|
||||
insert into {{_requests}} (
|
||||
insert into {{_logs}} (
|
||||
[[id]],
|
||||
[[url]],
|
||||
[[method]],
|
||||
[[status]],
|
||||
[[auth]],
|
||||
[[userIp]],
|
||||
[[remoteIp]],
|
||||
[[referer]],
|
||||
[[userAgent]],
|
||||
[[meta]],
|
||||
[[level]],
|
||||
[[message]],
|
||||
[[data]],
|
||||
[[created]],
|
||||
[[updated]]
|
||||
)
|
||||
values
|
||||
(
|
||||
"873f2133-9f38-44fb-bf82-c8f53b310d91",
|
||||
"/test1",
|
||||
"get",
|
||||
200,
|
||||
"guest",
|
||||
"127.0.0.1",
|
||||
"127.0.0.1",
|
||||
"",
|
||||
"",
|
||||
"{}",
|
||||
0,
|
||||
"test_message1",
|
||||
'{"status":200}',
|
||||
"2022-05-01 10:00:00.123Z",
|
||||
"2022-05-01 10:00:00.123Z"
|
||||
),
|
||||
(
|
||||
"f2133873-44fb-9f38-bf82-c918f53b310d",
|
||||
"/test2",
|
||||
"post",
|
||||
400,
|
||||
"admin",
|
||||
"127.0.0.1",
|
||||
"127.0.0.1",
|
||||
"",
|
||||
"",
|
||||
'{"errorDetails":"error_details..."}',
|
||||
8,
|
||||
"test_message2",
|
||||
'{"status":400}',
|
||||
"2022-05-02 10:00:00.123Z",
|
||||
"2022-05-02 10:00:00.123Z"
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user