Esempio n. 1
0
    def test_should_send_tags_to_capi(self):
        ds = ItemDataSource(url_capturing_client, content_id='music')
        ds.tags = ['-type/audio', 'tone/news']

        self.check_data_source_url(ds,
                                   '/music',
                                   show_fields=Fields,
                                   user_tier='internal',
                                   page_size=DEFAULT_PAGE_SIZE,
                                   tag='-type/audio,tone/news')
Esempio n. 2
0
 def test_should_append_blog_item_to_content_where_there_is_one_blog_entry(
         self):
     fetcher = ApiStubFetcher()
     client = ApiClient('http://content.guardianapis.com/',
                        API_KEY,
                        fetcher=fetcher)
     blog_data_source = ItemDataSource(client, '/i/want/a/blog/item')
     section_data_source = ItemDataSource(client, '/i/want/a/section')
     data_source = ItemPlusBlogDataSource(section_data_source,
                                          blog_data_source)
     data = data_source.fetch_data()
     assert len(data) == 4
     result = data[0]
     assert result['id'] == 'blog id'
     assert result['sectionName'] == 'blog section name'
     assert result['sectionId'] == 'blog section id'
     result = data[1]
     assert result['id'] == 'section id'
     assert result['sectionName'] == 'Politics'
     assert result['sectionId'] == 'politics'
Esempio n. 3
0
 def test_should_call_api_with_correct_url_for_life_and_technology(self):
     tech_ds = ItemDataSource(url_capturing_client,
                              'technology',
                              show_editors_picks=True)
     tech_ds.name = 'technology' + url_capturing_client.edition
     self.check_data_source_url(tech_ds,
                                '/technology',
                                show_fields=Fields,
                                show_editors_picks='true',
                                page_size='10',
                                user_tier='internal')