Skip to content

Commit

Permalink
Add tests for invalid URLs for external tracker and wiki.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsvantesson committed Aug 11, 2019
1 parent 075ce35 commit b8f81a3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions integrations/api_repo_edit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,21 @@ func TestAPIRepoEdit(t *testing.T) {
assert.Equal(t, *repo1editedOption.ExternalWiki, true)
assert.Equal(t, *repo1editedOption.ExternalWikiURL, *repoEditOption.ExternalWikiURL)

// Do some tests with invalid URL for external tracker and wiki
externalURLInvalid := "htp://www.somewebsite.com"
externalTrackerFormatInvalid := "http://www.somewebsite.com/{user/{repo}?issue={index}"
repoEditOption.ExternalTrackerURL = &externalURLInvalid
req = NewRequestWithJSON(t, "PATCH", url, &repoEditOption)
resp = session.MakeRequest(t, req, http.StatusUnprocessableEntity)
repoEditOption.ExternalTrackerURL = &externalURL
repoEditOption.ExternalTrackerFormat = &externalTrackerFormatInvalid
req = NewRequestWithJSON(t, "PATCH", url, &repoEditOption)
resp = session.MakeRequest(t, req, http.StatusUnprocessableEntity)
repoEditOption.ExternalTrackerFormat = &externalTrackerFormat
repoEditOption.ExternalWikiURL = &externalURLInvalid
req = NewRequestWithJSON(t, "PATCH", url, &repoEditOption)
resp = session.MakeRequest(t, req, http.StatusUnprocessableEntity)

//Test small repo change through API with issue and wiki option not set; They shall not be touched.
*repoEditOption.Description = "small change"
repoEditOption.HasIssues = nil
Expand Down

0 comments on commit b8f81a3

Please sign in to comment.