コード例 #1
0
ファイル: test_parser.py プロジェクト: erikrose/kitsune
 def test_video_modal_caption_text(self):
     """Video modal can change title and placeholder text."""
     video()
     d, _, p = doc_rev_parser("[[V:Some title|modal|placeholder=Place<b>holder</b>|title=WOOT]]")
     doc = pq(d.html)
     eq_("WOOT", doc(".video-modal")[0].attrib["title"])
     eq_("Place<b>holder</b>", doc(".video-placeholder").html().strip())
コード例 #2
0
ファイル: test_views.py プロジェクト: DWDRAEGER/kitsune
 def test_video_search(self):
     video(title='0a85171f1802a3b0d9f46ffb997ddc02-1251659983-259-2.mp4')
     video(title='another-video.mp4')
     url = reverse('gallery.search', args=['video'])
     response = self.client.get(url, {'q': '1802'}, follow=True)
     doc = pq(response.content)
     eq_(1, len(doc('#media-list li')))
コード例 #3
0
ファイル: test_templates.py プロジェクト: browning/kitsune
 def test_video_draft_post(self):
     """Posting to the page saves the field values for the video draft."""
     video(is_draft=True, creator=self.u)
     response = post(self.client, "gallery.gallery", {"title": "zTestz"}, args=["image"])
     eq_(200, response.status_code)
     doc = pq(response.content)
     # Preview for all 3 video formats: flv, ogv, webm
     eq_("zTestz", doc('#gallery-upload-modal input[name="title"]').val())
コード例 #4
0
ファイル: test_templates.py プロジェクト: tantek/kuma
 def test_video_draft_shows(self):
     """The video draft is loaded for this user."""
     video(title=get_draft_title(self.u), creator=self.u)
     response = get(self.client, 'gallery.gallery', args=['image'])
     eq_(200, response.status_code)
     doc = pq(response.content)
     # Preview for all 3 video formats: flv, ogv, webm
     eq_(3, doc('ul li.video-preview').length)
コード例 #5
0
ファイル: test_templates.py プロジェクト: rtanglao/kitsune
 def test_video_draft_shows(self):
     """The video draft is loaded for this user."""
     video(title=get_draft_title(self.u), creator=self.u)
     response = get(self.client, "gallery.gallery", args=["image"])
     eq_(200, response.status_code)
     doc = pq(response.content)
     # Preview for all 3 video formats: flv, ogv, webm
     eq_(3, doc("ul li.video-preview").length)
コード例 #6
0
ファイル: test_templates.py プロジェクト: timmi/kitsune
 def test_video_draft_shows(self):
     """The video draft is loaded for this user."""
     video(is_draft=True, creator=self.u)
     response = get(self.client, 'gallery.gallery', args=['image'])
     eq_(200, response.status_code)
     doc = pq(response.content)
     # Preview for all 3 video formats: flv, ogv, webm
     eq_(3, doc('#gallery-upload-video .preview input').length)
コード例 #7
0
ファイル: test_parser.py プロジェクト: muratmeran/kitsune
 def test_video_modal_caption_text(self):
     """Video modal can change title and placeholder text."""
     video()
     d, _, p = doc_rev_parser(
         '[[V:Some title|modal|placeholder=Place<b>holder</b>|title=WOOT]]')
     doc = pq(d.html)
     eq_('WOOT', doc('.video-modal')[0].attrib['title'])
     eq_('Place<b>holder</b>', doc('.video-placeholder').html().strip())
コード例 #8
0
ファイル: test_templates.py プロジェクト: browning/kitsune
 def test_video_draft_shows(self):
     """The video draft is loaded for this user."""
     video(is_draft=True, creator=self.u)
     response = get(self.client, "gallery.gallery", args=["image"])
     eq_(200, response.status_code)
     doc = pq(response.content)
     # Preview for all 3 video formats: flv, ogv, webm
     eq_(3, doc("#gallery-upload-video .preview input").length)
コード例 #9
0
 def test_video_modal_caption_text(self):
     """Video modal can change title and placeholder text."""
     video()
     d, _, p = doc_rev_parser(
         '[[V:Some title|modal|placeholder=Place<b>holder</b>|title=WOOT]]')
     doc = pq(d.html)
     eq_('WOOT', doc('.video-modal')[0].attrib['title'])
     eq_('Place<b>holder</b>', doc('.video-placeholder').html().strip())
