示例#1
0
func TestFlickrProviderSearch(t *testing.T) {
	cfg := getConfig()
	p := NewFlickrProvider(cfg.Get("flickr_key"), cfg.Get("flickr_secret_key"))
	result, err := p.Search("nature", 1)

	test.AssertNotErr("FlickrProvider.Search()", err, t)
	test.AssertNot("FlickrProvider.Search() SearchResult.Pages", 0, result.Pages, t)
}
示例#2
0
func TestDiscoverDownloadFile(t *testing.T) {
	cfg := getConfig()
	dest := path.Join(getRootDir(), cfg.Get("tmp_dir"), "downloadTest.jpg")
	p := NewFlickrProvider(cfg.Get("flickr_key"), cfg.Get("flickr_secret_key"))
	img := NewDiscover(p)
	filename, err := img.DownloadFile("https://farm6.staticflickr.com/5337/17095007133_61efedd70b_z.jpg", dest)

	test.AssertNotErr("Discover.DownloadFile", err, t)
	test.AssertNot("Discover.DownloadFile", "", filename, t)
}