aboutsummaryrefslogtreecommitdiff
path: root/services/projectbase/projectbase_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/projectbase/projectbase_test.go')
-rw-r--r--services/projectbase/projectbase_test.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/services/projectbase/projectbase_test.go b/services/projectbase/projectbase_test.go
new file mode 100644
index 000000000..439da24f4
--- /dev/null
+++ b/services/projectbase/projectbase_test.go
@@ -0,0 +1,29 @@
+// Copyright 2021 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package projectbase
+
+import (
+ "context"
+ "path/filepath"
+ "testing"
+
+ _ "code.gitea.io/gitea/models"
+ repo_model "code.gitea.io/gitea/models/repo"
+ "code.gitea.io/gitea/models/unittest"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestMain(m *testing.M) {
+ unittest.MainTest(m, filepath.Join("..", ".."))
+}
+
+func TestRepository_InitProjectBase(t *testing.T) {
+ unittest.PrepareTestEnv(t)
+ repo1 := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}).(*repo_model.Repository)
+ assert.False(t, repo1.HasProjectBase())
+ assert.NoError(t, InitProjectBase(context.Background(), repo1))
+ assert.True(t, repo1.HasProjectBase())
+}