更改目录结构

This commit is contained in:
bjdgyc
2021-03-01 15:46:08 +08:00
parent 3464d1d10e
commit 0f91c779e3
105 changed files with 29099 additions and 96 deletions

33
server/dbdata/db_test.go Normal file
View File

@@ -0,0 +1,33 @@
package dbdata
import (
"os"
"path"
"testing"
"github.com/bjdgyc/anylink/base"
"github.com/stretchr/testify/assert"
)
func preIpData() {
tmpDb := path.Join(os.TempDir(), "anylink_test.db")
base.Cfg.DbFile = tmpDb
initDb()
}
func closeIpdata() {
sdb.Close()
tmpDb := path.Join(os.TempDir(), "anylink_test.db")
os.Remove(tmpDb)
}
func TestDb(t *testing.T) {
assert := assert.New(t)
preIpData()
defer closeIpdata()
u := User{Username: "a"}
_ = Save(&u)
assert.Equal(u.Id, 1)
}