From 96ab51787a7934aea3e16e2fe40d0aa2746f6921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Svantesson?= Date: Thu, 10 Oct 2024 11:03:02 +0200 Subject: [PATCH 1/3] fix: pull request should be null for issues --- scm/driver/github/issue.go | 22 +++++++++++-------- scm/driver/github/testdata/issue_search.json | 5 ----- .../github/testdata/issue_search.json.golden | 5 ----- .../webhooks/issue_comment.json.golden | 5 ----- 4 files changed, 13 insertions(+), 24 deletions(-) diff --git a/scm/driver/github/issue.go b/scm/driver/github/issue.go index 109d5e061..480ecc08d 100644 --- a/scm/driver/github/issue.go +++ b/scm/driver/github/issue.go @@ -266,7 +266,7 @@ type issue struct { UpdatedAt time.Time `json:"updated_at"` // This will be non-nil if it is a pull request. - PullRequest pr `json:"pull_request,omitempty"` + PullRequest *pr `json:"pull_request,omitempty"` } type issueInput struct { @@ -349,6 +349,13 @@ func convertIssue(from *issue) *scm.Issue { Avatar: from.ClosedBy.AvatarURL, } } + var pullRequest *scm.PullRequest + if from.PullRequest != nil { + pullRequest = &scm.PullRequest{ + DiffLink: from.PullRequest.DiffURL, + Link: from.PullRequest.HTMLURL, + } + } return &scm.Issue{ Number: from.Number, Title: from.Title, @@ -362,14 +369,11 @@ func convertIssue(from *issue) *scm.Issue { Login: from.User.Login, Avatar: from.User.AvatarURL, }, - ClosedBy: closedBy, - Assignees: convertUsers(from.Assignees), - PullRequest: &scm.PullRequest{ - DiffLink: from.PullRequest.DiffURL, - Link: from.PullRequest.HTMLURL, - }, - Created: from.CreatedAt, - Updated: from.UpdatedAt, + ClosedBy: closedBy, + Assignees: convertUsers(from.Assignees), + PullRequest: pullRequest, + Created: from.CreatedAt, + Updated: from.UpdatedAt, } } diff --git a/scm/driver/github/testdata/issue_search.json b/scm/driver/github/testdata/issue_search.json index 1da7fba7e..ce1360312 100644 --- a/scm/driver/github/testdata/issue_search.json +++ b/scm/driver/github/testdata/issue_search.json @@ -48,11 +48,6 @@ "created_at": "2009-07-12T20:10:41Z", "updated_at": "2009-07-19T09:23:43Z", "closed_at": null, - "pull_request": { - "html_url": null, - "diff_url": null, - "patch_url": null - }, "body": "...", "score": 1.3859273 } diff --git a/scm/driver/github/testdata/issue_search.json.golden b/scm/driver/github/testdata/issue_search.json.golden index 33243f168..58c9b9589 100644 --- a/scm/driver/github/testdata/issue_search.json.golden +++ b/scm/driver/github/testdata/issue_search.json.golden @@ -35,11 +35,6 @@ "Link": "", "Created": "0001-01-01T00:00:00Z", "Updated": "0001-01-01T00:00:00Z" - }, - "PullRequest": { - "html_url": null, - "diff_url": null, - "patch_url": null } } ] diff --git a/scm/driver/github/testdata/webhooks/issue_comment.json.golden b/scm/driver/github/testdata/webhooks/issue_comment.json.golden index 085f87cb2..47c28045c 100644 --- a/scm/driver/github/testdata/webhooks/issue_comment.json.golden +++ b/scm/driver/github/testdata/webhooks/issue_comment.json.golden @@ -27,11 +27,6 @@ "Labels": [ "bug" ], - "PullRequest": { - "html_url": null, - "diff_url": null, - "patch_url": null - }, "Closed": false, "Locked": false, "Author": { From 7a98a8988c00efa7fcd4eb2055db025db33463b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Svantesson?= Date: Thu, 10 Oct 2024 11:07:03 +0200 Subject: [PATCH 2/3] fix: readable diffs Make diffs iun test failures easier to interpret --- scm/driver/azure/content_test.go | 4 ++-- scm/driver/azure/git_test.go | 10 ++++----- scm/driver/azure/pr_test.go | 6 +++--- scm/driver/azure/repo_test.go | 8 +++---- scm/driver/bitbucket/content_test.go | 2 +- scm/driver/bitbucket/git_test.go | 16 +++++++------- scm/driver/bitbucket/org_test.go | 4 ++-- scm/driver/bitbucket/pr_test.go | 6 +++--- scm/driver/bitbucket/repo_test.go | 20 ++++++++--------- scm/driver/bitbucket/user_test.go | 4 ++-- scm/driver/gitea/git_test.go | 10 ++++----- scm/driver/gitea/issue_test.go | 14 ++++++------ scm/driver/gitea/milestone_test.go | 8 +++---- scm/driver/gitea/org_test.go | 4 ++-- scm/driver/gitea/pr_test.go | 8 +++---- scm/driver/gitea/release_test.go | 12 +++++------ scm/driver/gitea/repo_test.go | 16 +++++++------- scm/driver/gitea/user_test.go | 4 ++-- scm/driver/github/app_test.go | 2 +- scm/driver/github/content_test.go | 4 ++-- scm/driver/github/deploy_test.go | 12 +++++------ scm/driver/github/git_test.go | 16 +++++++------- scm/driver/github/issue_test.go | 18 ++++++++-------- scm/driver/github/milestone_test.go | 8 +++---- scm/driver/github/org_test.go | 10 ++++----- scm/driver/github/pr_test.go | 10 ++++----- scm/driver/github/release_test.go | 8 +++---- scm/driver/github/repo_test.go | 26 +++++++++++----------- scm/driver/github/review_test.go | 14 ++++++------ scm/driver/github/user_test.go | 6 +++--- scm/driver/gitlab/content_test.go | 4 ++-- scm/driver/gitlab/git_test.go | 18 ++++++++-------- scm/driver/gitlab/issue_test.go | 16 +++++++------- scm/driver/gitlab/milestone_test.go | 8 +++---- scm/driver/gitlab/org_test.go | 4 ++-- scm/driver/gitlab/pr_test.go | 16 +++++++------- scm/driver/gitlab/release_test.go | 8 +++---- scm/driver/gitlab/repo_test.go | 32 ++++++++++++++-------------- scm/driver/gitlab/user_test.go | 4 ++-- scm/driver/gogs/git_test.go | 6 +++--- scm/driver/gogs/issue_test.go | 10 ++++----- scm/driver/gogs/org_test.go | 4 ++-- scm/driver/gogs/repo_test.go | 12 +++++------ scm/driver/gogs/user_test.go | 4 ++-- scm/driver/stash/content_test.go | 2 +- scm/driver/stash/git_test.go | 14 ++++++------ scm/driver/stash/org_test.go | 4 ++-- scm/driver/stash/pr_test.go | 20 ++++++++--------- scm/driver/stash/repo_test.go | 30 +++++++++++++------------- scm/driver/stash/user_test.go | 4 ++-- scm/transport/oauth1/encode_test.go | 2 +- scm/transport/oauth1/sort_test.go | 2 +- scm/transport/oauth2/refresh_test.go | 2 +- 53 files changed, 258 insertions(+), 258 deletions(-) diff --git a/scm/driver/azure/content_test.go b/scm/driver/azure/content_test.go index ea9116c94..dc5513ed6 100644 --- a/scm/driver/azure/content_test.go +++ b/scm/driver/azure/content_test.go @@ -37,7 +37,7 @@ func TestContentFind(t *testing.T) { raw, _ := os.ReadFile("testdata/content.json.golden") _ = json.Unmarshal(raw, want) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -165,7 +165,7 @@ func TestContentList(t *testing.T) { raw, _ := os.ReadFile("testdata/content_list.json.golden") _ = json.Unmarshal(raw, &want) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/azure/git_test.go b/scm/driver/azure/git_test.go index a45cb2b2b..a59a9350f 100644 --- a/scm/driver/azure/git_test.go +++ b/scm/driver/azure/git_test.go @@ -38,7 +38,7 @@ func TestGitFindCommit(t *testing.T) { _ = json.Unmarshal(raw, &want) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -74,7 +74,7 @@ func TestGitCreateRef(t *testing.T) { raw, _ := os.ReadFile("testdata/branch_create.json.golden") _ = json.Unmarshal(raw, &want) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -101,7 +101,7 @@ func TestGitListCommits(t *testing.T) { raw, _ := os.ReadFile("testdata/commits.json.golden") _ = json.Unmarshal(raw, &want) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -127,7 +127,7 @@ func TestGitListBranches(t *testing.T) { raw, _ := os.ReadFile("testdata/branches.json.golden") _ = json.Unmarshal(raw, &want) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -153,7 +153,7 @@ func TestGitCompareCommits(t *testing.T) { raw, _ := os.ReadFile("testdata/compare.json.golden") _ = json.Unmarshal(raw, &want) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/azure/pr_test.go b/scm/driver/azure/pr_test.go index d40d8feb3..b1ef11b2c 100644 --- a/scm/driver/azure/pr_test.go +++ b/scm/driver/azure/pr_test.go @@ -43,7 +43,7 @@ func TestPullCreate(t *testing.T) { raw, _ := os.ReadFile("testdata/pr_active.json.golden") _ = json.Unmarshal(raw, want) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -69,7 +69,7 @@ func TestPullFind(t *testing.T) { raw, _ := os.ReadFile("testdata/pr_active.json.golden") _ = json.Unmarshal(raw, want) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -166,7 +166,7 @@ func TestPullListCommits(t *testing.T) { raw, _ := os.ReadFile("testdata/commits.json.golden") _ = json.Unmarshal(raw, &want) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/azure/repo_test.go b/scm/driver/azure/repo_test.go index 86a10c132..0061df639 100644 --- a/scm/driver/azure/repo_test.go +++ b/scm/driver/azure/repo_test.go @@ -39,7 +39,7 @@ func TestRepositoryListOrgAndProject(t *testing.T) { t.Error(jsonErr) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -68,7 +68,7 @@ func TestRepositoryListOrgOnly(t *testing.T) { t.Error(jsonErr) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -97,7 +97,7 @@ func TestRepositoryFind(t *testing.T) { t.Error(jsonErr) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -136,7 +136,7 @@ func TestRepositoryCreate(t *testing.T) { t.Error(jsonErr) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/bitbucket/content_test.go b/scm/driver/bitbucket/content_test.go index 264a26cc5..35a15ca0d 100644 --- a/scm/driver/bitbucket/content_test.go +++ b/scm/driver/bitbucket/content_test.go @@ -38,7 +38,7 @@ func TestContentFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/bitbucket/git_test.go b/scm/driver/bitbucket/git_test.go index ac8e8858a..502153063 100644 --- a/scm/driver/bitbucket/git_test.go +++ b/scm/driver/bitbucket/git_test.go @@ -38,7 +38,7 @@ func TestGitFindCommit(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -66,7 +66,7 @@ func TestGitFindBranch(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -94,7 +94,7 @@ func TestGitFindTag(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -124,7 +124,7 @@ func TestGitListCommits(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -156,7 +156,7 @@ func TestGitListBranches(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -188,7 +188,7 @@ func TestGitListTags(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -220,7 +220,7 @@ func TestGitListChanges(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -250,7 +250,7 @@ func TestGitCompareCommits(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/bitbucket/org_test.go b/scm/driver/bitbucket/org_test.go index c24aec074..c14408cac 100644 --- a/scm/driver/bitbucket/org_test.go +++ b/scm/driver/bitbucket/org_test.go @@ -35,7 +35,7 @@ func TestOrganizationFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -62,7 +62,7 @@ func TestOrganizationList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/bitbucket/pr_test.go b/scm/driver/bitbucket/pr_test.go index a0c283504..ddf56e5ec 100644 --- a/scm/driver/bitbucket/pr_test.go +++ b/scm/driver/bitbucket/pr_test.go @@ -46,7 +46,7 @@ func TestPullList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) @@ -79,7 +79,7 @@ func TestPullListChanges(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -130,7 +130,7 @@ func TestPullCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) data, err := json.Marshal(got) diff --git a/scm/driver/bitbucket/repo_test.go b/scm/driver/bitbucket/repo_test.go index 911bcb6f7..ba447732e 100644 --- a/scm/driver/bitbucket/repo_test.go +++ b/scm/driver/bitbucket/repo_test.go @@ -39,7 +39,7 @@ func TestRepositoryFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -88,7 +88,7 @@ func TestListCollaborators(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -117,7 +117,7 @@ func TestRepositoryPerms(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -170,7 +170,7 @@ func TestRepositoryList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -204,7 +204,7 @@ func TestRepositoryListOrganisation(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -235,7 +235,7 @@ func TestStatusList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -275,7 +275,7 @@ func TestStatusCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -304,7 +304,7 @@ func TestRepositoryHookFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -335,7 +335,7 @@ func TestRepositoryHookList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -378,7 +378,7 @@ func TestRepositoryHookCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/bitbucket/user_test.go b/scm/driver/bitbucket/user_test.go index c88bd826f..0cccb21f1 100644 --- a/scm/driver/bitbucket/user_test.go +++ b/scm/driver/bitbucket/user_test.go @@ -38,7 +38,7 @@ func TestUserFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -66,7 +66,7 @@ func TestUserLoginFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/gitea/git_test.go b/scm/driver/gitea/git_test.go index 77f1fcfc0..efa3d0518 100644 --- a/scm/driver/gitea/git_test.go +++ b/scm/driver/gitea/git_test.go @@ -49,7 +49,7 @@ func TestCommitFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -77,7 +77,7 @@ func TestCommitList(t *testing.T) { err = json.Unmarshal(raw, &want) assert.NoError(t, err) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -127,7 +127,7 @@ func TestBranchFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -158,7 +158,7 @@ func TestBranchList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -203,7 +203,7 @@ func TestTagList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/gitea/issue_test.go b/scm/driver/gitea/issue_test.go index 6c0bc1993..5c7f6507e 100644 --- a/scm/driver/gitea/issue_test.go +++ b/scm/driver/gitea/issue_test.go @@ -43,7 +43,7 @@ func TestIssueFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -75,7 +75,7 @@ func TestIssueList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -112,7 +112,7 @@ func TestIssueCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -200,7 +200,7 @@ func TestIssueCommentFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -231,7 +231,7 @@ func TestIssueCommentList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -263,7 +263,7 @@ func TestIssueCommentCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -315,7 +315,7 @@ func TestIssueListLabels(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/gitea/milestone_test.go b/scm/driver/gitea/milestone_test.go index 82447562c..22afc46c2 100644 --- a/scm/driver/gitea/milestone_test.go +++ b/scm/driver/gitea/milestone_test.go @@ -35,7 +35,7 @@ func TestMilestoneFind(t *testing.T) { err = json.Unmarshal(raw, want) assert.NoError(t, err) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -64,7 +64,7 @@ func TestMilestoneList(t *testing.T) { err = json.Unmarshal(raw, &want) assert.NoError(t, err) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -102,7 +102,7 @@ func TestMilestoneCreate(t *testing.T) { err = json.Unmarshal(raw, want) assert.NoError(t, err) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -138,7 +138,7 @@ func TestMilestoneUpdate(t *testing.T) { err = json.Unmarshal(raw, want) assert.NoError(t, err) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/gitea/org_test.go b/scm/driver/gitea/org_test.go index 598351fd8..bb2a0ee6b 100644 --- a/scm/driver/gitea/org_test.go +++ b/scm/driver/gitea/org_test.go @@ -40,7 +40,7 @@ func TestOrgFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -71,7 +71,7 @@ func TestOrgList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/gitea/pr_test.go b/scm/driver/gitea/pr_test.go index 1e20f179d..b66f43c84 100644 --- a/scm/driver/gitea/pr_test.go +++ b/scm/driver/gitea/pr_test.go @@ -45,7 +45,7 @@ func TestPullRequestFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -76,7 +76,7 @@ func TestPullRequestList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -165,7 +165,7 @@ func TestPullRequestChanges(t *testing.T) { err = json.Unmarshal(raw, &want) assert.NoError(t, err) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -203,7 +203,7 @@ func TestPullCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/gitea/release_test.go b/scm/driver/gitea/release_test.go index f22fb772e..7954bdad8 100644 --- a/scm/driver/gitea/release_test.go +++ b/scm/driver/gitea/release_test.go @@ -18,7 +18,7 @@ func TestConvertAPIURLToHTMLURL(t *testing.T) { got := ConvertAPIURLToHTMLURL("https://try.gitea.com/api/v1/repos/octocat/Hello-World/123", "v1.0.0") want := "https://try.gitea.com/octocat/Hello-World/releases/tag/v1.0.0" - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) @@ -35,7 +35,7 @@ func TestConvertAPIURLToHTMLURLEmptyLinkWhenURLParseFails(t *testing.T) { got := ConvertAPIURLToHTMLURL(url, "v1.0.0") want := "" - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) @@ -71,7 +71,7 @@ func TestReleaseFind(t *testing.T) { err = json.Unmarshal(raw, want) assert.NoError(t, err) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) @@ -111,7 +111,7 @@ func TestReleaseList(t *testing.T) { err = json.Unmarshal(raw, &want) assert.NoError(t, err) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) @@ -159,7 +159,7 @@ func TestReleaseCreate(t *testing.T) { err = json.Unmarshal(raw, want) assert.NoError(t, err) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) @@ -206,7 +206,7 @@ func TestReleaseUpdate(t *testing.T) { err = json.Unmarshal(raw, want) assert.NoError(t, err) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/gitea/repo_test.go b/scm/driver/gitea/repo_test.go index 602d3fc0e..ffb80a2c6 100644 --- a/scm/driver/gitea/repo_test.go +++ b/scm/driver/gitea/repo_test.go @@ -43,7 +43,7 @@ func TestRepoFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -104,7 +104,7 @@ func TestRepoList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -159,7 +159,7 @@ func TestHookFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -190,7 +190,7 @@ func TestHookList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -222,7 +222,7 @@ func TestHookCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -300,7 +300,7 @@ func TestHookEvents(t *testing.T) { } for _, test := range tests { got, want := convertHookEvent(test.in), test.out - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -336,7 +336,7 @@ func TestStatusList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -373,7 +373,7 @@ func TestStatusCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/gitea/user_test.go b/scm/driver/gitea/user_test.go index 1b9fb39d9..35ad1fb58 100644 --- a/scm/driver/gitea/user_test.go +++ b/scm/driver/gitea/user_test.go @@ -40,7 +40,7 @@ func TestUserFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -70,7 +70,7 @@ func TestUserLoginFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/github/app_test.go b/scm/driver/github/app_test.go index f4305ce26..202a7b483 100644 --- a/scm/driver/github/app_test.go +++ b/scm/driver/github/app_test.go @@ -42,7 +42,7 @@ func TestAppRepositoryInstallation(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) diff --git a/scm/driver/github/content_test.go b/scm/driver/github/content_test.go index bae2cbeae..a6b2f1473 100644 --- a/scm/driver/github/content_test.go +++ b/scm/driver/github/content_test.go @@ -46,7 +46,7 @@ func TestContentFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -85,7 +85,7 @@ func TestContentList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) diff --git a/scm/driver/github/deploy_test.go b/scm/driver/github/deploy_test.go index 6dbd72a98..f59f00a2a 100644 --- a/scm/driver/github/deploy_test.go +++ b/scm/driver/github/deploy_test.go @@ -39,7 +39,7 @@ func TestDeploymentFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) @@ -98,7 +98,7 @@ func TestDeploymentList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) @@ -136,7 +136,7 @@ func TestDeploymentCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) @@ -174,7 +174,7 @@ func TestDeploymentStatusList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) @@ -210,7 +210,7 @@ func TestDeploymentStatusFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) @@ -247,7 +247,7 @@ func TestDeploymentStatusCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) diff --git a/scm/driver/github/git_test.go b/scm/driver/github/git_test.go index b91f005dd..013b46107 100644 --- a/scm/driver/github/git_test.go +++ b/scm/driver/github/git_test.go @@ -41,7 +41,7 @@ func TestGitFindCommit(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -74,7 +74,7 @@ func TestGitFindBranch(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -119,7 +119,7 @@ func TestGitListCommits(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -156,7 +156,7 @@ func TestGitListBranches(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -193,7 +193,7 @@ func TestGitListTags(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -227,7 +227,7 @@ func TestGitListChanges(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -260,7 +260,7 @@ func TestGitCompareCommits(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -293,7 +293,7 @@ func TestGitCreateRef(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/github/issue_test.go b/scm/driver/github/issue_test.go index 79b6d841a..8503bf92f 100644 --- a/scm/driver/github/issue_test.go +++ b/scm/driver/github/issue_test.go @@ -40,7 +40,7 @@ func TestIssueFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -73,7 +73,7 @@ func TestIssueCommentFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -110,7 +110,7 @@ func TestIssueList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -153,7 +153,7 @@ func TestIssueSearch(t *testing.T) { if err != nil { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -195,7 +195,7 @@ func TestIssuePPRSearch(t *testing.T) { data, _ := json.Marshal(got) t.Log(string(data)) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -232,7 +232,7 @@ func TestIssueListComments(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -271,7 +271,7 @@ func TestIssueCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -308,7 +308,7 @@ func TestIssueCreateComment(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -367,7 +367,7 @@ func TestIssueEditComment(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/github/milestone_test.go b/scm/driver/github/milestone_test.go index de4895e76..0e7f08e87 100644 --- a/scm/driver/github/milestone_test.go +++ b/scm/driver/github/milestone_test.go @@ -35,7 +35,7 @@ func TestMilestoneFind(t *testing.T) { err = json.Unmarshal(raw, want) assert.NoError(t, err) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -69,7 +69,7 @@ func TestMilestoneList(t *testing.T) { err = json.Unmarshal(raw, &want) assert.NoError(t, err) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -109,7 +109,7 @@ func TestMilestoneCreate(t *testing.T) { err = json.Unmarshal(raw, want) assert.NoError(t, err) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -149,7 +149,7 @@ func TestMilestoneUpdate(t *testing.T) { err = json.Unmarshal(raw, want) assert.NoError(t, err) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/github/org_test.go b/scm/driver/github/org_test.go index 72329edda..9bb640be1 100644 --- a/scm/driver/github/org_test.go +++ b/scm/driver/github/org_test.go @@ -43,7 +43,7 @@ func TestOrganizationFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -79,7 +79,7 @@ func TestOrganizationList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -118,7 +118,7 @@ func TestTeamList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -159,7 +159,7 @@ func TestTeamMembers(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -196,7 +196,7 @@ func TestOrgMembers(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/github/pr_test.go b/scm/driver/github/pr_test.go index 8ebddb64a..01165413e 100644 --- a/scm/driver/github/pr_test.go +++ b/scm/driver/github/pr_test.go @@ -40,7 +40,7 @@ func TestPullFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -77,7 +77,7 @@ func TestPullList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -112,7 +112,7 @@ func TestPullListChanges(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -222,7 +222,7 @@ func TestPullCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -264,7 +264,7 @@ func TestPullUpdate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/github/release_test.go b/scm/driver/github/release_test.go index fd9d11323..8c1e87a5d 100644 --- a/scm/driver/github/release_test.go +++ b/scm/driver/github/release_test.go @@ -34,7 +34,7 @@ func TestReleaseFind(t *testing.T) { err = json.Unmarshal(raw, want) assert.NoError(t, err) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) @@ -72,7 +72,7 @@ func TestReleaseList(t *testing.T) { err = json.Unmarshal(raw, &want) assert.NoError(t, err) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) @@ -114,7 +114,7 @@ func TestReleaseCreate(t *testing.T) { err = json.Unmarshal(raw, want) assert.NoError(t, err) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) @@ -156,7 +156,7 @@ func TestReleaseUpdate(t *testing.T) { err = json.Unmarshal(raw, want) assert.NoError(t, err) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/github/repo_test.go b/scm/driver/github/repo_test.go index 5730c6d95..7e9d53219 100644 --- a/scm/driver/github/repo_test.go +++ b/scm/driver/github/repo_test.go @@ -39,7 +39,7 @@ func TestRepositoryFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -130,7 +130,7 @@ func TestRepositoryList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -167,7 +167,7 @@ func TestStatusList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -205,7 +205,7 @@ func TestCombinedStatus(t *testing.T) { t.Fatal(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -246,7 +246,7 @@ func TestStatusCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -279,7 +279,7 @@ func TestRepositoryHookFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -307,7 +307,7 @@ func TestRepositoryFindUserPermission(t *testing.T) { want := "admin" - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -343,7 +343,7 @@ func TestRepositoryHookList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -408,7 +408,7 @@ func TestRepositoryHookCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -448,7 +448,7 @@ func TestRepositoryHookUpdate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -486,7 +486,7 @@ func TestRepositoryCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) @@ -528,7 +528,7 @@ func TestRepositoryFork(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) @@ -675,7 +675,7 @@ func TestHookEvents(t *testing.T) { } for i, test := range tests { got, want := convertHookEvents(test.in), test.out - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results at index %d", i) t.Log(diff) } diff --git a/scm/driver/github/review_test.go b/scm/driver/github/review_test.go index d2f06a1dc..9d04ea23a 100644 --- a/scm/driver/github/review_test.go +++ b/scm/driver/github/review_test.go @@ -39,7 +39,7 @@ func TestReviewFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -75,7 +75,7 @@ func TestReviewList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -123,7 +123,7 @@ func TestReviewCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -179,7 +179,7 @@ func TestReviewListComments(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -214,7 +214,7 @@ func TestReviewUpdate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -252,7 +252,7 @@ func TestReviewSubmit(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -286,7 +286,7 @@ func TestReviewDismiss(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/github/user_test.go b/scm/driver/github/user_test.go index 018732d55..81120436f 100644 --- a/scm/driver/github/user_test.go +++ b/scm/driver/github/user_test.go @@ -43,7 +43,7 @@ func TestUserFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -78,7 +78,7 @@ func TestUserLoginFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) err := json.NewEncoder(os.Stdout).Encode(got) @@ -143,7 +143,7 @@ func TestUserListInvitations(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) err := json.NewEncoder(os.Stdout).Encode(got) diff --git a/scm/driver/gitlab/content_test.go b/scm/driver/gitlab/content_test.go index 0202b49a4..c62532ead 100644 --- a/scm/driver/gitlab/content_test.go +++ b/scm/driver/gitlab/content_test.go @@ -48,7 +48,7 @@ func TestContentFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -85,7 +85,7 @@ func TestContentList(t *testing.T) { err = json.Unmarshal(raw, &want) require.NoError(t, err, "failed to unmarshal json") - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) diff --git a/scm/driver/gitlab/git_test.go b/scm/driver/gitlab/git_test.go index ffeba44eb..1f0ad50bd 100644 --- a/scm/driver/gitlab/git_test.go +++ b/scm/driver/gitlab/git_test.go @@ -45,7 +45,7 @@ func TestGitFindCommit(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -78,7 +78,7 @@ func TestGitFindBranch(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -111,7 +111,7 @@ func TestGitFindTag(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -148,7 +148,7 @@ func TestGitListCommits(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -185,7 +185,7 @@ func TestGitListBranches(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -222,7 +222,7 @@ func TestGitListTags(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -256,7 +256,7 @@ func TestGitListChanges(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -291,7 +291,7 @@ func TestGitCompareCommits(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -325,7 +325,7 @@ func TestGitCreateRef(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/gitlab/issue_test.go b/scm/driver/gitlab/issue_test.go index 71e0e7a4c..1222b92d7 100644 --- a/scm/driver/gitlab/issue_test.go +++ b/scm/driver/gitlab/issue_test.go @@ -40,7 +40,7 @@ func TestIssueFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -73,7 +73,7 @@ func TestIssueCommentFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -110,7 +110,7 @@ func TestIssueList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -147,7 +147,7 @@ func TestIssueListComments(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -184,7 +184,7 @@ func TestIssueListEvents(t *testing.T) { t.Error(err) return } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -223,7 +223,7 @@ func TestIssueCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -261,7 +261,7 @@ func TestIssueCreateComment(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -319,7 +319,7 @@ func TestIssueEditComment(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/gitlab/milestone_test.go b/scm/driver/gitlab/milestone_test.go index 7586c11f5..949024121 100644 --- a/scm/driver/gitlab/milestone_test.go +++ b/scm/driver/gitlab/milestone_test.go @@ -38,7 +38,7 @@ func TestMilestoneFind(t *testing.T) { t.Fatalf("json.Unmarshal: %v", err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -73,7 +73,7 @@ func TestMilestoneList(t *testing.T) { t.Fatalf("json.Unmarshal: %v", err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -116,7 +116,7 @@ func TestMilestoneCreate(t *testing.T) { t.Fatalf("json.Unmarshal: %v", err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -159,7 +159,7 @@ func TestMilestoneUpdate(t *testing.T) { t.Fatalf("json.Unmarshal: %v", err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/gitlab/org_test.go b/scm/driver/gitlab/org_test.go index cbbae47db..7acc0cb90 100644 --- a/scm/driver/gitlab/org_test.go +++ b/scm/driver/gitlab/org_test.go @@ -40,7 +40,7 @@ func TestOrganizationFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -76,7 +76,7 @@ func TestOrganizationList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/gitlab/pr_test.go b/scm/driver/gitlab/pr_test.go index 3628e404a..e44a5d6ca 100644 --- a/scm/driver/gitlab/pr_test.go +++ b/scm/driver/gitlab/pr_test.go @@ -119,7 +119,7 @@ func TestPullList(t *testing.T) { t.Fatalf("json.Unmarshal: %v", err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -152,7 +152,7 @@ func TestPullListChanges(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -247,7 +247,7 @@ func TestPullCommentFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -283,7 +283,7 @@ func TestPullListComments(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -322,7 +322,7 @@ func TestPullCreateComment(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -380,7 +380,7 @@ func TestPullEditComment(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -499,7 +499,7 @@ func TestPullUpdate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -535,7 +535,7 @@ func TestPullListEvents(t *testing.T) { t.Error(err) return } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/gitlab/release_test.go b/scm/driver/gitlab/release_test.go index b98b991de..6ba81e833 100644 --- a/scm/driver/gitlab/release_test.go +++ b/scm/driver/gitlab/release_test.go @@ -34,7 +34,7 @@ func TestReleaseFindByTag(t *testing.T) { err = json.Unmarshal(raw, want) assert.NoError(t, err) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) @@ -69,7 +69,7 @@ func TestReleaseList(t *testing.T) { err = json.Unmarshal(raw, &want) assert.NoError(t, err) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) @@ -111,7 +111,7 @@ func TestReleaseCreate(t *testing.T) { err = json.Unmarshal(raw, want) assert.NoError(t, err) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) @@ -153,7 +153,7 @@ func TestReleaseUpdateByTag(t *testing.T) { err = json.Unmarshal(raw, want) assert.NoError(t, err) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/gitlab/repo_test.go b/scm/driver/gitlab/repo_test.go index 3599d1324..6365308e7 100644 --- a/scm/driver/gitlab/repo_test.go +++ b/scm/driver/gitlab/repo_test.go @@ -57,7 +57,7 @@ func TestRepositoryCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -115,7 +115,7 @@ func TestRepositoryFork(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -148,7 +148,7 @@ func TestRepositoryFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -181,7 +181,7 @@ func TestRepositoryFindNested(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -270,7 +270,7 @@ func TestRepositoryList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -335,7 +335,7 @@ func TestListContributor(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -372,7 +372,7 @@ func TestStatusList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -408,7 +408,7 @@ func TestCombinedStatus(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -458,7 +458,7 @@ func TestStatusCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -491,7 +491,7 @@ func TestRepositoryHookFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -527,7 +527,7 @@ func TestRepositoryHookList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -602,7 +602,7 @@ func TestRepositoryHookCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -645,7 +645,7 @@ func TestRepositoryHookCreateSkipVerify(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -684,7 +684,7 @@ func TestRepositoryHookUpdate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -733,7 +733,7 @@ func TestRepositoryHookUpdateSkipVerify(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -761,7 +761,7 @@ func TestRepositoryFindUserPermission(t *testing.T) { want := scm.WritePermission - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/gitlab/user_test.go b/scm/driver/gitlab/user_test.go index aef6d9257..7d5bb1965 100644 --- a/scm/driver/gitlab/user_test.go +++ b/scm/driver/gitlab/user_test.go @@ -40,7 +40,7 @@ func TestUserFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) @@ -79,7 +79,7 @@ func TestUserLoginFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/gogs/git_test.go b/scm/driver/gogs/git_test.go index 0761021b6..f1a485839 100644 --- a/scm/driver/gogs/git_test.go +++ b/scm/driver/gogs/git_test.go @@ -41,7 +41,7 @@ func TestCommitFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -97,7 +97,7 @@ func TestBranchFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -125,7 +125,7 @@ func TestBranchList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/gogs/issue_test.go b/scm/driver/gogs/issue_test.go index 7eac4f6b3..2f547ffe3 100644 --- a/scm/driver/gogs/issue_test.go +++ b/scm/driver/gogs/issue_test.go @@ -41,7 +41,7 @@ func TestIssueFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -69,7 +69,7 @@ func TestIssueList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -102,7 +102,7 @@ func TestIssueCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -166,7 +166,7 @@ func TestIssueCommentList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -194,7 +194,7 @@ func TestIssueCommentCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/gogs/org_test.go b/scm/driver/gogs/org_test.go index 9acea2f43..c11a885b5 100644 --- a/scm/driver/gogs/org_test.go +++ b/scm/driver/gogs/org_test.go @@ -38,7 +38,7 @@ func TestOrgFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -66,7 +66,7 @@ func TestOrgList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/gogs/repo_test.go b/scm/driver/gogs/repo_test.go index 17103824c..de07d1ce2 100644 --- a/scm/driver/gogs/repo_test.go +++ b/scm/driver/gogs/repo_test.go @@ -41,7 +41,7 @@ func TestRepoFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -97,7 +97,7 @@ func TestRepoList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -146,7 +146,7 @@ func TestHookFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -174,7 +174,7 @@ func TestHookList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -202,7 +202,7 @@ func TestHookCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -273,7 +273,7 @@ func TestHookEvents(t *testing.T) { } for _, test := range tests { got, want := convertHookEvent(test.in), test.out - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/gogs/user_test.go b/scm/driver/gogs/user_test.go index 877944e8c..d0dea19ba 100644 --- a/scm/driver/gogs/user_test.go +++ b/scm/driver/gogs/user_test.go @@ -38,7 +38,7 @@ func TestUserFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -66,7 +66,7 @@ func TestUserLoginFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/stash/content_test.go b/scm/driver/stash/content_test.go index 6fd7ec9ff..9e193ddc2 100644 --- a/scm/driver/stash/content_test.go +++ b/scm/driver/stash/content_test.go @@ -39,7 +39,7 @@ func TestContentFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/stash/git_test.go b/scm/driver/stash/git_test.go index 46523250d..641e8b80f 100644 --- a/scm/driver/stash/git_test.go +++ b/scm/driver/stash/git_test.go @@ -38,7 +38,7 @@ func TestGitFindCommit(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -67,7 +67,7 @@ func TestGitFindBranch(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -96,7 +96,7 @@ func TestGitFindTag(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -133,7 +133,7 @@ func TestGitListBranches(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -162,7 +162,7 @@ func TestGitListTags(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -191,7 +191,7 @@ func TestGitListChanges(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -222,7 +222,7 @@ func TestGitCompareCommits(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/stash/org_test.go b/scm/driver/stash/org_test.go index cde6db637..e941d7138 100644 --- a/scm/driver/stash/org_test.go +++ b/scm/driver/stash/org_test.go @@ -49,7 +49,7 @@ func TestOrganizationList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -81,7 +81,7 @@ func TestOrganizationListOrgMembers(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/stash/pr_test.go b/scm/driver/stash/pr_test.go index d33f6cf0b..350fcfaca 100644 --- a/scm/driver/stash/pr_test.go +++ b/scm/driver/stash/pr_test.go @@ -40,7 +40,7 @@ func TestPullFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -79,7 +79,7 @@ func TestPullUpdate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -107,7 +107,7 @@ func TestPullFindComment(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -135,7 +135,7 @@ func TestPullListComments(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -184,7 +184,7 @@ func TestPullList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -214,7 +214,7 @@ func TestPullListChanges(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -299,7 +299,7 @@ func TestPullCreateComment(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -335,7 +335,7 @@ func TestPullEditComment(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -371,7 +371,7 @@ func TestPullCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -435,7 +435,7 @@ func TestPullListLabels(t *testing.T) { //nolint json.Unmarshal(raw, &want) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/stash/repo_test.go b/scm/driver/stash/repo_test.go index dffc97440..424e10f7c 100644 --- a/scm/driver/stash/repo_test.go +++ b/scm/driver/stash/repo_test.go @@ -44,7 +44,7 @@ func TestRepositoryCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -76,7 +76,7 @@ func TestRepositoryFork(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -104,7 +104,7 @@ func TestRepositoryFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -156,7 +156,7 @@ func TestRepositoryPerms(t *testing.T) { Push: true, Admin: true, } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -198,7 +198,7 @@ func TestRepositoryPerms_ReadOnly(t *testing.T) { Admin: false, } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -244,7 +244,7 @@ func TestRepositoryPerms_Write(t *testing.T) { Admin: false, } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -273,7 +273,7 @@ func TestRepositoryPerms_Forbidden(t *testing.T) { Push: false, Admin: false, } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -311,7 +311,7 @@ func TestRepositoryList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -349,7 +349,7 @@ func TestRepositoryListOrganisation(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -379,7 +379,7 @@ func TestStatusList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -409,7 +409,7 @@ func TestRepositoryService_FindCombinedStatus(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -460,7 +460,7 @@ func TestRepositoryHookFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -490,7 +490,7 @@ func TestRepositoryHookList(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -545,7 +545,7 @@ func TestRepositoryHookCreate(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -641,7 +641,7 @@ func TestRepositoryService_FindUserPermission(t *testing.T) { want := scm.ReadPermission - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/driver/stash/user_test.go b/scm/driver/stash/user_test.go index f345605a1..081203380 100644 --- a/scm/driver/stash/user_test.go +++ b/scm/driver/stash/user_test.go @@ -46,7 +46,7 @@ func TestUserFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } @@ -74,7 +74,7 @@ func TestUserLoginFind(t *testing.T) { t.Error(err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/transport/oauth1/encode_test.go b/scm/transport/oauth1/encode_test.go index b68f68dc4..a29f27360 100644 --- a/scm/transport/oauth1/encode_test.go +++ b/scm/transport/oauth1/encode_test.go @@ -31,7 +31,7 @@ func TestEncodeParameters(t *testing.T) { "key%2B3": "key%2B4", } got := encodeParameters(params) - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/transport/oauth1/sort_test.go b/scm/transport/oauth1/sort_test.go index 637ba8869..7185ff9b7 100644 --- a/scm/transport/oauth1/sort_test.go +++ b/scm/transport/oauth1/sort_test.go @@ -26,7 +26,7 @@ func TestSortParameters(t *testing.T) { "per_page=25", } got := sortParameters(params, "%s=%s") - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } diff --git a/scm/transport/oauth2/refresh_test.go b/scm/transport/oauth2/refresh_test.go index 78f7df3c3..dbc8bc901 100644 --- a/scm/transport/oauth2/refresh_test.go +++ b/scm/transport/oauth2/refresh_test.go @@ -92,7 +92,7 @@ func TestRefresh_Error(t *testing.T) { Message: "Invalid OAuth client credentials", } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("Unexpected Error message") t.Log(diff) } From 635708fb5d0358441ac8e3f5a265eb1b6f4bb0c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Svantesson?= Date: Thu, 10 Oct 2024 11:39:55 +0200 Subject: [PATCH 3/3] fix: updating gitea demo url apparently we sometimes send requests to the demo site in the tests. These have now failed since https://try.gitea.io is gone. Replacing with https://demo.gitea.com that actually works --- scm/driver/gitea/content_test.go | 18 ++++----- scm/driver/gitea/git_test.go | 26 ++++++------ scm/driver/gitea/gitea_test.go | 18 ++++----- scm/driver/gitea/issue_test.go | 64 +++++++++++++++--------------- scm/driver/gitea/milestone_test.go | 20 +++++----- scm/driver/gitea/org_test.go | 8 ++-- scm/driver/gitea/pr_test.go | 28 ++++++------- scm/driver/gitea/release_test.go | 20 +++++----- scm/driver/gitea/repo_test.go | 40 +++++++++---------- scm/driver/gitea/review_test.go | 24 +++++------ scm/driver/gitea/user_test.go | 12 +++--- scm/driver/gitea/webhook_test.go | 4 +- 12 files changed, 141 insertions(+), 141 deletions(-) diff --git a/scm/driver/gitea/content_test.go b/scm/driver/gitea/content_test.go index 158fe0e1a..dd6081a2f 100644 --- a/scm/driver/gitea/content_test.go +++ b/scm/driver/gitea/content_test.go @@ -21,13 +21,13 @@ func TestContentFind(t *testing.T) { defer gock.Off() mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/go-gitea/gitea/contents/.gitignore"). Reply(200). Type("application/json;charset=utf-8"). File("testdata/content_find.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") result, _, err := client.Contents.Find( context.Background(), "go-gitea/gitea", @@ -58,13 +58,13 @@ func TestContentList(t *testing.T) { defer gock.Off() mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/go-gitea/gitea/contents/"). Reply(200). Type("application/json;charset=utf-8"). File("testdata/content_list.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") result, _, err := client.Contents.List( context.Background(), "go-gitea/gitea", @@ -97,7 +97,7 @@ func TestContentCreate(t *testing.T) { c := encode(content) r := - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Post("/api/v1/repos/go-gitea/gitea/contents/README.md"). JSON(map[string]interface{}{ "message": message, @@ -121,7 +121,7 @@ func TestContentCreate(t *testing.T) { Branch: branch, Message: message, } - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") _, err := client.Contents.Create(context.Background(), "go-gitea/gitea", "README.md", o) if err != nil { t.Error(err) @@ -139,7 +139,7 @@ func TestContentUpdate(t *testing.T) { message := "add README.md" branch := "master" - r := gock.New("https://try.gitea.io"). + r := gock.New("https://demo.gitea.com"). Put("/api/v1/repos/go-gitea/gitea/contents/README.md"). MatchType("json"). JSON(map[string]interface{}{ @@ -166,7 +166,7 @@ func TestContentUpdate(t *testing.T) { Message: message, Sha: previousSHA, } - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") _, err := client.Contents.Update(context.Background(), "go-gitea/gitea", "README.md", o) if err != nil { t.Error(err) @@ -176,7 +176,7 @@ func TestContentUpdate(t *testing.T) { func TestContentDelete(t *testing.T) { // TODO disable for now as its down t.SkipNow() - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") _, err := client.Contents.Delete(context.Background(), "go-gitea/gitea", "README.md", &scm.ContentParams{Ref: "master"}) if err != scm.ErrNotSupported { t.Errorf("Expect Not Supported error") diff --git a/scm/driver/gitea/git_test.go b/scm/driver/gitea/git_test.go index efa3d0518..5ae24fd90 100644 --- a/scm/driver/gitea/git_test.go +++ b/scm/driver/gitea/git_test.go @@ -26,13 +26,13 @@ func TestCommitFind(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/gitea/gitea/git/commits/c43399cad8766ee521b873a32c1652407c5a4630"). Reply(200). Type("application/json"). File("testdata/commit.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, _, err := client.Git.FindCommit( context.Background(), "gitea/gitea", @@ -60,13 +60,13 @@ func TestCommitList(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/go-gitea/gitea/commits"). Reply(200). Type("application/json"). File("testdata/commits.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, _, err := client.Git.ListCommits(context.Background(), "go-gitea/gitea", scm.CommitListOptions{}) if err != nil { t.Error(err) @@ -84,7 +84,7 @@ func TestCommitList(t *testing.T) { } func TestChangeList(t *testing.T) { - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") _, _, err := client.Git.ListChanges(context.Background(), "go-gitea/gitea", "f05f642b892d59a0a9ef6a31f6c905a24b5db13a", &scm.ListOptions{}) if err != scm.ErrNotSupported { t.Errorf("Expect Not Supported error") @@ -92,7 +92,7 @@ func TestChangeList(t *testing.T) { } func TestCompareCommits(t *testing.T) { - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") _, _, err := client.Git.CompareCommits(context.Background(), "go-gitea/gitea", "21cf205dc770d637a9ba636644cf8bf690cc100d", "63aeb0a859499623becc1d1e7c8a2ad57439e139", &scm.ListOptions{}) if err != scm.ErrNotSupported { t.Errorf("Expect Not Supported error") @@ -108,13 +108,13 @@ func TestBranchFind(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/go-gitea/gitea/branches/master"). Reply(200). Type("application/json"). File("testdata/branch.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, _, err := client.Git.FindBranch(context.Background(), "go-gitea/gitea", "master") if err != nil { t.Error(err) @@ -138,14 +138,14 @@ func TestBranchList(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/go-gitea/gitea/branches"). Reply(200). Type("application/json"). SetHeaders(mockPageHeaders). File("testdata/branches.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, res, err := client.Git.ListBranches(context.Background(), "go-gitea/gitea", &scm.ListOptions{}) if err != nil { t.Error(err) @@ -171,7 +171,7 @@ func TestBranchList(t *testing.T) { // func TestTagFind(t *testing.T) { - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") _, _, err := client.Git.FindTag(context.Background(), "go-gitea/gitea", "v1.0.0") if err != scm.ErrNotSupported { t.Errorf("Expect Not Supported error") @@ -183,14 +183,14 @@ func TestTagList(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/go-gitea/gitea/tags"). Reply(200). Type("application/json"). SetHeaders(mockPageHeaders). File("testdata/tags.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, res, err := client.Git.ListTags(context.Background(), "go-gitea/gitea", &scm.ListOptions{}) if err != nil { t.Error(err) diff --git a/scm/driver/gitea/gitea_test.go b/scm/driver/gitea/gitea_test.go index 56cc5e8e7..153d8973f 100644 --- a/scm/driver/gitea/gitea_test.go +++ b/scm/driver/gitea/gitea_test.go @@ -13,10 +13,10 @@ import ( ) var mockPageHeaders = map[string]string{ - "Link": `; rel="next",` + - `; rel="prev",` + - `; rel="first",` + - `; rel="last"`, + "Link": `; rel="next",` + + `; rel="prev",` + + `; rel="first",` + + `; rel="last"`, } func TestClient(t *testing.T) { @@ -24,11 +24,11 @@ func TestClient(t *testing.T) { mockServerVersion() - client, err := New("https://try.gitea.io") + client, err := New("https://demo.gitea.com") if err != nil { t.Error(err) } - if got, want := client.BaseURL.String(), "https://try.gitea.io/"; got != want { + if got, want := client.BaseURL.String(), "https://demo.gitea.com/"; got != want { t.Errorf("Want Client URL %q, got %q", want, got) } } @@ -38,11 +38,11 @@ func TestClient_Base(t *testing.T) { mockServerVersion() - client, err := New("https://try.gitea.io/v1") + client, err := New("https://demo.gitea.com/v1") if err != nil { t.Error(err) } - if got, want := client.BaseURL.String(), "https://try.gitea.io/v1/"; got != want { + if got, want := client.BaseURL.String(), "https://demo.gitea.com/v1/"; got != want { t.Errorf("Want Client URL %q, got %q", want, got) } } @@ -76,7 +76,7 @@ func testPage(res *scm.Response) func(t *testing.T) { } func mockServerVersion() { - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/version"). Reply(200). Type("application/json"). diff --git a/scm/driver/gitea/issue_test.go b/scm/driver/gitea/issue_test.go index 5c7f6507e..e2db081f9 100644 --- a/scm/driver/gitea/issue_test.go +++ b/scm/driver/gitea/issue_test.go @@ -24,13 +24,13 @@ func TestIssueFind(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/go-gitea/gitea/issues/1"). Reply(200). Type("application/json"). File("testdata/issue.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, _, err := client.Issues.Find(context.Background(), "go-gitea/gitea", 1) if err != nil { t.Error(err) @@ -54,7 +54,7 @@ func TestIssueList(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/go-gitea/gitea/issues"). MatchParam("type", "issues"). Reply(200). @@ -62,7 +62,7 @@ func TestIssueList(t *testing.T) { SetHeaders(mockPageHeaders). File("testdata/issues.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, res, err := client.Issues.List(context.Background(), "go-gitea/gitea", scm.IssueListOptions{}) if err != nil { t.Error(err) @@ -88,7 +88,7 @@ func TestIssueCreate(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Post("/api/v1/repos/go-gitea/gitea/issues"). Reply(200). Type("application/json"). @@ -99,7 +99,7 @@ func TestIssueCreate(t *testing.T) { Body: "I'm having a problem with this.", } - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, _, err := client.Issues.Create(context.Background(), "go-gitea/gitea", &input) if err != nil { t.Error(err) @@ -123,14 +123,14 @@ func TestIssueClose(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Patch("/api/v1/repos/go-gitea/gitea/issues/1"). File("testdata/close_issue.json"). Reply(200). Type("application/json"). File("testdata/issue.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") _, err := client.Issues.Close(context.Background(), "go-gitea/gitea", 1) if err != nil { t.Error(err) @@ -142,14 +142,14 @@ func TestIssueReopen(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Patch("/api/v1/repos/go-gitea/gitea/issues/1"). File("testdata/reopen_issue.json"). Reply(200). Type("application/json"). File("testdata/issue.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") _, err := client.Issues.Reopen(context.Background(), "go-gitea/gitea", 1) if err != nil { t.Error(err) @@ -157,7 +157,7 @@ func TestIssueReopen(t *testing.T) { } func TestIssueLock(t *testing.T) { - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") _, err := client.Issues.Lock(context.Background(), "gogits/go-gogs-client", 1) if err != scm.ErrNotSupported { t.Errorf("Expect Not Supported error") @@ -165,7 +165,7 @@ func TestIssueLock(t *testing.T) { } func TestIssueUnlock(t *testing.T) { - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") _, err := client.Issues.Unlock(context.Background(), "gogits/go-gogs-client", 1) if err != scm.ErrNotSupported { t.Errorf("Expect Not Supported error") @@ -181,13 +181,13 @@ func TestIssueCommentFind(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/go-gitea/gitea/issues/1/comments"). Reply(200). Type("application/json"). File("testdata/comments.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, _, err := client.Issues.FindComment(context.Background(), "go-gitea/gitea", 1, 74) if err != nil { t.Error(err) @@ -211,14 +211,14 @@ func TestIssueCommentList(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/go-gitea/gitea/issues/1/comments"). Reply(200). Type("application/json"). SetHeaders(mockPageHeaders). File("testdata/comments.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, res, err := client.Issues.ListComments(context.Background(), "go-gitea/gitea", 1, &scm.ListOptions{}) if err != nil { t.Error(err) @@ -244,13 +244,13 @@ func TestIssueCommentCreate(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Post("/api/v1/repos/go-gitea/gitea/issues/1/comments"). Reply(201). Type("application/json"). File("testdata/comment.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, _, err := client.Issues.CreateComment(context.Background(), "go-gitea/gitea", 1, &scm.CommentInput{Body: "what?"}) if err != nil { t.Error(err) @@ -278,12 +278,12 @@ func TestIssueCommentDelete(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Delete("/api/v1/repos/go-gitea/gitea/issues/comments/1"). Reply(204). Type("application/json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") _, err := client.Issues.DeleteComment(context.Background(), "go-gitea/gitea", 1, 1) if err != nil { t.Error(err) @@ -295,14 +295,14 @@ func TestIssueListLabels(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/go-gitea/gitea/issues/1/labels"). Reply(200). Type("application/json"). SetHeaders(mockPageHeaders). File("testdata/issue_labels.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, res, err := client.Issues.ListLabels(context.Background(), "go-gitea/gitea", 1, &scm.ListOptions{}) if err != nil { t.Error(err) @@ -328,20 +328,20 @@ func TestIssueAssignIssue(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/go-gitea/gitea/issues/1"). Reply(200). Type("application/json"). File("testdata/issue.json") - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Patch("/api/v1/repos/go-gitea/gitea/issues/1"). File("testdata/assign_issue.json"). Reply(200). Type("application/json"). File("testdata/issue.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") _, err := client.Issues.AssignIssue(context.Background(), "go-gitea/gitea", 1, []string{"a", "b"}) if err != nil { t.Error(err) @@ -353,20 +353,20 @@ func TestIssueUnassignIssue(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/go-gitea/gitea/issues/1"). Reply(200). Type("application/json"). File("testdata/issue.json") - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Patch("/api/v1/repos/go-gitea/gitea/issues/1"). File("testdata/unassign_issue.json"). Reply(200). Type("application/json"). File("testdata/issue.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") _, err := client.Issues.UnassignIssue(context.Background(), "go-gitea/gitea", 1, []string{"string"}) if err != nil { t.Error(err) @@ -378,14 +378,14 @@ func TestIssueSetMilestone(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Patch("/api/v1/repos/go-gitea/gitea/issues/1"). File("testdata/issue_set_milestone.json"). Reply(200). Type("application/json"). File("testdata/issue.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") _, err := client.Issues.SetMilestone(context.Background(), "go-gitea/gitea", 1, 1) if err != nil { t.Error(err) @@ -397,14 +397,14 @@ func TestIssueClearMilestone(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Patch("/api/v1/repos/go-gitea/gitea/issues/1"). File("testdata/issue_clear_milestone.json"). Reply(200). Type("application/json"). File("testdata/issue.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") _, err := client.Issues.ClearMilestone(context.Background(), "go-gitea/gitea", 1) if err != nil { t.Error(err) diff --git a/scm/driver/gitea/milestone_test.go b/scm/driver/gitea/milestone_test.go index 22afc46c2..f7935c3a8 100644 --- a/scm/driver/gitea/milestone_test.go +++ b/scm/driver/gitea/milestone_test.go @@ -18,13 +18,13 @@ func TestMilestoneFind(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/jcitizen/my-repo/milestones/1"). Reply(200). Type("application/json"). File("testdata/milestone.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, _, err := client.Milestones.Find(context.Background(), "jcitizen/my-repo", 1) if err != nil { t.Error(err) @@ -46,14 +46,14 @@ func TestMilestoneList(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/jcitizen/my-repo/milestones"). Reply(200). Type("application/json"). SetHeaders(mockPageHeaders). File("testdata/milestones.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, res, err := client.Milestones.List(context.Background(), "jcitizen/my-repo", scm.MilestoneListOptions{}) if err != nil { t.Error(err) @@ -77,14 +77,14 @@ func TestMilestoneCreate(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Post("/api/v1/repos/jcitizen/my-repo/milestones"). File("testdata/milestone_create.json"). Reply(200). Type("application/json"). File("testdata/milestone.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") dueDate, _ := time.Parse(scm.SearchTimeFormat, "2012-10-09T23:39:01Z") input := &scm.MilestoneInput{ Title: "v1.0", @@ -113,14 +113,14 @@ func TestMilestoneUpdate(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Patch("/api/v1/repos/jcitizen/my-repo/milestones"). File("testdata/milestone_create.json"). Reply(200). Type("application/json"). File("testdata/milestone.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") dueDate, _ := time.Parse(scm.SearchTimeFormat, "2012-10-09T23:39:01Z") input := &scm.MilestoneInput{ Title: "v1.0", @@ -149,12 +149,12 @@ func TestMilestoneDelete(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Delete("/api/v1/repos/jcitizen/my-repo/milestones/1"). Reply(200). Type("application/json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") _, err := client.Milestones.Delete(context.Background(), "jcitizen/my-repo", 1) if err != nil { t.Error(err) diff --git a/scm/driver/gitea/org_test.go b/scm/driver/gitea/org_test.go index bb2a0ee6b..eeb0d590b 100644 --- a/scm/driver/gitea/org_test.go +++ b/scm/driver/gitea/org_test.go @@ -21,13 +21,13 @@ func TestOrgFind(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/orgs/gogits"). Reply(200). Type("application/json"). File("testdata/organization.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, _, err := client.Organizations.Find(context.Background(), "gogits") if err != nil { t.Error(err) @@ -51,14 +51,14 @@ func TestOrgList(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/user/orgs"). Reply(200). Type("application/json"). SetHeaders(mockPageHeaders). File("testdata/organizations.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, res, err := client.Organizations.List(context.Background(), &scm.ListOptions{}) if err != nil { t.Error(err) diff --git a/scm/driver/gitea/pr_test.go b/scm/driver/gitea/pr_test.go index b66f43c84..cc3452c38 100644 --- a/scm/driver/gitea/pr_test.go +++ b/scm/driver/gitea/pr_test.go @@ -26,13 +26,13 @@ func TestPullRequestFind(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/jcitizen/my-repo/pulls/1"). Reply(200). Type("application/json"). File("testdata/pr.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, _, err := client.PullRequests.Find(context.Background(), "jcitizen/my-repo", 1) if err != nil { t.Error(err) @@ -56,14 +56,14 @@ func TestPullRequestList(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/jcitizen/my-repo/pulls"). Reply(200). Type("application/json"). SetHeaders(mockPageHeaders). File("testdata/prs.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, res, err := client.PullRequests.List(context.Background(), "jcitizen/my-repo", &scm.PullRequestListOptions{}) if err != nil { t.Error(err) @@ -89,14 +89,14 @@ func TestPullClose(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Patch("/api/v1/repos/go-gitea/gitea/pulls/1"). File("testdata/close_pr.json"). Reply(200). Type("application/json"). File("testdata/pr.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") _, err := client.PullRequests.Close(context.Background(), "go-gitea/gitea", 1) if err != nil { t.Error(err) @@ -108,14 +108,14 @@ func TestPullReopen(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Patch("/api/v1/repos/go-gitea/gitea/pulls/1"). File("testdata/reopen_pr.json"). Reply(200). Type("application/json"). File("testdata/pr.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") _, err := client.PullRequests.Reopen(context.Background(), "go-gitea/gitea", 1) if err != nil { t.Error(err) @@ -127,12 +127,12 @@ func TestPullRequestMerge(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Post("/api/v1/repos/go-gitea/gitea/pulls/1"). Reply(204). Type("application/json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") _, err := client.PullRequests.Merge(context.Background(), "go-gitea/gitea", 1, nil) if err != nil { t.Error(err) @@ -148,13 +148,13 @@ func TestPullRequestChanges(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/go-gitea/gitea/pulls/1.patch"). Reply(204). Type("text/plain"). File("testdata/pr_changes.patch") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, _, err := client.PullRequests.ListChanges(context.Background(), "go-gitea/gitea", 1, &scm.ListOptions{}) if err != nil { t.Error(err) @@ -176,7 +176,7 @@ func TestPullCreate(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Post("/api/v1/repos/jcitizen/my-repo/pulls"). File("testdata/pr_create.json"). Reply(200). @@ -190,7 +190,7 @@ func TestPullCreate(t *testing.T) { Base: "master", } - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, _, err := client.PullRequests.Create(context.Background(), "jcitizen/my-repo", input) if err != nil { t.Error(err) diff --git a/scm/driver/gitea/release_test.go b/scm/driver/gitea/release_test.go index 7954bdad8..f8fc84551 100644 --- a/scm/driver/gitea/release_test.go +++ b/scm/driver/gitea/release_test.go @@ -49,13 +49,13 @@ func TestReleaseFind(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/repos/octocat/hello-world/releases/1"). Reply(200). Type("application/json"). File("testdata/release.json") - client, err := New("https://try.gitea.io") + client, err := New("https://demo.gitea.com") if err != nil { t.Error(err) return @@ -86,7 +86,7 @@ func TestReleaseList(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/repos/octocat/hello-world/releases"). MatchParam("page", "1"). MatchParam("limit", "30"). @@ -94,7 +94,7 @@ func TestReleaseList(t *testing.T) { Type("application/json"). File("testdata/releases.json") - client, err := New("https://try.gitea.io") + client, err := New("https://demo.gitea.com") if err != nil { t.Error(err) return @@ -127,14 +127,14 @@ func TestReleaseCreate(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Post("/repos/octocat/hello-world/releases"). File("testdata/release_create.json"). Reply(200). Type("application/json"). File("testdata/release.json") - client, err := New("https://try.gitea.io") + client, err := New("https://demo.gitea.com") if err != nil { t.Error(err) return @@ -175,14 +175,14 @@ func TestReleaseUpdate(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Patch("/repos/octocat/hello-world/releases/1"). File("testdata/release_update.json"). Reply(200). Type("application/json"). File("testdata/release.json") - client, err := New("https://try.gitea.io") + client, err := New("https://demo.gitea.com") if err != nil { t.Error(err) return @@ -218,12 +218,12 @@ func TestReleaseDelete(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Delete("/repos/octocat/hello-world/releases/1"). Reply(200). Type("application/json") - client, err := New("https://try.gitea.io") + client, err := New("https://demo.gitea.com") if err != nil { t.Error(err) } diff --git a/scm/driver/gitea/repo_test.go b/scm/driver/gitea/repo_test.go index ffb80a2c6..6188da55e 100644 --- a/scm/driver/gitea/repo_test.go +++ b/scm/driver/gitea/repo_test.go @@ -24,13 +24,13 @@ func TestRepoFind(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/go-gitea/gitea"). Reply(200). Type("application/json"). File("testdata/repo.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, _, err := client.Repositories.Find(context.Background(), "go-gitea/gitea") if err != nil { t.Error(err) @@ -54,13 +54,13 @@ func TestRepoFindPerm(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/go-gitea/gitea"). Reply(200). Type("application/json"). File("testdata/repo.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, _, err := client.Repositories.FindPerms(context.Background(), "go-gitea/gitea") if err != nil { t.Error(err) @@ -84,14 +84,14 @@ func TestRepoList(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/user/repos"). Reply(200). Type("application/json"). SetHeaders(mockPageHeaders). File("testdata/repos.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, res, err := client.Repositories.List(context.Background(), &scm.ListOptions{}) if err != nil { t.Error(err) @@ -117,12 +117,12 @@ func TestRepoNotFound(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/gogits/go-gogs-client"). Reply(404). Type("text/plain") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") _, _, err := client.Repositories.FindPerms(context.Background(), "gogits/go-gogs-client") if err == nil { t.Errorf("Expect Not Found error") @@ -140,13 +140,13 @@ func TestHookFind(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/go-gitea/gitea/hooks/20"). Reply(200). Type("application/json"). File("testdata/hook.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, _, err := client.Repositories.FindHook(context.Background(), "go-gitea/gitea", "20") if err != nil { t.Error(err) @@ -170,14 +170,14 @@ func TestHookList(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/go-gitea/gitea/hooks"). Reply(200). Type("application/json"). SetHeaders(mockPageHeaders). File("testdata/hooks.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, res, err := client.Repositories.ListHooks(context.Background(), "go-gitea/gitea", &scm.ListOptions{}) if err != nil { t.Error(err) @@ -203,13 +203,13 @@ func TestHookCreate(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Post("/api/v1/repos/go-gitea/gitea/hooks"). Reply(201). Type("application/json"). File("testdata/hook.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, _, err := client.Repositories.CreateHook(context.Background(), "go-gitea/gitea", &scm.HookInput{}) if err != nil { t.Error(err) @@ -233,12 +233,12 @@ func TestHookDelete(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Delete("/api/v1/repos/go-gitea/gitea/hooks/20"). Reply(204). Type("application/json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") _, err := client.Repositories.DeleteHook(context.Background(), "go-gitea/gitea", "20") if err != nil { t.Error(err) @@ -316,14 +316,14 @@ func TestStatusList(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/jcitizen/my-repo/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e/statuses"). Reply(200). Type("application/json"). SetHeaders(mockPageHeaders). File("testdata/statuses.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, _, err := client.Repositories.ListStatus(context.Background(), "jcitizen/my-repo", "6dcb09b5b57875f334f61aebed695e2e4193db5e", &scm.ListOptions{}) if err != nil { t.Error(err) @@ -354,13 +354,13 @@ func TestStatusCreate(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Post("/api/v1/repos/jcitizen/my-repo/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e"). Reply(201). Type("application/json"). File("testdata/status.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, _, err := client.Repositories.CreateStatus(context.Background(), "jcitizen/my-repo", "6dcb09b5b57875f334f61aebed695e2e4193db5e", in) if err != nil { t.Error(err) diff --git a/scm/driver/gitea/review_test.go b/scm/driver/gitea/review_test.go index 960ed15b4..3098bb772 100644 --- a/scm/driver/gitea/review_test.go +++ b/scm/driver/gitea/review_test.go @@ -22,19 +22,19 @@ func TestReviewFind(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/version"). Reply(200). Type("application/json"). File("testdata/version.json") - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/jcitizen/my-repo/pulls/1/reviews/1"). Reply(200). Type("application/json"). File("testdata/review.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, _, err := client.Reviews.Find(context.Background(), "jcitizen/my-repo", 1, 1) if err != nil { t.Error(err) @@ -56,20 +56,20 @@ func TestReviewList(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/version"). Reply(200). Type("application/json"). File("testdata/version.json") - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/jcitizen/my-repo/pulls/1/reviews"). Reply(200). Type("application/json"). SetHeaders(mockPageHeaders). File("testdata/reviews.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, res, err := client.Reviews.List(context.Background(), "jcitizen/my-repo", 1, &scm.ListOptions{}) if err != nil { t.Error(err) @@ -93,20 +93,20 @@ func TestReviewCreate(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/version"). Reply(200). Type("application/json"). File("testdata/version.json") - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Post("/api/v1/repos/jcitizen/my-repo/pulls/1/reviews"). File("testdata/review_create.json"). Reply(200). Type("application/json"). File("testdata/review.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") in := &scm.ReviewInput{ Body: "This is a review", @@ -139,17 +139,17 @@ func TestReviewDelete(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/version"). Reply(200). Type("application/json"). File("testdata/version.json") - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Delete("/api/v1/repos/jcitizen/my-repo/pulls/1/reviews/1"). Reply(200) - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") _, err := client.Reviews.Delete(context.Background(), "jcitizen/my-repo", 1, 1) if err != nil { diff --git a/scm/driver/gitea/user_test.go b/scm/driver/gitea/user_test.go index 35ad1fb58..34e4bf8ae 100644 --- a/scm/driver/gitea/user_test.go +++ b/scm/driver/gitea/user_test.go @@ -21,13 +21,13 @@ func TestUserFind(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/user"). Reply(200). Type("application/json"). File("testdata/user.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, _, err := client.Users.Find(context.Background()) if err != nil { t.Error(err) @@ -51,13 +51,13 @@ func TestUserLoginFind(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/users/jcitizen"). Reply(200). Type("application/json"). File("testdata/user.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") got, _, err := client.Users.FindLogin(context.Background(), "jcitizen") if err != nil { t.Error(err) @@ -81,13 +81,13 @@ func TestUserFindEmail(t *testing.T) { mockServerVersion() - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/user"). Reply(200). Type("application/json"). File("testdata/user.json") - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") email, _, err := client.Users.FindEmail(context.Background()) if err != nil { t.Error(err) diff --git a/scm/driver/gitea/webhook_test.go b/scm/driver/gitea/webhook_test.go index 74899d8f0..4d7d8c6eb 100644 --- a/scm/driver/gitea/webhook_test.go +++ b/scm/driver/gitea/webhook_test.go @@ -117,7 +117,7 @@ func TestWebhooks(t *testing.T) { after: "testdata/webhooks/pull_request_comment_created.json.golden", obj: new(scm.PullRequestCommentHook), setup: func() { - gock.New("https://try.gitea.io"). + gock.New("https://demo.gitea.com"). Get("/api/v1/repos/gogits/hello-world/pulls/2"). Reply(200). Type("application/json"). @@ -143,7 +143,7 @@ func TestWebhooks(t *testing.T) { defer gock.Off() mockServerVersion() - client, _ := New("https://try.gitea.io") + client, _ := New("https://demo.gitea.com") for _, test := range tests { t.Run(test.before, func(t *testing.T) {