Esempio n. 1
0
 def test_get_file_is_directory(self):
     """PathDownloadView.get_file() raises FileNotFound if file is a
     directory."""
     view = setup_view(
         views.PathDownloadView(path=os.path.dirname(__file__)),
         'fake request')
     with self.assertRaises(exceptions.FileNotFound):
         view.get_file()
Esempio n. 2
0
    def test_get_file_does_not_exist(self):
        """PathDownloadView.get_file() raises FileNotFound if field does not
        exist.

        """
        view = setup_view(views.PathDownloadView(path='i-do-no-exist'),
                          'fake request')
        with self.assertRaises(exceptions.FileNotFound):
            view.get_file()
Esempio n. 3
0
 def test_get_file_ok(self):
     "PathDownloadView.get_file() returns ``File`` instance."
     view = setup_view(views.PathDownloadView(path=__file__),
                       'fake request')
     file_wrapper = view.get_file()
     self.assertTrue(isinstance(file_wrapper, File))