Beispiel #1
0
    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/')
Beispiel #2
0
    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/')
Beispiel #3
0
    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')
Beispiel #4
0
    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')