Logo Search packages:      
Sourcecode: jockey version File versions  Download package

def ui::UITest::test_download_local_nocancel (   self  ) 

download_url(), local file://, no cancelling

Definition at line 450 of file ui.py.

00450                                           :
        '''download_url(), local file://, no cancelling'''

        ui = sandbox.TestUI()

        # temporary file
        (fname, h) = ui.download_url('file://' + self.big_file)
        self.assertEqual(open(fname).read(), self.big_file_contents)
        os.unlink(fname)

        self.assertRaises(IndexError, ui.pop_error)

        # we got progress reports
        self.assertEqual(ui.cur_download, ['file://' + self.big_file,
            len(self.big_file_contents), len(self.big_file_contents)])

        # specified file name
        dest = os.path.join(OSLib.inst.workdir, 'destfile')
        (fname, h) = ui.download_url('file://' + self.big_file, dest)
        self.assertEqual(fname, dest)
        self.assertEqual(open(dest).read(), self.big_file_contents)
        os.unlink(dest)

        self.assertRaises(IndexError, ui.pop_error)

        # we got progress reports
        self.assertEqual(ui.cur_download, ['file://' + self.big_file,
            len(self.big_file_contents), len(self.big_file_contents)])

        # nonexisting file
        (fname, h) = ui.download_url('file://junk/nonexisting')
        self.assertEqual(fname, None)

        # one error message about download failure
        self.assert_(ui.pop_error())
        self.assertRaises(IndexError, ui.pop_error)

    def test_download_local_cancel(self):


Generated by  Doxygen 1.6.0   Back to index