コード例 #10
0
ファイル: test_templates.py プロジェクト: tantek/kuma
 def test_video_draft_post(self):
     """Posting to the page saves the field values for the video draft."""
     video(title=get_draft_title(self.u), creator=self.u)
     response = post(self.client,
                     'gallery.gallery', {'title': 'zTestz'},
                     args=['image'])
     eq_(200, response.status_code)
     doc = pq(response.content)
     # Preview for all 3 video formats: flv, ogv, webm
     eq_('zTestz', doc('#gallery-upload-modal input[name="title"]').val())
コード例 #11
0
ファイル: test_parser.py プロジェクト: erikrose/kitsune
    def test_video_cdn(self):
        """Video URLs can link to the CDN if a CDN setting is set."""
        video()
        cdn_url = "http://videos.mozilla.org/serv/sumo/"

        self.old_settings = settings.GALLERY_VIDEO_URL
        settings.GALLERY_VIDEO_URL = cdn_url
        d, _, p = doc_rev_parser("[[V:Some title]]")
        settings.GALLERY_VIDEO_URL = self.old_settings

        doc = pq(d.html)
        assert cdn_url in doc("video").attr("data-fallback")
        assert cdn_url in doc("source").eq(0).attr("src")
        assert cdn_url in doc("source").eq(1).attr("src")
コード例 #12
0
ファイル: test_parser.py プロジェクト: muratmeran/kitsune
    def test_video_cdn(self):
        """Video URLs can link to the CDN if a CDN setting is set."""
        video()
        cdn_url = 'http://videos.mozilla.org/serv/sumo/'

        self.old_settings = deepcopy(settings._wrapped.__dict__)
        settings.GALLERY_VIDEO_URL = cdn_url
        d, _, p = doc_rev_parser('[[V:Some title]]')
        settings._wrapped.__dict__ = self.old_settings

        doc = pq(d.html)
        assert cdn_url in doc('video').attr('data-fallback')
        assert cdn_url in doc('source').eq(0).attr('src')
        assert cdn_url in doc('source').eq(1).attr('src')
コード例 #13
0
    def test_video_cdn(self):
        """Video URLs can link to the CDN if a CDN setting is set."""
        video()
        cdn_url = 'http://videos.mozilla.org/serv/sumo/'

        self.old_settings = settings.GALLERY_VIDEO_URL
        settings.GALLERY_VIDEO_URL = cdn_url
        d, _, p = doc_rev_parser('[[V:Some title]]')
        settings.GALLERY_VIDEO_URL = self.old_settings

        doc = pq(d.html)
        assert cdn_url in doc('video').attr('data-fallback')
        assert cdn_url in doc('source').eq(0).attr('src')
        assert cdn_url in doc('source').eq(1).attr('src')
コード例 #14
0
 def test_new_video(self):
     """New Video is created and saved"""
     vid = video()
     eq_('Some title', vid.title)
     assert vid.webm.name.endswith('098f6b.webm')
     assert vid.ogv.name.endswith('098f6b.ogv')
     assert vid.flv.name.endswith('098f6b.flv')
コード例 #15
0
ファイル: test_models.py プロジェクト: DWDRAEGER/kitsune
 def test_new_video(self):
     """New Video is created and saved"""
     vid = video()
     eq_('Some title', vid.title)
     assert vid.webm.name.endswith('098f6b.webm')
     assert vid.ogv.name.endswith('098f6b.ogv')
     assert vid.flv.name.endswith('098f6b.flv')
コード例 #16
0
ファイル: test_parser.py プロジェクト: erikrose/kitsune
 def test_video_modal(self):
     """Video modal defaults for plcaeholder and text."""
     v = video()
     replacement = '<img class="video-thumbnail" src="%s"/>' % v.thumbnail_url_if_set()
     d, _, p = doc_rev_parser("[[V:Some title|modal]]")
     doc = pq(d.html)
     eq_("Some title", doc(".video-modal")[0].attrib["title"])
     eq_(1, doc(".video video").length)
     eq_(replacement, doc(".video-placeholder").html().strip())
     eq_("video modal-trigger", doc("div.video").attr("class"))
コード例 #17
0
ファイル: test_parser.py プロジェクト: treevivi/kitsune
 def test_video_modal(self):
     """Video modal defaults for plcaeholder and text."""
     v = video()
     replacement = ('<img class="video-thumbnail" src="%s"/>' %
                    v.thumbnail_url_if_set())
     d, _, p = doc_rev_parser('[[V:Some title|modal]]')
     doc = pq(d.html)
     eq_('Some title', doc('.video-modal')[0].attrib['title'])
     eq_(1, doc('.video video').length)
     eq_(replacement, doc('.video-placeholder').html().strip())
     eq_('video modal-trigger', doc('div.video').attr('class'))
