summaryrefslogtreecommitdiffstats
path: root/integrations
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2021-06-23 23:08:47 +0200
committerGitHub <noreply@github.com>2021-06-23 17:08:47 -0400
commiteb324a9402878a13029116bafa8ccce527796522 (patch)
tree8ad442182f440e9acfd4e929a30919d9796fb3ea /integrations
parent08f4b3f31288bc4e12e94f00c7d88583ab04dd2e (diff)
downloadgitea-eb324a9402878a13029116bafa8ccce527796522.tar.gz
gitea-eb324a9402878a13029116bafa8ccce527796522.zip
[API] Add repoGetTag (#16166)
* GetTag -> GetAnnotatedTag * API: Add repoGetTag * fix swagger docs * support "/" as tag name char Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'integrations')
-rw-r--r--integrations/api_repo_tags_test.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/integrations/api_repo_tags_test.go b/integrations/api_repo_tags_test.go
index 1bd9fa6168..0bf54d3a95 100644
--- a/integrations/api_repo_tags_test.go
+++ b/integrations/api_repo_tags_test.go
@@ -39,7 +39,7 @@ func TestAPIRepoTags(t *testing.T) {
assert.Equal(t, setting.AppURL+"user2/repo1/archive/v1.1.zip", tags[0].ZipballURL)
assert.Equal(t, setting.AppURL+"user2/repo1/archive/v1.1.tar.gz", tags[0].TarballURL)
- newTag := createNewTagUsingAPI(t, session, token, user.Name, repoName, "awesome-tag", "", "nice!\nand some text")
+ newTag := createNewTagUsingAPI(t, session, token, user.Name, repoName, "gitea/22", "", "nice!\nand some text")
resp = session.MakeRequest(t, req, http.StatusOK)
DecodeJSON(t, resp, &tags)
assert.Len(t, tags, 2)
@@ -51,6 +51,20 @@ func TestAPIRepoTags(t *testing.T) {
assert.EqualValues(t, newTag.Commit.SHA, tag.Commit.SHA)
}
}
+
+ // get created tag
+ req = NewRequestf(t, "GET", "/api/v1/repos/%s/%s/tags/%s?token=%s", user.Name, repoName, newTag.Name, token)
+ resp = session.MakeRequest(t, req, http.StatusOK)
+ var tag *api.Tag
+ DecodeJSON(t, resp, &tag)
+ assert.EqualValues(t, newTag, tag)
+
+ // delete tag
+ delReq := NewRequestf(t, "DELETE", "/api/v1/repos/%s/%s/tags/%s?token=%s", user.Name, repoName, newTag.Name, token)
+ resp = session.MakeRequest(t, delReq, http.StatusNoContent)
+
+ // check if it's gone
+ resp = session.MakeRequest(t, req, http.StatusNotFound)
}
func createNewTagUsingAPI(t *testing.T, session *TestSession, token string, ownerName, repoName, name, target, msg string) *api.Tag {