You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.0 KiB

10 years ago
10 years ago
10 years ago
10 years ago
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package models
  5. import (
  6. "fmt"
  7. "testing"
  8. "github.com/lunny/xorm"
  9. _ "github.com/mattn/go-sqlite3"
  10. . "github.com/smartystreets/goconvey/convey"
  11. "github.com/gogits/gogs/modules/base"
  12. )
  13. func init() {
  14. var err error
  15. orm, err = xorm.NewEngine("sqlite3", "./test.db")
  16. if err != nil {
  17. fmt.Println(err)
  18. }
  19. orm.ShowSQL = true
  20. orm.ShowDebug = true
  21. err = orm.Sync(&User{}, &Repository{})
  22. if err != nil {
  23. fmt.Println(err)
  24. }
  25. base.RepoRootPath = "test"
  26. }
  27. func TestCreateRepository(t *testing.T) {
  28. user := User{Id: 1, Name: "foobar", Type: UT_INDIVIDUAL}
  29. _, err := CreateRepository(&user, "test", "", "", "test repo desc", false, false)
  30. if err != nil {
  31. t.Error(err)
  32. }
  33. }
  34. func TestDeleteRepository(t *testing.T) {
  35. err := DeleteRepository(1, 1, "foobar")
  36. if err != nil {
  37. t.Error(err)
  38. }
  39. }
  40. func TestCommitRepoAction(t *testing.T) {
  41. Convey("Create a commit repository action", t, func() {
  42. })
  43. }