0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-12-27 03:04:30 +01:00
gitea/models/models_test.go

51 lines
876 B
Go
Raw Normal View History

2014-02-15 00:16:54 +01: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"
)
func init() {
2014-03-21 06:48:10 +01:00
LoadModelsConfig()
NewEngine()
var err error
orm, err = xorm.NewEngine("sqlite3", "./test.db")
if err != nil {
fmt.Println(err)
}
2014-02-14 15:20:57 +01:00
orm.ShowSQL = true
orm.ShowDebug = true
err = orm.Sync(&User{}, &Repo{})
if err != nil {
fmt.Println(err)
}
2014-02-14 15:20:57 +01:00
root = "test"
}
func TestCreateRepository(t *testing.T) {
2014-02-14 15:20:57 +01: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)
}
}