(t *testing.T)
| 86 | } |
| 87 | |
| 88 | func TestGetVCSUserSkipsGitLabBotAuthor(t *testing.T) { |
| 89 | server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { |
| 90 | w.Header().Set("Content-Type", "application/json") |
| 91 | _, err := w.Write([]byte(`{"author":{"id":4004,"username":"project_987_bot_a1b2c3","name":"Project bot"}}`)) |
| 92 | require.NoError(t, err) |
| 93 | })) |
| 94 | t.Cleanup(server.Close) |
| 95 | |
| 96 | t.Setenv("CI_MERGE_REQUEST_PROJECT_ID", "987") |
| 97 | t.Setenv("CI_MERGE_REQUEST_IID", "42") |
| 98 | t.Setenv("CI_API_V4_URL", server.URL+"/api/v4") |
| 99 | t.Setenv("CI_JOB_TOKEN", "job-token") |
| 100 | |
| 101 | require.Nil(t, getVCSUser(world.GitLab)) |
| 102 | } |
| 103 | |
| 104 | func TestGetVCSUserSkipsBitbucketWhenAuthorUnavailable(t *testing.T) { |
| 105 | t.Setenv("BITBUCKET_PR_ID", "10") |
nothing calls this directly
no test coverage detected