Exemplo n.º 1
0
    def test_download_timeout(self, exists, isdir):
        exists.return_value = True
        isdir.return_value = True
        with self.assertRaises(TimeoutError):
            downloader = Downloader('test')
            downloader.url = Mock(return_value="http://www.google.com:81/")
            loop = asyncio.get_event_loop()

            with ClientSession(loop=loop) as client:
                yield from downloader.fetch_file(client, '2016-12-06-reibursements.xz')
Exemplo n.º 2
0
    def test_download_timeout(self, exists, isdir):
        exists.return_value = True
        isdir.return_value = True
        with self.assertRaises(TimeoutError):
            downloader = Downloader('test',
                                    bucket='serenata-de-amor-data',
                                    region_name='a-east-1',
                                    timeout=0.001)
            downloader.url = Mock(return_value="http://www.google.com:81/")
            loop = asyncio.get_event_loop()

            with ClientSession(loop=loop) as client:
                yield from downloader.fetch_file(
                    client, '2016-12-06-reibursements.xz')
Exemplo n.º 3
0
 def test_url(self, exists, isdir):
     exists.return_value = True
     isdir.return_value = True
     downloader = Downloader('test', bucket='bucket', region_name='south')
     expected = 'https://s3-south.amazonaws.com/bucket/test.xz'
     self.assertEqual(expected, downloader.url('test.xz'))
Exemplo n.º 4
0
 def test_url(self, exists, isdir):
     exists.return_value = True
     isdir.return_value = True
     downloader = Downloader('test')
     expected = 'https://nyc3.digitaloceanspaces.com/serenata-de-amor-data/test.xz'
     self.assertEqual(expected, downloader.url('test.xz'))