1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-26 09:09:36 -05:00
forgejo/models/models_test.go

44 lines
680 B
Go
Raw Normal View History

package models
import (
"fmt"
"testing"
"github.com/lunny/xorm"
_ "github.com/mattn/go-sqlite3"
)
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
err = orm.Sync(&User{}, &Repo{})
if err != nil {
fmt.Println(err)
}
2014-02-14 09:20:57 -05:00
root = "test"
}
func TestCreateRepository(t *testing.T) {
2014-02-14 09:20:57 -05:00
user := User{Id: 1, Type: Individual}
_, err := CreateRepository(&user, "test")
if err != nil {
t.Error(err)
}
}
func TestDeleteRepository(t *testing.T) {
user := User{Id: 1, Type: Individual}
err := DeleteRepository(&user, "test")
if err != nil {
t.Error(err)
}
}