mirror of https://github.com/sunface/rust-course
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.
38 lines
547 B
38 lines
547 B
package api
|
|
|
|
import (
|
|
"sync"
|
|
"testing"
|
|
|
|
"github.com/mafanr/juz/g"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestLoadRow(t *testing.T) {
|
|
g.InitConfig("../tfe.conf")
|
|
g.InitLogger()
|
|
|
|
g.InitMysql()
|
|
|
|
p := &Proxy{}
|
|
p.apis = &sync.Map{}
|
|
p.loadAPIRow(g.TEST_API_NAME)
|
|
_, ok := p.apis.Load(g.TEST_API_NAME)
|
|
assert.True(t, ok)
|
|
}
|
|
|
|
func TestLoadAll(t *testing.T) {
|
|
g.InitConfig("../tfe.conf")
|
|
g.InitLogger()
|
|
|
|
g.InitMysql()
|
|
|
|
p := &Proxy{}
|
|
p.apis = &sync.Map{}
|
|
p.loadAllAPIs()
|
|
|
|
_, ok := p.apis.Load(g.TEST_API_NAME)
|
|
assert.True(t, ok)
|
|
}
|