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.
34 lines
571 B
34 lines
571 B
package resource |
|
|
|
import ( |
|
"context" |
|
"flag" |
|
"path/filepath" |
|
"testing" |
|
|
|
"go-common/app/interface/main/web-show/conf" |
|
|
|
. "github.com/smartystreets/goconvey/convey" |
|
) |
|
|
|
var d *Dao |
|
|
|
func WithDao(f func(d *Dao)) func() { |
|
return func() { |
|
dir, _ := filepath.Abs("../cmd/web-show-test.toml") |
|
flag.Set("conf", dir) |
|
conf.Init() |
|
if d == nil { |
|
d = New(conf.Conf) |
|
} |
|
f(d) |
|
} |
|
} |
|
|
|
func TestDao_Operation(t *testing.T) { |
|
Convey("test operation", t, WithDao(func(d *Dao) { |
|
data, err := d.Resources(context.TODO()) |
|
So(err, ShouldBeNil) |
|
Printf("%+v", data) |
|
})) |
|
}
|
|
|