MCPcopy Index your code
hub / github.com/bytebase/bytebase / createTestProject

Method createTestProject

backend/tests/webhook_helpers_test.go:112–125  ·  view source on GitHub ↗

createTestProject creates a fresh project (default AllowSelfApproval=true; approval-flow subtests call disableSelfApproval).

(ctx context.Context, t *testing.T, prefix string)

Source from the content-addressed store, hash-verified

110// createTestProject creates a fresh project (default AllowSelfApproval=true;
111// approval-flow subtests call disableSelfApproval).
112func (ctl *controller) createTestProject(ctx context.Context, t *testing.T, prefix string) *v1pb.Project {
113 t.Helper()
114 pid := generateRandomString(prefix)
115 resp, err := ctl.projectServiceClient.CreateProject(ctx, connect.NewRequest(&v1pb.CreateProjectRequest{
116 ProjectId: pid,
117 Project: &v1pb.Project{
118 Name: fmt.Sprintf("projects/%s", pid),
119 Title: prefix,
120 AllowSelfApproval: true,
121 },
122 }))
123 require.NoError(t, err)
124 return resp.Msg
125}
126
127// addWebhookForEvents adds a Slack webhook to the project subscribed to the
128// given event types only.

Callers 1

TestWebhookIntegrationFunction · 0.95

Calls 2

generateRandomStringFunction · 0.85
CreateProjectMethod · 0.65

Tested by

no test coverage detected