예제 #1
0
func TestConfigure(t *testing.T) {
	Convey("Plugin should not panic when configuring with default configuration", t, func() {
		So(func() {
			tplugin := apiplexy.ManagementBackendPlugin(&SQLDBBackend{})
			_ = tplugin.Configure(tplugin.DefaultConfig())
		}, ShouldNotPanic)
	})
}
예제 #2
0
func TestMain(m *testing.M) {
	plugin = apiplexy.ManagementBackendPlugin(&SQLDBBackend{})
	err := plugin.Configure(map[string]interface{}{
		"driver":            "sqlite3",
		"connection_string": ":memory:",
		"create_tables":     true,
	})
	if err != nil {
		fmt.Printf("Couldn't initialize in-memory sqlite DB for testing. %s\n", err.Error())
		fmt.Printf("Available drivers: %s\n", strings.Join(sql.Drivers(), ", "))
		os.Exit(1)
	}
	os.Exit(m.Run())
}