예제 #1
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.manual_feed = Feed(u'dtv:manualFeed')
     self.regular_feed = Feed(u'http://example.com/1')
     self.path, fp = self.make_temp_path_fileobj(".avi")
     fp.write("fake data")
     fp.close()
예제 #2
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.manual_feed = Feed(u'dtv:manualFeed')
     self.regular_feed = Feed(u'http://example.com/1')
     self.path, fp = self.make_temp_path_fileobj(".avi")
     fp.write("fake data")
     fp.close()
예제 #3
0
파일: infolisttest.py 프로젝트: kmshi/miro
 def setUp(self):
     MiroTestCase.setUp(self)
     FakeInfo.counter = itertools.count()
     self.infolist = self.build_infolist()
     self.sorter = self.sort_key_func
     self.reverse = False
     self.correct_infos = []
예제 #4
0
파일: itemtest.py 프로젝트: cool-RR/Miro
 def setUp(self):
     MiroTestCase.setUp(self)
     self.feed = Feed(u'http://example.com/1')
     self.item1 = Item(fp_values_for_url(u'http://example.com/1/item1'),
             feed_id=self.feed.id)
     self.item2 = Item(fp_values_for_url(u'http://example.com/1/item2'),
             feed_id=self.feed.id)
예제 #5
0
파일: infolisttest.py 프로젝트: kmshi/miro
 def setUp(self):
     MiroTestCase.setUp(self)
     FakeInfo.counter = itertools.count()
     self.infolist = self.build_infolist()
     self.sorter = self.sort_key_func
     self.reverse = False
     self.correct_infos = []
예제 #6
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.feed = Feed(u'http://example.com/1')
     self.item1 = Item(fp_values_for_url(u'http://example.com/1/item1'),
                       feed_id=self.feed.id)
     self.item2 = Item(fp_values_for_url(u'http://example.com/1/item2'),
                       feed_id=self.feed.id)
예제 #7
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.items = []
     self.feed = Feed(u'dtv:manualFeed')
     self.items = [
         testobjects.make_item(self.feed, u'item-1'),
         testobjects.make_item(self.feed, u'item-2'),
     ]
예제 #8
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.items = []
     self.feed = Feed(u'dtv:manualFeed')
     self.items = [
         testobjects.make_item(self.feed, u'item-1'),
         testobjects.make_item(self.feed, u'item-2'),
     ]
예제 #9
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.device = mock.Mock()
     self.device.database = devices.DeviceDatabase()
     self.device.database[u'audio'] = {}
     self.device.mount = self.tempdir
     self.device.id = 123
     self.device.name = 'Device'
     self.device.size = 1024000
     os.makedirs(os.path.join(self.device.mount, '.miro'))
예제 #10
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.mock_grab_headers = self.patch_for_test("miro.httpclient.grab_headers")
     self.mock_try_scraping_url = self.patch_for_test("miro.flashscraper.try_scraping_url")
     self.mock_send = self.patch_for_test("miro.dl_daemon.command.Command.send")
     self.feed = testobjects.make_feed()
     self.url = u"http://example.com/my-video.mp4"
     self.item = testobjects.make_item(self.feed, u"my item", url=self.url)
     self.downloading_path = os.path.join(self.tempdir, "Incomplete Downloads", "download.mp4")
     self.final_path = os.path.join(self.tempdir, "download.mp4")
예제 #11
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.init_data_package()
     self.feed = models.Feed(u'http://example.com/feed.rss')
     self.items = [testobjects.make_item(self.feed, u'item-%s' % i)
                   for i in xrange(10)]
     app.db.finish_transaction()
     self.pool = itemlist.ItemListPool()
     self.item_list = self.pool.get('feed', self.feed.id)
     self.item_list2 = self.pool.get('feed', self.feed.id + 1)
예제 #12
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.mock_item_list_pool = self.patch_for_test(
         'miro.app.item_list_pool')
     self.items = [
         mock.Mock(id=0, title='one', is_playable=True),
         mock.Mock(id=1, title='two', is_playable=True),
         mock.Mock(id=2, title='three', is_playable=False),
         mock.Mock(id=3, title='four', is_playable=True),
     ]
     self.item_list = MockItemList(self.items)
예제 #13
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.mock_item_list_pool = self.patch_for_test(
         'miro.app.item_list_pool')
     self.items = [
         mock.Mock(id=0, title='one', is_playable=True),
         mock.Mock(id=1, title='two', is_playable=True),
         mock.Mock(id=2, title='three', is_playable=False),
         mock.Mock(id=3, title='four', is_playable=True),
     ]
     self.item_list = MockItemList(self.items)
