Exemplo n.º 1
0
func handleAuthentication(client *trackerapi.Client, terminal *term.Terminal) {
	if !client.IsAuthenticated() {
		username := terminal.Prompt("Username: "******"Password: ", term.DisableEcho)
		client.Authenticate(username, password)
	}
}
Exemplo n.º 2
0
package trackerapi_test

import (
	. "github.com/pivotal/gumshoe/repos/ginkgo"
	. "github.com/pivotal/gumshoe/repos/gomega"
	"github.com/pivotal/gumshoe/trackerapi"
	"github.com/pivotal/gumshoe/trackerapi/request"
	"github.com/pivotal/gumshoe/trackerapi/store"
)

var _ = Describe("Client", func() {
	var (
		json   string
		client *trackerapi.Client
		ts     *TestServer
	)

	BeforeEach(func() {
		config := trackerapi.NewConfiguration()
		config.Store = store.NewMemoryStore()
		config.Store.Set("APIToken", "abcde90792f3898ab464cd3412345")
		client, _ = trackerapi.NewClient(config)
	})

	AfterEach(func() {
		client.Cleanup()
		ts.Close()
	})

	Describe("Me", func() {
		BeforeEach(func() {