Пример #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)
}
Пример #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())
}
Пример #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())
}