summaryrefslogtreecommitdiffstats
path: root/models/unit_tests.go
diff options
context:
space:
mode:
authorDavid Schneiderbauer <daviian@users.noreply.github.com>2017-09-21 09:43:26 +0200
committerLauris BH <lauris@nix.lv>2017-09-21 10:43:26 +0300
commit1eedd983ea0f387b6e72264b1cd195a4d3ea1253 (patch)
treed4bbb070df7df0d6f38e2f20a8baf52598623a6a /models/unit_tests.go
parent0d80af649a50c4b9e5e4ba764399872fc92f70f2 (diff)
downloadgitea-1eedd983ea0f387b6e72264b1cd195a4d3ea1253.tar.gz
gitea-1eedd983ea0f387b6e72264b1cd195a4d3ea1253.zip
Complete push webhooks (#2530)
* implemented missing 'delete' push webhooks moreover created ActionDeleteBranch and ActionDeleteTag * add CommitRepoAction tests for tag/branch creation/deletion * fixed error where push webhook not called if is new branch or tag removed unnecessary code * moved prepare unit test environment into separate method to be used across unit tests * add missing if clause in pushUpdate Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
Diffstat (limited to 'models/unit_tests.go')
-rw-r--r--models/unit_tests.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/models/unit_tests.go b/models/unit_tests.go
index ce328b579d..f7a06bf0ef 100644
--- a/models/unit_tests.go
+++ b/models/unit_tests.go
@@ -5,8 +5,12 @@
package models
import (
+ "os"
"testing"
+ "code.gitea.io/gitea/modules/setting"
+
+ "github.com/Unknwon/com"
"github.com/go-xorm/core"
"github.com/go-xorm/xorm"
"github.com/stretchr/testify/assert"
@@ -38,6 +42,12 @@ func PrepareTestDatabase() error {
return LoadFixtures()
}
+func prepareTestEnv(t testing.TB) {
+ assert.NoError(t, PrepareTestDatabase())
+ assert.NoError(t, os.RemoveAll(setting.RepoRootPath))
+ assert.NoError(t, com.CopyDir("../integrations/gitea-repositories-meta", setting.RepoRootPath))
+}
+
type testCond struct {
query interface{}
args []interface{}