Exemple #1
0
func buildApp() kit.App {
	app := NewApp("")

	conf := app.Registry().Config()
	conf.Set("host", "localhost")
	conf.Set("port", 10010)
	conf.Set("url", "http://localhost:10010")

	conf.Set("users.emailConfirmationPath", "?confirm-email={token}")
	conf.Set("users.passwordResetPath", "?reset-password={token}")

	backend := memory.New()
	app.RegisterBackend(backend)

	// Build user service.

	userService := users.NewService(nil, backend, &UserProfile{})
	app.RegisterUserService(userService)

	// Register facebook oauth service.
	appId := "170108689991460"
	appSecret := "cb91c245199a3d3b19fdccbe0c7f93a0"
	fbService := oauth.NewFacebook(appId, appSecret)
	userService.AuthAdaptor("oauth").(*oauth.AuthAdaptorOauth).RegisterService(fbService)

	// Persist log messages in logMessages.
	app.Logger().Hooks.Add(LoggerHook{})

	app.PrepareBackends()

	return app
}
Exemple #2
0
	}

	return resp.StatusCode, &respData, nil
}

func (c *Client) GetJson(path string) (int, *Data, error) {
	return c.DoJson("GET", path, "")
}

func (c *Client) PostJson(path string, data string) (int, *Data, error) {
	return c.DoJson("POST", path, data)
}

var _ = Describe("App", func() {
	app := buildApp()
	registry := app.Registry()
	go func() {
		app.Run()
	}()
	time.Sleep(time.Millisecond * 500)

	client := NewClient("http://localhost:10010")
	var currentUser kit.User
	var currentToken string

	BeforeEach(func() {
		logMessages = nil
	})

	Describe("Usersystem", func() {
		skipUser := true