mirror of https://github.com/gogits/gogs.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
842 B
47 lines
842 B
// 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() { |
|
var err error |
|
orm, err = xorm.NewEngine("sqlite3", "./test.db") |
|
if err != nil { |
|
fmt.Println(err) |
|
} |
|
|
|
orm.ShowSQL = true |
|
orm.ShowDebug = true |
|
|
|
err = orm.Sync(&User{}, &Repo{}) |
|
if err != nil { |
|
fmt.Println(err) |
|
} |
|
|
|
root = "test" |
|
} |
|
|
|
func TestCreateRepository(t *testing.T) { |
|
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) |
|
} |
|
}
|
|
|