diff options
author | 6543 <6543@obermui.de> | 2020-08-28 10:09:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-28 11:09:33 +0300 |
commit | d5b6931dbefff674fd84237555a7c2e284b63c5a (patch) | |
tree | 8e68a4f12b16ed1ae782668459cfcb19e78fa7d4 /integrations/api_token_test.go | |
parent | eb1bf2377be15deb593a3e2426558d92c1973107 (diff) | |
download | gitea-d5b6931dbefff674fd84237555a7c2e284b63c5a.tar.gz gitea-d5b6931dbefff674fd84237555a7c2e284b63c5a.zip |
[API] Delete Token accept names too (#12366)
* Delete Token accept names too
* better description
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'integrations/api_token_test.go')
-rw-r--r-- | integrations/api_token_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/integrations/api_token_test.go b/integrations/api_token_test.go index 05b9af7a26..464b7ba38e 100644 --- a/integrations/api_token_test.go +++ b/integrations/api_token_test.go @@ -37,6 +37,19 @@ func TestAPICreateAndDeleteToken(t *testing.T) { MakeRequest(t, req, http.StatusNoContent) models.AssertNotExistsBean(t, &models.AccessToken{ID: newAccessToken.ID}) + + req = NewRequestWithJSON(t, "POST", "/api/v1/users/user1/tokens", map[string]string{ + "name": "test-key-2", + }) + req = AddBasicAuthHeader(req, user.Name) + resp = MakeRequest(t, req, http.StatusCreated) + DecodeJSON(t, resp, &newAccessToken) + + req = NewRequestf(t, "DELETE", "/api/v1/users/user1/tokens/%s", newAccessToken.Name) + req = AddBasicAuthHeader(req, user.Name) + MakeRequest(t, req, http.StatusNoContent) + + models.AssertNotExistsBean(t, &models.AccessToken{ID: newAccessToken.ID}) } // TestAPIDeleteMissingToken ensures that error is thrown when token not found |