Skip to content

Commit

Permalink
Added test for branch do not exists
Browse files Browse the repository at this point in the history
Signed-off-by: rishabh625 <[email protected]>
  • Loading branch information
rishabh625 committed May 6, 2022
1 parent e64b201 commit b6e3cee
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion applicationset/services/scm_provider/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func githubMockHandler(t *testing.T) func(http.ResponseWriter, *http.Request) {
"comments_url": "https://api.github.com/repos/argoproj/argo-cd/comments{/number}",
"commits_url": "https://api.github.com/repos/argoproj/argo-cd/commits{/sha}",
"compare_url": "https://api.github.com/repos/argoproj/argo-cd/compare/{base}...{head}",
"contents_url": "https://api.github.com/repos/argoproj/argo-cd/contents/{+path}",
"contents_url": "https://api.github.com/repos/argoproj/argo-cd/contents/{path}",
"contributors_url": "https://api.github.com/repos/argoproj/argo-cd/contributors",
"deployments_url": "https://api.github.com/repos/argoproj/argo-cd/deployments",
"downloads_url": "https://api.github.com/repos/argoproj/argo-cd/downloads",
Expand Down Expand Up @@ -303,6 +303,15 @@ func TestGithubGetBranches(t *testing.T) {
} else {
assert.Equal(t, repos[0].Branch, "master")
}
//Branch Doesn't exists instead of error will return no error
repo2 := &Repository{
Organization: "argoproj",
Repository: "applicationset",
Branch: "main",
}
_, err = host.GetBranches(context.Background(), repo2)
assert.NoError(t, err)

// Get all branches
host.allBranches = true
repos, err = host.GetBranches(context.Background(), repo)
Expand Down

0 comments on commit b6e3cee

Please sign in to comment.