def test_parse_urls(self, stub_nyp_platform_200_response): reader = PlatformResponseReader(stub_nyp_platform_200_response) urls = reader._parse_urls(reader.datas[0]) loop = 1 for u in urls: if loop == 1: assert u == { "uTypeId": 1, "url": "http://link.overdrive.com/?content", } elif loop == 2: assert u == { "uTypeId": 2, "url": "https://samples.overdrive.com/?sample_url", } elif loop == 3: assert u == { "uTypeId": 3, "url": "https://img1.od-cdn.com/ImageType-100/image.jpg", } elif loop == 4: assert u == { "uTypeId": 4, "url": "https://img1.od-cdn.com/ImageType-200/thumbnail.jpg", } loop += 1
def test_parse_urls_no_urls(self, stub_nyp_platform_200_response, stub_platform_record_missing): reader = PlatformResponseReader(stub_nyp_platform_200_response) assert reader._parse_urls(stub_platform_record_missing) == []