示例#1
0
    def test_ingest_with_existing_banner_image(self):
        programs = self.mock_api()

        for program_data in programs:
            banner_image_url = program_data.get('banner_image_urls',
                                                {}).get('w1440h480')
            if banner_image_url:
                responses.add_callback(responses.GET,
                                       banner_image_url,
                                       callback=mock_jpeg_callback(),
                                       content_type=JPEG)

        self.loader.ingest()
        # Verify the API was called with the correct authorization header
        self.assert_api_called(2)

        for program in programs:
            self.assert_program_loaded(program)
            self.assert_program_banner_image_loaded(program)
示例#2
0
    def test_ingest_with_existing_banner_image(self):
        programs = self.mock_api()

        for program_data in programs:
            banner_image_url = program_data.get('banner_image_urls', {}).get('w1440h480')
            if banner_image_url:
                responses.add_callback(
                    responses.GET,
                    banner_image_url,
                    callback=mock_jpeg_callback(),
                    content_type=JPEG
                )

        self.loader.ingest()
        # Verify the API was called with the correct authorization header
        self.assert_api_called(2)

        for program in programs:
            self.assert_program_loaded(program)
            self.assert_program_banner_image_loaded(program)