TestWebhookLogs tests the _webhook_logs query
(t *testing.T)
| 13 | |
| 14 | // TestWebhookLogs tests the _webhook_logs query |
| 15 | func TestWebhookLogs(t *testing.T) { |
| 16 | cfg := getTestConfig() |
| 17 | ts := initTestSetup(t, cfg) |
| 18 | req, ctx := createContext(ts) |
| 19 | |
| 20 | t.Run("should fail without admin auth", func(t *testing.T) { |
| 21 | req.Header.Set("Cookie", "") |
| 22 | res, err := ts.GraphQLProvider.WebhookLogs(ctx, &model.ListWebhookLogRequest{}) |
| 23 | assert.Error(t, err) |
| 24 | assert.Nil(t, res) |
| 25 | }) |
| 26 | |
| 27 | t.Run("should list webhook logs with admin auth", func(t *testing.T) { |
| 28 | h, err := crypto.EncryptPassword(cfg.AdminSecret) |
| 29 | require.NoError(t, err) |
| 30 | req.Header.Set("Cookie", fmt.Sprintf("%s=%s", constants.AdminCookieName, h)) |
| 31 | |
| 32 | res, err := ts.GraphQLProvider.WebhookLogs(ctx, &model.ListWebhookLogRequest{}) |
| 33 | require.NoError(t, err) |
| 34 | assert.NotNil(t, res) |
| 35 | assert.NotNil(t, res.Pagination) |
| 36 | }) |
| 37 | } |
nothing calls this directly
no test coverage detected