add createrepository & deleterepository
This commit is contained in:
parent
b5ba387891
commit
a30e5bcaf8
2 changed files with 96 additions and 0 deletions
30
models/models_test.go
Normal file
30
models/models_test.go
Normal file
|
@ -0,0 +1,30 @@
|
|||
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)
|
||||
}
|
||||
|
||||
err = orm.Sync(&User{}, &Org{}, &Repo{})
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCreateRepository(t *testing.T) {
|
||||
user := User{Id: 1}
|
||||
err := CreateUserRepository("test", &user, "test")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue