diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2017-04-28 21:23:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-28 21:23:28 +0800 |
commit | fca7ddc6ea5ceae298b0a4f33d0b82a2f1ccc06e (patch) | |
tree | c367ef79ac6f3d8c9d18e129395ba0c6a822d535 /integrations/integration_test.go | |
parent | 431b26f6d7d5b2d4700b4a65f1a81094c36a9fae (diff) | |
download | gitea-fca7ddc6ea5ceae298b0a4f33d0b82a2f1ccc06e.tar.gz gitea-fca7ddc6ea5ceae298b0a4f33d0b82a2f1ccc06e.zip |
improve integration test to resue models/fixtures and store git repos with tests (#1627)
* improve integration test to resue models/fixtures and store git repos with source
* use gitea-integration-meta dir instead .tar.gz and cleanup every before every test
* fix import package name
Diffstat (limited to 'integrations/integration_test.go')
-rw-r--r-- | integrations/integration_test.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/integrations/integration_test.go b/integrations/integration_test.go index db78eead86..dc0d41edef 100644 --- a/integrations/integration_test.go +++ b/integrations/integration_test.go @@ -17,6 +17,8 @@ import ( "code.gitea.io/gitea/routers" "code.gitea.io/gitea/routers/routes" + "github.com/Unknwon/com" + "github.com/stretchr/testify/assert" "gopkg.in/macaron.v1" "gopkg.in/testfixtures.v2" ) @@ -48,7 +50,7 @@ func TestMain(m *testing.M) { err := models.InitFixtures( helper, - "integrations/gitea-integration/fixtures/", + "models/fixtures/", ) if err != nil { fmt.Printf("Error initializing test database: %v\n", err) @@ -57,6 +59,12 @@ func TestMain(m *testing.M) { os.Exit(m.Run()) } +func prepareTestEnv(t *testing.T) { + assert.NoError(t, models.LoadFixtures()) + assert.NoError(t, os.RemoveAll("integrations/gitea-integration")) + assert.NoError(t, com.CopyDir("integrations/gitea-integration-meta", "integrations/gitea-integration")) +} + type TestResponseWriter struct { HeaderCode int Writer io.Writer |