1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-22 12:54:53 -05:00
forgejo/models/models_test.go

56 lines
1 KiB
Go
Raw Normal View History

2014-02-14 18:16:54 -05:00
// Copyright 2014 The Gogs 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 models
import (
"fmt"
"testing"
"github.com/lunny/xorm"
_ "github.com/mattn/go-sqlite3"
2014-03-27 12:48:29 -04:00
. "github.com/smartystreets/goconvey/convey"
"github.com/gogits/gogs/modules/base"
)
func init() {
var err error
orm, err = xorm.NewEngine("sqlite3", "./test.db")
if err != nil {
fmt.Println(err)
}
2014-02-14 09:20:57 -05:00
orm.ShowSQL = true
orm.ShowDebug = true
2014-03-27 12:48:29 -04:00
err = orm.Sync(&User{}, &Repository{})
if err != nil {
fmt.Println(err)
}
2014-02-14 09:20:57 -05:00
2014-03-27 12:48:29 -04:00
base.RepoRootPath = "test"
}
func TestCreateRepository(t *testing.T) {
2014-03-27 12:48:29 -04:00
user := User{Id: 1, Name: "foobar", Type: UT_INDIVIDUAL}
_, err := CreateRepository(&user, "test", "", "", "test repo desc", false, false)
2014-02-14 09:20:57 -05:00
if err != nil {
t.Error(err)
}
}
func TestDeleteRepository(t *testing.T) {
2014-03-27 12:48:29 -04:00
err := DeleteRepository(1, 1, "foobar")
if err != nil {
t.Error(err)
}
}
2014-03-27 12:48:29 -04:00
func TestCommitRepoAction(t *testing.T) {
Convey("Create a commit repository action", t, func() {
})
}