예제 #14
0
    def setUp(self):
        MiroTestCase.setUp(self)
        logger = logging.getLogger()
        self._log_level = logger.getEffectiveLevel()
        self._old_filters = logger.filters

        self.log_filter = LogFilter()
        logger.setLevel(logging.DEBUG)
        for old_filter in logger.filters:
            logger.removeFilter(old_filter)
        logger.addFilter(self.log_filter)
예제 #15
0
    def setUp(self):
        app.testing_mdp = True # hack to override moviedata's in_unit_tests hack
        MiroTestCase.setUp(self)
        self.feed = models.Feed(u'dtv:manualFeed')
        mp3_path = resources.path("testdata/metadata/mp3-0.mp3")
        webm_path = resources.path("testdata/metadata/webm-0.webm")
        jpg_path = resources.path("testdata/dean.jpg")

        self.audio_item = models.FileItem(mp3_path, self.feed.id)
        self.video_item = models.FileItem(webm_path, self.feed.id)
        self.other_item = models.FileItem(jpg_path, self.feed.id)
예제 #16
0
    def setUp(self):
        MiroTestCase.setUp(self)
        self.feed = feed.Feed(u"http://feed.org")
        self.i1 = item.Item(item.FeedParserValues({'title': u'item1'}),
                            feed_id=self.feed.id)
        self.i2 = item.Item(item.FeedParserValues({'title': u'item2'}),
                            feed_id=self.feed.id)

        self.feed2 = feed.Feed(u"http://feed.com")
        self.i3 = item.Item(item.FeedParserValues({'title': u'item3'}),
                            feed_id=self.feed2.id)
예제 #17
0
    def setUp(self):
        MiroTestCase.setUp(self)
        ITUNES_FILE = "iTunes Music Library.xml"

        # import_itunes_path expects a named file directory path that
        # contains filename ITUNES_FILE underneath it.
        fd = -1
        self.tmpf_path = os.path.join(self.tempdir, ITUNES_FILE)
        fd = os.open(self.tmpf_path, os.O_RDWR | os.O_CREAT | os.O_EXCL)
        self.tmpf = os.fdopen(fd, 'w')
        self.file_url = "file://localhost"
예제 #18
0
    def setUp(self):
        MiroTestCase.setUp(self)
        self.feed = feed.Feed(u"http://feed.org")
        self.i1 = item.Item(item.FeedParserValues({'title': u'item1'}),
                            feed_id=self.feed.id)
        self.i2 = item.Item(item.FeedParserValues({'title': u'item2'}),
                            feed_id=self.feed.id)

        self.feed2 = feed.Feed(u"http://feed.com")
        self.i3 = item.Item(item.FeedParserValues({'title': u'item3'}),
                            feed_id=self.feed2.id)
예제 #19
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.init_data_package()
     self.feed = models.Feed(u'http://example.com/feed.rss')
     self.items = [testobjects.make_item(self.feed, u'item-%s' % i)
                   for i in xrange(10)]
     app.db.finish_transaction()
     self.item_list = itemlist.ItemList('feed', self.feed.id)
     self.items_changed_handler = mock.Mock()
     self.list_changed_handler = mock.Mock()
     self.item_list.connect("items-changed", self.items_changed_handler)
     self.item_list.connect("list-changed", self.list_changed_handler)
예제 #20
0
파일: searchtest.py 프로젝트: ShriramK/miro
 def setUp(self):
     MiroTestCase.setUp(self)
     self.feed = models.Feed(u'http://example.com/')
     self.initial_list = []
     self.added_objects = []
     self.changed_objects = []
     self.removed_objects = []
     self.filterer = SearchFilter()
     self.info1 = self.make_info(u'info one')
     self.info2 = self.make_info(u'info two')
     self.info3 = self.make_info(u'info three')
     self.info4 = self.make_info(u'info four')
예제 #21
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.renderer = itemrenderer.ItemRenderer()
     self.feed = models.Feed(u'http://example.com/feed.rss')
     self.item = testobjects.make_item(self.feed, u'item')
     self.manual_feed = models.Feed(u'dtv:manualFeed',
                                    initiallyAutoDownloadable=False)
     self.file_item = models.FileItem(self.make_temp_path(),
                                      self.manual_feed.id)
     app.saved_items = set()
     app.playback_manager = mock.Mock()
     app.playback_manager.item_resume_policy.return_value = False
예제 #22
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.renderer = itemrenderer.ItemRenderer()
     self.feed = models.Feed(u'http://example.com/feed.rss')
     self.item = testobjects.make_item(self.feed, u'item')
     self.manual_feed = models.Feed(u'dtv:manualFeed',
                                    initiallyAutoDownloadable=False)
     self.file_item = models.FileItem(self.make_temp_path(),
                                      self.manual_feed.id)
     app.saved_items = set()
     app.playback_manager = mock.Mock()
     app.playback_manager.item_resume_policy.return_value = False
