Exemple #1
0
    def test_head_location(self):
        controller = http_controller_factory(location='Paris')

        url = URL('http://goog.le')
        location = url.head_location(controller)
        controller.head_location.assert_called_once_with('http://goog.le')
        self.assertEqual('Paris', location)
Exemple #2
0
    def test_get_content(self):
        controller = http_controller_factory(content=b'my content')

        url = URL('http://google.fr')
        content = url.get_content(controller, referer='http://epf.fr')
        controller.get_content.assert_called_once_with('http://google.fr',
                                                       referer='http://epf.fr')
        self.assertEqual(b'my content', content)
Exemple #3
0
    def test_head_location(self):
        controller = http_controller_factory(location='Paris')

        url = URL('http://goog.le')
        location = url.head_location(controller)
        controller.head_location.assert_called_once_with(
            'http://goog.le')
        self.assertEqual('Paris', location)
Exemple #4
0
    def test_get_content(self):
        controller = http_controller_factory(content=b'my content')

        url = URL('http://google.fr')
        content = url.get_content(controller, referer='http://epf.fr')
        controller.get_content.assert_called_once_with(
            'http://google.fr', referer='http://epf.fr')
        self.assertEqual(b'my content', content)
Exemple #5
0
 def test_get_filename(self):
     url = URL('http://google.fr/blabla/toto.pdf')
     filename = url.get_filename()
     self.assertEqual('toto.pdf', filename)
Exemple #6
0
 def test_get_filename(self):
     url = URL('http://google.fr/blabla/toto.pdf')
     filename = url.get_filename()
     self.assertEqual('toto.pdf', filename)