|
|
@ -40,9 +40,10 @@ func getRepoEditOptionFromRepo(repo *repo_model.Repository) *api.EditRepoOption |
|
|
|
config := unit.ExternalTrackerConfig() |
|
|
|
config := unit.ExternalTrackerConfig() |
|
|
|
hasIssues = true |
|
|
|
hasIssues = true |
|
|
|
externalTracker = &api.ExternalTracker{ |
|
|
|
externalTracker = &api.ExternalTracker{ |
|
|
|
ExternalTrackerURL: config.ExternalTrackerURL, |
|
|
|
ExternalTrackerURL: config.ExternalTrackerURL, |
|
|
|
ExternalTrackerFormat: config.ExternalTrackerFormat, |
|
|
|
ExternalTrackerFormat: config.ExternalTrackerFormat, |
|
|
|
ExternalTrackerStyle: config.ExternalTrackerStyle, |
|
|
|
ExternalTrackerStyle: config.ExternalTrackerStyle, |
|
|
|
|
|
|
|
ExternalTrackerRegexpPattern: config.ExternalTrackerRegexpPattern, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
hasWiki := false |
|
|
|
hasWiki := false |
|
|
@ -220,6 +221,17 @@ func TestAPIRepoEdit(t *testing.T) { |
|
|
|
assert.Equal(t, *repo1editedOption.HasWiki, true) |
|
|
|
assert.Equal(t, *repo1editedOption.HasWiki, true) |
|
|
|
assert.Equal(t, *repo1editedOption.ExternalWiki, *repoEditOption.ExternalWiki) |
|
|
|
assert.Equal(t, *repo1editedOption.ExternalWiki, *repoEditOption.ExternalWiki) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
repoEditOption.ExternalTracker.ExternalTrackerStyle = "regexp" |
|
|
|
|
|
|
|
repoEditOption.ExternalTracker.ExternalTrackerRegexpPattern = `(\d+)` |
|
|
|
|
|
|
|
req = NewRequestWithJSON(t, "PATCH", url, &repoEditOption) |
|
|
|
|
|
|
|
resp = session.MakeRequest(t, req, http.StatusOK) |
|
|
|
|
|
|
|
DecodeJSON(t, resp, &repo) |
|
|
|
|
|
|
|
assert.NotNil(t, repo) |
|
|
|
|
|
|
|
repo1edited = unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}) |
|
|
|
|
|
|
|
repo1editedOption = getRepoEditOptionFromRepo(repo1edited) |
|
|
|
|
|
|
|
assert.Equal(t, *repo1editedOption.HasIssues, true) |
|
|
|
|
|
|
|
assert.Equal(t, *repo1editedOption.ExternalTracker, *repoEditOption.ExternalTracker) |
|
|
|
|
|
|
|
|
|
|
|
// Do some tests with invalid URL for external tracker and wiki
|
|
|
|
// Do some tests with invalid URL for external tracker and wiki
|
|
|
|
repoEditOption.ExternalTracker.ExternalTrackerURL = "htp://www.somewebsite.com" |
|
|
|
repoEditOption.ExternalTracker.ExternalTrackerURL = "htp://www.somewebsite.com" |
|
|
|
req = NewRequestWithJSON(t, "PATCH", url, &repoEditOption) |
|
|
|
req = NewRequestWithJSON(t, "PATCH", url, &repoEditOption) |
|
|
|