예제 #23
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.feed = models.Feed(u'http://example.com/')
     self.initial_list = []
     self.added_objects = []
     self.changed_objects = []
     self.removed_objects = []
     self.filterer = SearchFilter()
     self.info1 = self.make_info(u'info one')
     self.info2 = self.make_info(u'info two')
     self.info3 = self.make_info(u'info three')
     self.info4 = self.make_info(u'info four')
예제 #24
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.init_data_package()
     self.feed = models.Feed(u'http://example.com/feed.rss')
     self.items = [
         testobjects.make_item(self.feed, u'item-%s' % i)
         for i in xrange(10)
     ]
     app.db.finish_transaction()
     self.pool = itemlist.ItemListPool()
     self.item_list = self.pool.get('feed', self.feed.id)
     self.item_list2 = self.pool.get('feed', self.feed.id + 1)
예제 #25
0
파일: itemtest.py 프로젝트: codito/miro
 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()
예제 #26
0
파일: itemtest.py 프로젝트: kmshi/miro
 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()
예제 #27
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.init_data_package()
     self.feed = models.Feed(u'http://example.com/feed.rss')
     self.items = [
         testobjects.make_item(self.feed, u'item-%s' % i)
         for i in xrange(10)
     ]
     app.db.finish_transaction()
     self.item_list = itemlist.ItemList('feed', self.feed.id)
     self.items_changed_handler = mock.Mock()
     self.list_changed_handler = mock.Mock()
     self.item_list.connect("items-changed", self.items_changed_handler)
     self.item_list.connect("list-changed", self.list_changed_handler)
예제 #28
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.idle_scheduler = mock.Mock()
     self.init_data_package()
     self.setup_items()
     self.setup_connection_pool()
     self.force_wal_mode()
     self.setup_mock_message_handler()
     self.setup_tracker()
     # make the change tracker start fresh for the unittests.  Since we
     # don't know which change tracker our item type will use, we go for
     # the sledge hammer approach here and reset them all.
     models.Item.change_tracker.reset()
     models.DeviceItem.change_tracker.reset()
     models.SharingItem.change_tracker.reset()
예제 #29
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.idle_scheduler = mock.Mock()
     self.init_data_package()
     self.setup_items()
     self.setup_connection_pool()
     self.force_wal_mode()
     self.setup_mock_message_handler()
     self.setup_tracker()
     # make the change tracker start fresh for the unittests.  Since we
     # don't know which change tracker our item type will use, we go for
     # the sledge hammer approach here and reset them all.
     models.Item.change_tracker.reset()
     models.DeviceItem.change_tracker.reset()
     models.SharingItem.change_tracker.reset()
예제 #30
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.mock_grab_headers = self.patch_for_test(
         'miro.httpclient.grab_headers')
     self.mock_try_scraping_url = self.patch_for_test(
         'miro.flashscraper.try_scraping_url')
     self.mock_send = self.patch_for_test(
         'miro.dl_daemon.command.Command.send')
     self.feed = testobjects.make_feed()
     self.url = u'http://example.com/my-video.mp4'
     self.item = testobjects.make_item(self.feed, u'my item', url=self.url)
     self.downloading_path = os.path.join(self.tempdir,
                                          'Incomplete Downloads',
                                          'download.mp4')
     self.final_path = os.path.join(self.tempdir, 'download.mp4')
예제 #31
0
    def setUp(self):
        MiroTestCase.setUp(self)
        self.save_path = os.path.join(self.tempdir, "test-db")
        # set up an error handler that tells LiveStorage to use temporary
        # storage if it fails to open a new database
        use_temp = storedatabase.LiveStorageErrorHandler.ACTION_USE_TEMPORARY
        self.error_handler = mock.Mock()
        self.error_handler.handle_open_error.return_value = use_temp

        self.row_data = []

        self.mock_add_timeout = mock.Mock()
        self.patch_function("miro.eventloop.add_timeout", self.mock_add_timeout)

        self.real_sqlite3_connect = sqlite3.connect
        self.patch_function("sqlite3.connect", self.mock_sqlite3_connect)
예제 #32
0
    def setUp(self):
        MiroTestCase.setUp(self)
        self.save_path = os.path.join(self.tempdir, 'test-db')
        # set up an error handler that tells LiveStorage to use temporary
        # storage if it fails to open a new database
        use_temp = storedatabase.LiveStorageErrorHandler.ACTION_USE_TEMPORARY
        self.error_handler = mock.Mock()
        self.error_handler.handle_open_error.return_value = use_temp

        self.row_data = []

        self.mock_add_timeout = mock.Mock()
        self.patch_function('miro.eventloop.add_timeout',
                            self.mock_add_timeout)

        self.real_sqlite3_connect = sqlite3.connect
        self.patch_function('sqlite3.connect', self.mock_sqlite3_connect)
