예제 #1
0
func Test_applyPermissons(t *testing.T) {

	mockPerms := clients.NewGatekeeperMock()

	api := Api{permsApi: mockPerms}

	done := api.applyPermissons("123", "456", "view,upload")

	if done == false {
		t.Fatal("applyPermissons should have returned true on success")
	}
}
예제 #2
0
	"github.com/tidepool-org/go-common/clients"
	"github.com/tidepool-org/go-common/clients/mongo"
	"github.com/tidepool-org/go-common/clients/shoreline"
)

const (
	user_secert_token = "its no secret"
)

var (
	api = InitApi(
		ApiConfig{ExpireDays: 20},
		NewOAuthStorage(&mongo.Config{ConnectionString: "mongodb://localhost/oauth_test"}),
		shoreline.NewMock(user_secert_token),
		clients.NewGatekeeperMock(),
	)
)

//using the attached mongo session setup and required data for testing.
//NOTE: we just blow away the test data for each test
func setupClientForTest() {
	cpy := api.storage.session.Copy()
	defer cpy.Close()
	//just drop and don't worry about any errors
	cpy.DB("").DropDatabase()
	//TODO: we are reusing `a_client` from the oauthStore_test.go tests. We need to do this in a nicer way
	api.storage.SetClient(a_client.GetId(), a_client)
}

func Test_signupFormValid(t *testing.T) {