Beispiel #1
0
 def test_make_item_for_nonexistent_path(self):
     feed = Feed(u'dtv:manualFeed', initiallyAutoDownloadable=False)
     # test that creating a file item for a path that doesn't exist doesn't
     # cause a crash.  A soft failure is okay though.
     app.controller.failed_soft_okay = True
     Item._allow_nonexistent_paths = False
     FileItem("/non/existent/path/", feed.id)
Beispiel #2
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.feed = Feed(u'dtv:manualFeed', initiallyAutoDownloadable=False)
     self.mytempdir = FilenameType(tempfile.mkdtemp(dir=self.tempdir))
     self._make_fake_item("pcf.avi")
     self._make_fake_item("dean.avi")
     self._make_fake_item("npr.txt")
     self.container_item = FileItem(self.mytempdir, self.feed.id)
     for child in self.container_item.get_children():
         if child.filename.endswith("avi"):
             child.file_type = u'video'
         else:
             child.file_type = u'other'
         child.signal_change()
Beispiel #3
0
 def setUp(self):
     EventLoopTest.setUp(self)
     self.feed = Feed(u'dtv:manualFeed', initiallyAutoDownloadable=False)
     self.mytempdir = FilenameType(tempfile.mkdtemp(dir=self.tempdir))
     self._make_fake_item("pcf.avi")
     self._make_fake_item("dean.avi")
     self._make_fake_item("npr.txt")
     self.container_item = FileItem(self.mytempdir, self.feed.id)
     # Give the iterators some time to run
     self.process_idles()
     for child in self.container_item.get_children():
         if child.filename.endswith("avi"):
             child.file_type = u'video'
         else:
             child.file_type = u'other'
         child.signal_change()
Beispiel #4
0
 def make_new_file_item(self):
     path, fp = self.make_temp_path_fileobj(".avi")
     fp.write("fake data")
     fp.close()
     return FileItem(path, self.manual_feed.id)
Beispiel #5
0
 def add_item(self, filename):
     path = os.path.join(self.tempdir, unicode_to_filename(filename))
     # create a bogus file so we don't get a warning when we create a
     # filename.
     open(path, 'wb').write("data")
     self.added_items[path] = FileItem(path, self.feed.id)