Esempio n. 1
0
func (t *AppTest) TestThatConsumerUserServiceSetsMessageWhenInvalidAction() {
	uar := &consumers.UserAccessRequest{Username: "******", Project: "testproject", Action: "poo"}
	downloader := consumers.NewUserService("http://somewhere.net", *uar)
	t.AssertEqual(false, downloader.Can())
	myr := downloader.Response.(*consumers.UserAccessResponse)
	t.AssertEqual("poo is not in AllowedActions", myr.Message)
}
Esempio n. 2
0
func (t *AppTest) TestConsumerUserServiceResponds_Can() {
	uar := &consumers.UserAccessRequest{Username: "******", Project: "testproject", Action: "download"}
	downloader := consumers.NewUserService("http://somewhere.net", *uar)
	downloader.JsonResponse(mock_get_page("http://somewhere.net", true))
	//	fmt.Printf("Can: %s\n", downloader.Can())
	t.AssertEqual(true, downloader.Can())
}
Esempio n. 3
0
func (t *AppTest) TestThatConsumerUserServiceRespondsWhenFalse() {
	uar := &consumers.UserAccessRequest{Username: "******", Project: "testproject", Action: "download"}
	downloader := consumers.NewUserService("http://somewhere.net", *uar)
	//	fmt.Printf("Can: %s\n", downloader.Can())
	t.AssertEqual(false, downloader.Can())
}