summaryrefslogtreecommitdiffstats
path: root/integrations/api_releases_test.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2021-02-07 19:32:18 +0100
committerGitHub <noreply@github.com>2021-02-07 19:32:18 +0100
commit5f248d0df290fd08ed54e31424cbb8d8517229e3 (patch)
tree99d0b8dd73d4eceed3e100a69bfa47bd7e94c723 /integrations/api_releases_test.go
parent240fea8c14434f836677e6c883ef90523950ece5 (diff)
downloadgitea-5f248d0df290fd08ed54e31424cbb8d8517229e3.tar.gz
gitea-5f248d0df290fd08ed54e31424cbb8d8517229e3.zip
[API] Add delete release by tag & fix unreleased inconsistency (#14563)
* DeleteReleaseByTag delete release not git tags * Add api to delete tag (without release) * fix & extend tests * fix swagger doc
Diffstat (limited to 'integrations/api_releases_test.go')
-rw-r--r--integrations/api_releases_test.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/integrations/api_releases_test.go b/integrations/api_releases_test.go
index 2b310d11e0..26bf752cca 100644
--- a/integrations/api_releases_test.go
+++ b/integrations/api_releases_test.go
@@ -154,7 +154,7 @@ func TestAPIGetReleaseByTag(t *testing.T) {
assert.EqualValues(t, "Not Found", err.Message)
}
-func TestAPIDeleteTagByName(t *testing.T) {
+func TestAPIDeleteReleaseByTagName(t *testing.T) {
defer prepareTestEnv(t)()
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
@@ -162,17 +162,17 @@ func TestAPIDeleteTagByName(t *testing.T) {
session := loginUser(t, owner.LowerName)
token := getTokenForLoggedInUser(t, session)
- urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/releases/tags/delete-tag?token=%s",
- owner.Name, repo.Name, token)
+ createNewReleaseUsingAPI(t, session, token, owner, repo, "release-tag", "", "Release Tag", "test")
- req := NewRequestf(t, http.MethodDelete, urlStr)
+ // delete release
+ req := NewRequestf(t, http.MethodDelete, fmt.Sprintf("/api/v1/repos/%s/%s/releases/tags/release-tag?token=%s", owner.Name, repo.Name, token))
_ = session.MakeRequest(t, req, http.StatusNoContent)
- // Make sure that actual releases can't be deleted outright
- createNewReleaseUsingAPI(t, session, token, owner, repo, "release-tag", "", "Release Tag", "test")
- urlStr = fmt.Sprintf("/api/v1/repos/%s/%s/releases/tags/release-tag?token=%s",
- owner.Name, repo.Name, token)
+ // make sure release is deleted
+ req = NewRequestf(t, http.MethodDelete, fmt.Sprintf("/api/v1/repos/%s/%s/releases/tags/release-tag?token=%s", owner.Name, repo.Name, token))
+ _ = session.MakeRequest(t, req, http.StatusNotFound)
- req = NewRequestf(t, http.MethodDelete, urlStr)
- _ = session.MakeRequest(t, req, http.StatusConflict)
+ // delete release tag too
+ req = NewRequestf(t, http.MethodDelete, fmt.Sprintf("/api/v1/repos/%s/%s/tags/release-tag?token=%s", owner.Name, repo.Name, token))
+ _ = session.MakeRequest(t, req, http.StatusNoContent)
}