aboutsummaryrefslogtreecommitdiffstats
path: root/dashboard/app/public_json_api_test.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-10-11 13:17:50 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-10-15 08:34:09 +0000
commitb9fb2ea80e9852ae6465fcb3b822ca9ffa3306bd (patch)
tree6ef60254c3832271607cd34823308104ed8284cf /dashboard/app/public_json_api_test.go
parentbea340a021473d87bbbd5da6e88e575cc5e71cb0 (diff)
dashboard/api: add Client type
Diffstat (limited to 'dashboard/app/public_json_api_test.go')
-rw-r--r--dashboard/app/public_json_api_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/dashboard/app/public_json_api_test.go b/dashboard/app/public_json_api_test.go
index ebf943438..82cf9c320 100644
--- a/dashboard/app/public_json_api_test.go
+++ b/dashboard/app/public_json_api_test.go
@@ -7,6 +7,7 @@ import (
"fmt"
"testing"
+ "github.com/google/syzkaller/dashboard/api"
"github.com/google/syzkaller/dashboard/dashapi"
)
@@ -222,3 +223,30 @@ func TestJSONAPICauseBisection(t *testing.T) {
]
}`)
}
+
+func TestPublicJSONAPI(t *testing.T) {
+ c := NewCtx(t)
+ defer c.Close()
+
+ client := c.makeClient(clientPublic, keyPublic, true)
+ build := testBuild(1)
+ client.UploadBuild(build)
+ client.ReportCrash(testCrashWithRepro(build, 1))
+ rep := client.pollBug()
+ client.updateBug(rep.ID, dashapi.BugStatusUpstream, "")
+ _ = client.pollBug()
+
+ cli := c.makeAPIClient()
+ bugs, err := cli.BugGroups("access-public", api.BugGroupAll)
+ c.expectOK(err)
+ c.expectEQ(len(bugs), 1)
+ c.expectEQ(bugs[0].Title, "title1")
+
+ bug, err := cli.Bug(bugs[0].Link)
+ c.expectOK(err)
+ c.expectEQ(bug.Title, "title1")
+
+ config, err := cli.Text(bug.Crashes[0].KernelConfigLink)
+ c.expectOK(err)
+ c.expectEQ(config, []byte("config1"))
+}