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()
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()
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))