summaryrefslogtreecommitdiffstats
path: root/tests/integration/api_repo_edit_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration/api_repo_edit_test.go')
-rw-r--r--tests/integration/api_repo_edit_test.go18
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/integration/api_repo_edit_test.go b/tests/integration/api_repo_edit_test.go
index 5ef92bf47c..4dfae97e43 100644
--- a/tests/integration/api_repo_edit_test.go
+++ b/tests/integration/api_repo_edit_test.go
@@ -40,9 +40,10 @@ func getRepoEditOptionFromRepo(repo *repo_model.Repository) *api.EditRepoOption
config := unit.ExternalTrackerConfig()
hasIssues = true
externalTracker = &api.ExternalTracker{
- ExternalTrackerURL: config.ExternalTrackerURL,
- ExternalTrackerFormat: config.ExternalTrackerFormat,
- ExternalTrackerStyle: config.ExternalTrackerStyle,
+ ExternalTrackerURL: config.ExternalTrackerURL,
+ ExternalTrackerFormat: config.ExternalTrackerFormat,
+ ExternalTrackerStyle: config.ExternalTrackerStyle,
+ ExternalTrackerRegexpPattern: config.ExternalTrackerRegexpPattern,
}
}
hasWiki := false
@@ -220,6 +221,17 @@ func TestAPIRepoEdit(t *testing.T) {
assert.Equal(t, *repo1editedOption.HasWiki, true)
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
repoEditOption.ExternalTracker.ExternalTrackerURL = "htp://www.somewebsite.com"
req = NewRequestWithJSON(t, "PATCH", url, &repoEditOption)