def test_build_query_param_dict_with_givens(): cur_time = '12345' nxt_time = '12346' flickr_api_key = 'notset' actual_query_param_dict = flickr._build_query_param_dict( cur_time, nxt_time, 3, 'test', api_key=flickr_api_key, license_info={ '1': ('by-nc-sa', '2.0'), '2': ('by-nc', '2.0'), }, limit=10, default_query_param={ 'method': 'flickr.photos.search', 'media': 'photos', 'extras': 'url_t,url_s,url_m,url_l,views', 'nojsoncallback': 1, }) expect_query_param_dict = { 'method': 'flickr.photos.search', 'media': 'photos', 'extras': 'url_t,url_s,url_m,url_l,views', 'nojsoncallback': 1, 'min_test_date': cur_time, 'max_test_date': nxt_time, 'page': 3, 'api_key': flickr_api_key, 'license': '1,2', 'per_page': 10, } assert actual_query_param_dict == expect_query_param_dict
def test_build_query_param_dict_default(): cur_time = '12345' nxt_time = '12346' flickr_api_key = 'notset' actual_query_param_dict = flickr._build_query_param_dict( cur_time, nxt_time, 3, 'test', api_key=flickr_api_key ) expect_query_param_dict = { 'media': 'photos', 'content_type': 1, 'extras': 'description,license,date_upload,date_taken,owner_name,tags,o_dims,url_t,url_s,url_m,url_l,views', 'format': 'json', 'nojsoncallback': 1, 'min_test_date': cur_time, 'max_test_date': nxt_time, 'page': 3, 'api_key': flickr_api_key, 'license': '1,2,3,4,5,6,9,10', 'per_page': 500, } assert actual_query_param_dict == expect_query_param_dict