Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

models_test.go 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. }