Beispiel #1
0
    def setup_data(self):
        self.manual_feed = testobjects.make_manual_feed()
        self.feed_with_downloads = testobjects.make_feed()
        self.feed_without_downloads = testobjects.make_feed()
        self.audio_items = []
        self.video_items = []
        self.undownloaded_items = []
        for i in xrange(10):
            self.audio_items.append(
                testobjects.make_file_item(self.feed_with_downloads,
                                           u'audio-item-%s' % i,
                                           ext='.mp3'))
            self.video_items.append(
                testobjects.make_file_item(self.manual_feed,
                                           u'video-item-%s' % i,
                                           ext='.avi'))
            self.undownloaded_items.append(
                testobjects.make_item(self.feed_without_downloads,
                                      u'feed-item-%s' % i))

        self.audio_playlist = models.SavedPlaylist(
            u'My music', [i.id for i in self.audio_items])
        # put some videos in the videos playlist.  These will be sent back by
        # the server, even if SHARE_VIDEO is not set
        self.video_playlist_items = self.video_items[:5]
        self.video_playlist = models.SavedPlaylist(
            u'My best videos', [i.id for i in self.video_playlist_items])
        app.db.finish_transaction()
        models.Item.change_tracker.reset()
Beispiel #2
0
 def test_feed_changes(self):
     self.setup_sharing_manager_backend()
     initial_revision = self.backend.data_set.revision
     new_feed = testobjects.make_feed()
     self.feed_with_downloads.set_title(u'New Title')
     self.feed_without_downloads.remove()
     self.send_changes_from_trackers()
     self.assertNotEquals(self.backend.data_set.revision, initial_revision)
     self.check_daap_list(self.backend.get_playlists(),
             [new_feed, self.feed_with_downloads, self.audio_playlist,
                 self.video_playlist])
     self.check_daap_item_deleted(self.backend.get_playlists(),
             self.feed_without_downloads)
     # test adding items
     second_revision = self.backend.data_set.revision
     for item in self.video_items:
         item.set_feed(new_feed.id)
     self.send_changes_from_trackers()
     self.assertNotEquals(self.backend.data_set.revision, second_revision)
     self.check_daap_list(self.backend.get_items(new_feed.id),
                          self.video_items)
     # test removing items
     third_revision = self.backend.data_set.revision
     for item in self.video_items[4:]:
         item.remove()
     self.send_changes_from_trackers()
     self.assertNotEquals(self.backend.data_set.revision, third_revision)
     self.check_daap_list(self.backend.get_items(new_feed.id),
                          self.video_items[:4])
Beispiel #3
0
 def test_feed_changes(self):
     self.setup_sharing_manager_backend()
     initial_revision = self.backend.data_set.revision
     new_feed = testobjects.make_feed()
     self.feed_with_downloads.set_title(u'New Title')
     self.feed_without_downloads.remove()
     self.send_changes_from_trackers()
     self.assertNotEquals(self.backend.data_set.revision, initial_revision)
     self.check_daap_list(self.backend.get_playlists(), [
         new_feed, self.feed_with_downloads, self.audio_playlist,
         self.video_playlist
     ])
     self.check_daap_item_deleted(self.backend.get_playlists(),
                                  self.feed_without_downloads)
     # test adding items
     second_revision = self.backend.data_set.revision
     for item in self.video_items:
         item.set_feed(new_feed.id)
     self.send_changes_from_trackers()
     self.assertNotEquals(self.backend.data_set.revision, second_revision)
     self.check_daap_list(self.backend.get_items(new_feed.id),
                          self.video_items)
     # test removing items
     third_revision = self.backend.data_set.revision
     for item in self.video_items[4:]:
         item.remove()
     self.send_changes_from_trackers()
     self.assertNotEquals(self.backend.data_set.revision, third_revision)
     self.check_daap_list(self.backend.get_items(new_feed.id),
                          self.video_items[:4])
Beispiel #4
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")
Beispiel #5
0
    def setup_data(self):
        self.manual_feed = testobjects.make_manual_feed()
        self.feed_with_downloads = testobjects.make_feed()
        self.feed_without_downloads = testobjects.make_feed()
        self.audio_items = []
        self.video_items = []
        self.undownloaded_items = []
        for i in xrange(10):
            self.audio_items.append(testobjects.make_file_item(
                self.feed_with_downloads, u'audio-item-%s' % i, ext='.mp3'))
            self.video_items.append(testobjects.make_file_item(
                self.manual_feed, u'video-item-%s' % i, ext='.avi'))
            self.undownloaded_items.append(testobjects.make_item(
                self.feed_without_downloads, u'feed-item-%s' % i))

        self.audio_playlist = models.SavedPlaylist(u'My music',
                [i.id for i in self.audio_items])
        # put some videos in the videos playlist.  These will be sent back by
        # the server, even if SHARE_VIDEO is not set
        self.video_playlist_items = self.video_items[:5]
        self.video_playlist = models.SavedPlaylist(u'My best videos',
                [i.id for i in self.video_playlist_items])
        app.db.finish_transaction()
        models.Item.change_tracker.reset()
Beispiel #6
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')
Beispiel #7
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.feed = testobjects.make_feed()
Beispiel #8
0
 def setUp(self):
     MiroTestCase.setUp(self)
     self.feed = testobjects.make_feed()