def test_medievalbooksnl_posters(self): expected = utils._load_fixture("medievalbooksnl_posters.html") with patch('requests.get') as mock: mock.return_value = MockResponse(200, expected, url='http://medievalbooks.nl/2015/09/04/medieval-posters/') html, url = infiksi.retrieve_html("http://medievalbooks.nl/2015/09/04/medieval-posters/") self.assertEquals(html, expected) self.assertEquals(url, 'http://medievalbooks.nl/2015/09/04/medieval-posters/')
def test_medievalbooksnl_posters(self): expected = utils._load_fixture("medievalbooksnl_posters.html") with patch('requests.get') as mock: mock.return_value = MockResponse( 200, expected, url='http://medievalbooks.nl/2015/09/04/medieval-posters/') html, url = infiksi.retrieve_html( "http://medievalbooks.nl/2015/09/04/medieval-posters/") self.assertEquals(html, expected) self.assertEquals( url, 'http://medievalbooks.nl/2015/09/04/medieval-posters/')
def test_page_with_redirected_result(self): with patch('requests.get') as mock: mock.return_value = MockResponse(200, '', url='http://blah') html, url = infiksi.retrieve_html('...') self.assertEquals(url, 'http://blah')