예제 #33
0
파일: itemtest.py 프로젝트: cool-RR/Miro
 def setUp(self):
     MiroTestCase.setUp(self)
     self._expire_after_x_days_value = app.config.get(prefs.EXPIRE_AFTER_X_DAYS)
     app.config.set(prefs.EXPIRE_AFTER_X_DAYS, 6)
예제 #34
0
 def setUp(self):
     self.buffer = net.NetworkBuffer()
     MiroTestCase.setUp(self)
예제 #35
0
파일: utiltest.py 프로젝트: foxi/miro
 def setUp(self):
     MiroTestCase.setUp(self)
     self.cache = MockCache(2)
예제 #36
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.display_types = set(WidgetStateStore.get_display_types())
예제 #37
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.tmp_path = self.make_temp_path()
예제 #38
0
파일: utiltest.py 프로젝트: foxi/miro
 def setUp(self):
     MiroTestCase.setUp(self)
     self.support_dir = self.make_temp_dir_path()
     self.correct_files = []
     self.skip_dirs = []
     self.setup_support_dir()
예제 #39
0
파일: utiltest.py 프로젝트: zjmmjzzjm/miro
 def setUp(self):
     MiroTestCase.setUp(self)
     self.support_dir = self.make_temp_dir_path()
     self.correct_files = []
     self.skip_dirs = []
     self.setup_support_dir()
예제 #40
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.setup_data()
     self.setup_tracker()
예제 #41
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.items = []
     self.feed = Feed(u'dtv:manualFeed')
     self.make_item(u'http://example.com/')
     self.make_item(u'http://example.com/2')
예제 #42
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.message_one_count = 0
     messages.BackendMessage.install_handler(TestMessageHandler(self))
예제 #43
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self._expire_after_x_days_value = app.config.get(
         prefs.EXPIRE_AFTER_X_DAYS)
     app.config.set(prefs.EXPIRE_AFTER_X_DAYS, 6)
예제 #44
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.frontend = mock.Mock()
     self.run_choice_dialog = self.frontend.run_choice_dialog
     self.db_error_handler = dberrors.DBErrorHandler(self.frontend)
예제 #45
0
파일: devicestest.py 프로젝트: devcult/miro
 def setUp(self):
     MiroTestCase.setUp(self)
     # setup a device object
     self.device = testobjects.make_mock_device(no_database=True)
예제 #46
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.init_data_package()
     self.idle_scheduler = mock.Mock()
     self.feed, self.items = testobjects.make_feed_with_items(10)
     app.db.finish_transaction()
예제 #47
0
파일: messagetest.py 프로젝트: kmshi/miro
 def setUp(self):
     MiroTestCase.setUp(self)
     self.message_one_count = 0
     messages.BackendMessage.install_handler(TestMessageHandler(self))
예제 #48
0
파일: metadatatest.py 프로젝트: codito/miro
 def setUp(self):
     MiroTestCase.setUp(self)
예제 #49
0
파일: messagetest.py 프로젝트: kmshi/miro
 def setUp(self):
     MiroTestCase.setUp(self)
     self.items = []
     self.feed = Feed(u'dtv:manualFeed')
     self.make_item(u'http://example.com/')
     self.make_item(u'http://example.com/2')
예제 #50
0
 def setUp(self):
     MiroTestCase.setUp(self)
     TestDDBObject.track_attribute_changes('foo')
     self.reload_database(schema_version=0,
             object_schemas=[TestDDBObjectSchema])
예제 #51
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.feed = Feed(u'http://example.com/1')
     self.added_items = {}
     self.deleted_paths = []
예제 #52
0
 def setUp(self):
     self.callbacks = []
     self.signaller = TestSignaller()
     MiroTestCase.setUp(self)
예제 #53
0
 def setUp(self):
     MiroTestCase.setUp(self)
     # No need to have Share objects create real SharingItemTrackerImpl
     # instances
     self.MockSharingItemTrackerIpml = self.patch_for_test(
         'miro.sharing.SharingItemTrackerImpl')
예제 #54
0
파일: utiltest.py 프로젝트: zjmmjzzjm/miro
 def setUp(self):
     MiroTestCase.setUp(self)
     self.cache = MockCache(2)
예제 #55
0
 def setUp(self):
     MiroTestCase.setUp(self)
     TestDDBObject.track_attribute_changes('foo')
     self.reload_database(schema_version=0,
                          object_schemas=[TestDDBObjectSchema])
예제 #56
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.reset_ext_storage_manager()
예제 #57
0
파일: gtcachetest.py 프로젝트: kmshi/miro
 def setUp(self):
     MiroTestCase.setUp(self)
     self.oldlevel = logging.getLogger().level
     logging.getLogger().setLevel(logging.ERROR)