コード例 #18
0
ファイル: test_parser.py プロジェクト: muratmeran/kitsune
 def test_video_modal(self):
     """Video modal defaults for plcaeholder and text."""
     v = video()
     replacement = ('<img class="video-thumbnail" src="%s"/>' %
                    v.thumbnail_url_if_set())
     d, _, p = doc_rev_parser(
         '[[V:Some title|modal]]')
     doc = pq(d.html)
     eq_('Some title', doc('.video-modal')[0].attrib['title'])
     eq_(1, doc('.video video').length)
     eq_(replacement, doc('.video-placeholder').html().strip())
     eq_('video modal-trigger', doc('div.video').attr('class'))
コード例 #19
0
ファイル: test_parser.py プロジェクト: muratmeran/kitsune
 def test_video_english(self):
     """Video is created and found in English."""
     v = video()
     d, _, p = doc_rev_parser('[[V:Some title]]')
     doc = pq(d.html)
     eq_('video', doc('div.video').attr('class'))
     eq_(u'<source src="{0}" '
         u'type="video/webm"><source src="{1}" type="video/ogg"/>'
         u'</source>'.format(v.webm.url, v.ogv.url),
         doc('video').html())
     eq_(1, len(doc('video')))
     eq_(2, len(doc('source')))
     data_fallback = doc('video').attr('data-fallback')
     eq_(v.flv.url, data_fallback)
コード例 #20
0
 def test_video_english(self):
     """Video is created and found in English."""
     v = video()
     d, _, p = doc_rev_parser('[[V:Some title]]')
     doc = pq(d.html)
     eq_('video', doc('div.video').attr('class'))
     eq_(u'<source src="{0}" '
         u'type="video/webm"><source src="{1}" type="video/ogg"/>'
         u'</source>'.format(v.webm.url, v.ogv.url),
         doc('video').html())
     eq_(1, len(doc('video')))
     eq_(2, len(doc('source')))
     data_fallback = doc('video').attr('data-fallback')
     eq_(v.flv.url, data_fallback)
コード例 #21
0
ファイル: test_parser.py プロジェクト: erikrose/kitsune
 def test_video_english(self):
     """Video is created and found in English."""
     v = video()
     d, _, p = doc_rev_parser("[[V:Some title]]")
     doc = pq(d.html)
     eq_("video", doc("div.video").attr("class"))
     eq_(
         u'<source src="{0}" '
         u'type="video/webm"><source src="{1}" type="video/ogg"/>'
         u"</source>".format(v.webm.url, v.ogv.url),
         doc("video").html(),
     )
     eq_(1, len(doc("video")))
     eq_(2, len(doc("source")))
     data_fallback = doc("video").attr("data-fallback")
     eq_(v.flv.url, data_fallback)
コード例 #22
0
ファイル: test__utils.py プロジェクト: treevivi/kitsune
 def test_check_has_perm(self):
     """Admin has perm to change video."""
     u = User.objects.get(username='******')
     vid = video(creator=u)
     check_media_permissions(vid, u, 'change')
コード例 #23
0
ファイル: test__utils.py プロジェクト: treevivi/kitsune
 def test_check_own_object(self):
     """tagger can edit a video s/he doesn't own."""
     vid = video(creator=self.user)
     check_media_permissions(vid, self.user, 'change')
コード例 #24
0
 def test_get_media_info_video(self):
     """Gets video and format info."""
     vid = video()
     info_vid, info_format = _get_media_info(vid.pk, 'video')
     eq_(vid.pk, info_vid.pk)
     eq_(None, info_format)
コード例 #25
0
ファイル: test__utils.py プロジェクト: Akamad007/kitsune
 def test_check_own_object(self):
     """tagger can edit a video s/he doesn't own."""
     vid = video(creator=self.user)
     check_media_permissions(vid, self.user, 'change')
コード例 #26
0
ファイル: test__utils.py プロジェクト: Akamad007/kitsune
 def test_check_has_perm(self):
     """Admin has perm to change video."""
     u = User.objects.get(username='******')
     vid = video(creator=u)
     check_media_permissions(vid, u, 'change')
コード例 #27
0
ファイル: test__utils.py プロジェクト: DWDRAEGER/kitsune
 def test_check_has_perm(self):
     """User with django permission has perm to change video."""
     vid = video(creator=self.user)
     u = user(save=True)
     add_permission(u, Video, 'change_video')
     check_media_permissions(vid, u, 'change')