コード例 #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/')
コード例 #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/')
コード例 #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')
コード例 #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')