summaryrefslogtreecommitdiffstats
path: root/integrations
diff options
context:
space:
mode:
authorDavid Schneiderbauer <daviian@users.noreply.github.com>2017-10-02 22:23:41 +0200
committerLauris BH <lauris@nix.lv>2017-10-02 23:23:41 +0300
commite38e502e209e2fb826b997d807361551762e24ae (patch)
tree60509e78996537a25c88450d3bc117c1b5919650 /integrations
parent3cc5b11b0d89bd179b8fb65e761a1a819704cf7d (diff)
downloadgitea-e38e502e209e2fb826b997d807361551762e24ae.tar.gz
gitea-e38e502e209e2fb826b997d807361551762e24ae.zip
Fix deletion of unprotected branches (#2630)
* fix deletion of unprotected branches * fmt fix * changed internal protected branch api * fix lint error Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
Diffstat (limited to 'integrations')
-rw-r--r--integrations/internal_test.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/integrations/internal_test.go b/integrations/internal_test.go
index c22e951bc5..dd203d89f6 100644
--- a/integrations/internal_test.go
+++ b/integrations/internal_test.go
@@ -17,7 +17,7 @@ import (
"github.com/stretchr/testify/assert"
)
-func assertProtectedBranch(t *testing.T, repoID int64, branchName string, isErr, canPush bool) {
+func assertProtectedBranch(t *testing.T, repoID int64, branchName string, isErr, isProtected bool) {
reqURL := fmt.Sprintf("/api/internal/branch/%d/%s", repoID, url.QueryEscape(branchName))
req := NewRequest(t, "GET", reqURL)
t.Log(reqURL)
@@ -31,14 +31,14 @@ func assertProtectedBranch(t *testing.T, repoID int64, branchName string, isErr,
var branch models.ProtectedBranch
t.Log(string(resp.Body))
assert.NoError(t, json.Unmarshal(resp.Body, &branch))
- assert.Equal(t, canPush, branch.CanPush)
+ assert.Equal(t, isProtected, branch.IsProtected())
}
}
func TestInternal_GetProtectedBranch(t *testing.T) {
prepareTestEnv(t)
- assertProtectedBranch(t, 1, "master", false, true)
- assertProtectedBranch(t, 1, "dev", false, true)
- assertProtectedBranch(t, 1, "lunny/dev", false, true)
+ assertProtectedBranch(t, 1, "master", false, false)
+ assertProtectedBranch(t, 1, "dev", false, false)
+ assertProtectedBranch(t, 1, "lunny/dev", false, false)
}