Пример #1
0
    def test_download_all(self):
        p = test.get_latest_presentation(self.iq)
        n = min(len(p.metadata['slides']), 5)

        self.assert_tmp_dir_is_empty()
        self.iq.download_all(p.metadata['slides'][:n], self.tmp_dir)
        self.assert_tmp_dir_nb_files(n)
Пример #2
0
    def test_download_all(self):
        p = test.get_latest_presentation(self.iq)
        n = min(len(p.metadata['slides']), 5)

        self.assert_tmp_dir_is_empty()
        self.iq.download_all(p.metadata['slides'][:n], self.tmp_dir)
        self.assert_tmp_dir_nb_files(n)
Пример #3
0
    def test_download_override(self):
        p = test.get_latest_presentation(self.iq)

        self.assert_tmp_dir_is_empty()
        self.iq.download(p.metadata['slides'][0], self.tmp_dir)
        self.assert_tmp_dir_nb_files(1)
        self.iq.download(p.metadata['slides'][0], self.tmp_dir)
        self.assert_tmp_dir_nb_files(1)
Пример #4
0
    def test_download_override(self):
        p = test.get_latest_presentation(self.iq)

        self.assert_tmp_dir_is_empty()
        self.iq.download(p.metadata['slides'][0], self.tmp_dir)
        self.assert_tmp_dir_nb_files(1)
        self.iq.download(p.metadata['slides'][0], self.tmp_dir)
        self.assert_tmp_dir_nb_files(1)
Пример #5
0
    def test_download_custom_name(self):
        p = test.get_latest_presentation(self.iq)

        self.assert_tmp_dir_is_empty()
        self.iq.download(p.metadata['slides'][0], self.tmp_dir)
        self.assert_tmp_dir_nb_files(1)
        self.iq.download(p.metadata['slides'][0], self.tmp_dir, filename="toto")
        self.assert_tmp_dir_nb_files(2)
        self.assertIn("toto", os.listdir(self.tmp_dir))
Пример #6
0
    def test_download(self):
        p = test.get_latest_presentation(self.iq)

        self.assert_tmp_dir_is_empty()
        self.iq.download(p.metadata['slides'][0], self.tmp_dir)
        self.assert_tmp_dir_nb_files(1)
        self.iq.download(p.metadata['url'], self.tmp_dir)
        self.assert_tmp_dir_nb_files(2)
        with self.assertRaises(client.DownloadError):
            self.iq.download(client.get_url("/IDONOTEXIST"), self.tmp_dir)
        self.assert_tmp_dir_nb_files(2)
Пример #7
0
    def test_download_custom_name(self):
        p = test.get_latest_presentation(self.iq)

        self.assert_tmp_dir_is_empty()
        self.iq.download(p.metadata['slides'][0], self.tmp_dir)
        self.assert_tmp_dir_nb_files(1)
        self.iq.download(p.metadata['slides'][0],
                         self.tmp_dir,
                         filename="toto")
        self.assert_tmp_dir_nb_files(2)
        self.assertIn("toto", os.listdir(self.tmp_dir))
Пример #8
0
    def test_download(self):
        p = test.get_latest_presentation(self.iq)

        self.assert_tmp_dir_is_empty()
        self.iq.download(p.metadata['slides'][0], self.tmp_dir)
        self.assert_tmp_dir_nb_files(1)
        self.iq.download(p.metadata['url'], self.tmp_dir)
        self.assert_tmp_dir_nb_files(2)
        with self.assertRaises(client.DownloadError):
            self.iq.download(client.get_url("/IDONOTEXIST"), self.tmp_dir)
        self.assert_tmp_dir_nb_files(2)
Пример #9
0
 def test_fetch_no_cache(self):
     p = test.get_latest_presentation(self.iq)
     content = self.iq.fetch_no_cache(p.metadata['slides'][0])
     self.assertIsInstance(content, basestring)
     self.assertGreater(len(content), 1000)
Пример #10
0
 def test_presentation_latest(self):
     p = test.get_latest_presentation(self.iq)
     self.assertValidPresentationMetadata(p.metadata)
Пример #11
0
 def test_fetch_no_cache(self):
     p = test.get_latest_presentation(self.iq)
     content = self.iq.fetch_no_cache(p.metadata['slides'][0])
     self.assertIsInstance(content, bytes)
     self.assertGreater(len(content), 1000)
 def test_presentation_latest(self):
     p = test.get_latest_presentation(self.iq)
     self.assertValidPresentationMetadata(p.metadata)