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

def ui::UITest::test_download_local_cancel (   self  ) 

download_url(), local file://, cancelling

Definition at line 487 of file ui.py.

00487                                         :
        '''download_url(), local file://, cancelling'''

        ui = sandbox.TestUI()

        # temporary file
        ui.cancel_download = True
        (fname, h) = ui.download_url('file://' + self.big_file)
        self.assertEqual(fname, None)

        # we got progress reports
        self.assertEqual(ui.cur_download[0], 'file://' + self.big_file)
        self.assertEqual(ui.cur_download[2], len(self.big_file_contents))
        ratio = float(ui.cur_download[1])/len(self.big_file_contents)
        self.assert_(ratio >= 0.3, ratio)
        self.assert_(ratio < 0.5)

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

        # we got progress reports
        self.assertEqual(ui.cur_download[0], 'file://' + self.big_file)
        self.assertEqual(ui.cur_download[2], len(self.big_file_contents))
        ratio = float(ui.cur_download[1])/len(self.big_file_contents)
        self.assert_(ratio >= 0.3, ratio)
        self.assert_(ratio < 0.5)

    def _fork_http_server(self):


Generated by  Doxygen 1.6.0   Back to index