diff options
author | 6543 <6543@obermui.de> | 2021-02-07 19:32:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-07 19:32:18 +0100 |
commit | 5f248d0df290fd08ed54e31424cbb8d8517229e3 (patch) | |
tree | 99d0b8dd73d4eceed3e100a69bfa47bd7e94c723 /integrations/api_releases_test.go | |
parent | 240fea8c14434f836677e6c883ef90523950ece5 (diff) | |
download | gitea-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.go | 20 |
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) } |