aboutsummaryrefslogtreecommitdiffstats
path: root/tests/integration
diff options
context:
space:
mode:
authorAndrew Imeson <andrew@andrewimeson.com>2022-10-07 08:49:30 -0400
committerGitHub <noreply@github.com>2022-10-07 20:49:30 +0800
commitd94f15c2fd921722796a4cfdbbf266dd3017525c (patch)
tree6abb2770ae4468325cd476bb193d39e028e9dfa2 /tests/integration
parent81d7270cde2960d52f5d987ec8b3fc3c679724a6 (diff)
downloadgitea-d94f15c2fd921722796a4cfdbbf266dd3017525c.tar.gz
gitea-d94f15c2fd921722796a4cfdbbf266dd3017525c.zip
Make external issue tracker regexp configurable via API (#21338)
Fixes #21336 Signed-off-by: Andrew Imeson <andrew@andrewimeson.com>
Diffstat (limited to 'tests/integration')
-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)