Beispiel #1
0
    def test_sitemap(self):
        """Test for the sitemap.xml"""
        category(save=True)
        speaker(save=True)
        video(save=True)

        resp = self.client.get('/sitemap.xml')
        eq_(resp.status_code, 200)
Beispiel #2
0
    def test_sitemap(self):
        """Test for the sitemap.xml"""
        category(save=True)
        speaker(save=True)
        video(save=True)

        resp = self.client.get('/sitemap.xml')
        eq_(resp.status_code, 200)
Beispiel #3
0
    def test_get_speakers_list(self):
        """Test that a list of speakers can be retrieved."""
        speaker(name=u"Guido van Rossum", save=True)
        speaker(name=u"Raymond Hettinger", save=True)

        resp = self.client.get("/api/v2/speaker/", {"format": "json"})
        eq_(resp.status_code, 200)
        content = json.loads(smart_text(resp.content))
        eq_(len(content["results"]), 2)
        names = set([result["name"] for result in content["results"]])
        eq_(names, set([u"Guido van Rossum", u"Raymond Hettinger"]))
Beispiel #4
0
    def test_get_speakers_list(self):
        """Test that a list of speakers can be retrieved."""
        speaker(name=u'Guido van Rossum', save=True)
        speaker(name=u'Raymond Hettinger', save=True)

        resp = self.client.get('/api/v2/speaker/',
                               {'format': 'json'})
        eq_(resp.status_code, 200)
        content = json.loads(smart_text(resp.content))
        eq_(len(content['results']), 2)
        names = set([result['name'] for result in content['results']])
        eq_(names, set([u'Guido van Rossum', u'Raymond Hettinger']))
Beispiel #5
0
    def test_get_speaker(self):
        """Test that a speaker can be retrieved."""
        s = speaker(save=True)

        resp = self.client.get('/api/v1/speaker/%d/' % s.pk, {'format': 'json'})
        eq_(resp.status_code, 200)
        eq_(json.loads(resp.content)['name'], s.name)
Beispiel #6
0
    def test_speaker_list_character(self):
        """
        Test the view of the listing of all speakers whose names start
        with certain character.
        """
        s1 = speaker(name=u'Another Speaker', save=True)
        s2 = speaker(name=u'Random Speaker', save=True)

        url = reverse('videos-speaker-list')
        data = {'character': 'r'}

        resp = self.client.get(url, data)
        eq_(resp.status_code, 200)
        self.assertTemplateUsed(resp, 'videos/speaker_list.html')
        assert s1.name not in resp.content
        assert s2.name in resp.content
Beispiel #7
0
    def test_get_speaker(self):
        """Test that a speaker can be retrieved."""
        s = speaker(save=True)

        resp = self.client.get("/api/v1/speaker/%d/" % s.pk, {"format": "json"})
        eq_(resp.status_code, 200)
        eq_(json.loads(resp.content)["name"], s.name)
Beispiel #8
0
    def test_post_video_with_urls(self):
        """Test that authenticated user can create videos."""
        cat = category(save=True)
        person = speaker(save=True)
        tag1 = tag(save=True)
        tag2 = tag(save=True)
        lang = language(save=True)

        data = {
            "title": "Creating delicious APIs for Django apps since 2010.",
            "category": "/api/v1/category/%d/" % cat.pk,
            "speakers": ["/api/v1/speaker/%d/" % person.pk],
            "tags": ["/api/v1/tag/%d/" % tag1.pk, "/api/v1/tag/%d/" % tag2.pk],
            "language": lang.name,
            "state": Video.STATE_LIVE,
        }

        resp = self.auth_post("/api/v1/video/", json.dumps(data), content_type="application/json")
        eq_(resp.status_code, 201)

        # Get the created video
        resp = self.auth_get(resp["Location"], {"format": "json"})
        eq_(resp.status_code, 200)
        eq_(json.loads(resp.content)["title"], data["title"])

        # Verify the data
        vid = Video.objects.get(title=data["title"])
        eq_(vid.title, data["title"])
        eq_(list(vid.speakers.values_list("name", flat=True)), [person.name])
        eq_(sorted(vid.tags.values_list("tag", flat=True)), sorted([tag1.tag, tag2.tag]))
        eq_(vid.language.name, lang.name)
Beispiel #9
0
    def test_speaker_list_character(self):
        """
        Test the view of the listing of all speakers whose names start
        with certain character.
        """
        s1 = speaker(name=u'Another Speaker', save=True)
        s2 = speaker(name=u'Random Speaker', save=True)

        url = reverse('videos-speaker-list')
        data = {'character': 'r'} 

        resp = self.client.get(url, data)
        eq_(resp.status_code, 200)
        self.assertTemplateUsed(resp, 'videos/speaker_list.html')
        assert s1.name not in resp.content
        assert s2.name in resp.content
Beispiel #10
0
    def test_post_video_with_urls(self):
        """Test that authenticated user can create videos."""
        cat = category(save=True)
        person = speaker(save=True)
        tag1 = tag(save=True)
        tag2 = tag(save=True)
        lang = language(save=True)

        data = {'title': 'Creating delicious APIs for Django apps since 2010.',
                'category': '/api/v1/category/%d/' % cat.pk,
                'speakers': ['/api/v1/speaker/%d/' % person.pk],
                'tags': ['/api/v1/tag/%d/' % tag1.pk,
                         '/api/v1/tag/%d/' % tag2.pk],
                'language': lang.name,
                'state': Video.STATE_LIVE}

        resp = self.auth_post('/api/v1/video/', json.dumps(data),
                                content_type='application/json')
        eq_(resp.status_code, 201)

        # Get the created video
        resp = self.auth_get(resp['Location'], {'format': 'json'})
        eq_(resp.status_code, 200)
        eq_(json.loads(resp.content)['title'], data['title'])

        # Verify the data
        vid = Video.objects.get(title=data['title'])
        eq_(vid.title, data['title'])
        eq_(list(vid.speakers.values_list('name', flat=True)), [person.name])
        eq_(sorted(vid.tags.values_list('tag', flat=True)),
            sorted([tag1.tag, tag2.tag]))
        eq_(vid.language.name, lang.name)
Beispiel #11
0
    def test_speaker_list_empty_character(self):
        """
        Test the view of the listing of all speakers given a empty
        `character` GET parameter. It should fallback to showing the
        speakers starting from the lowest possible character.
        """
        s1 = speaker(name=u'Random Speaker', save=True)
        s2 = speaker(name=u'Another Speaker', save=True)

        url = reverse('videos-speaker-list')
        data = {'character': ''}

        resp = self.client.get(url, data)
        eq_(resp.status_code, 200)
        self.assertTemplateUsed(resp, 'videos/speaker_list.html')
        assert s1.name not in resp.content
        assert s2.name in resp.content
Beispiel #12
0
    def test_speaker_list_not_string_character(self):
        """
        Test the view of the listing of all speakers giving a invalid
        character argument. The view should fallback to showing the
        speakers starting from the lowest possible character.
        """
        s1 = speaker(name=u'Random Speaker', save=True)
        s2 = speaker(name=u'Another Speaker', save=True)

        url = reverse('videos-speaker-list')
        data = {'character': 42}

        resp = self.client.get(url, data)
        eq_(resp.status_code, 200)
        self.assertTemplateUsed(resp, 'videos/speaker_list.html')
        self.assertNotContains(resp, s1.name)
        self.assertContains(resp, s2.name)
Beispiel #13
0
    def test_speaker_list_not_string_character(self):
        """
        Test the view of the listing of all speakers giving a invalid
        character argument. The view should fallback to showing the 
        speakers starting from the lowest possible character.
        """
        s1 = speaker(name=u'Random Speaker', save=True)
        s2 = speaker(name=u'Another Speaker', save=True)

        url = reverse('videos-speaker-list')
        data = {'character': 42}

        resp = self.client.get(url, data)
        eq_(resp.status_code, 200)
        self.assertTemplateUsed(resp, 'videos/speaker_list.html')
        assert s1.name not in resp.content
        assert s2.name in resp.content
Beispiel #14
0
    def test_speaker_list_empty_character(self):
        """
        Test the view of the listing of all speakers given a empty
        `character` GET parameter. It should fallback to showing the
        speakers starting from the lowest possible character.
        """
        s1 = speaker(name=u'Random Speaker', save=True)
        s2 = speaker(name=u'Another Speaker', save=True)

        url = reverse('videos-speaker-list')
        data = {'character': ''}

        resp = self.client.get(url, data)
        eq_(resp.status_code, 200)
        self.assertTemplateUsed(resp, 'videos/speaker_list.html')
        self.assertNotContains(resp, s1.name)
        self.assertContains(resp, s2.name)
Beispiel #15
0
    def test_inactive_video_speaker_page(self):
        """Inactive video should not show up on it's speaker's page."""
        s = speaker(save=True)
        vid = video(save=True)
        vid.speakers.add(s)

        speaker_url = s.get_absolute_url()

        resp = self.client.get(speaker_url)
        assert vid.title not in resp.content
Beispiel #16
0
    def test_active_video_speaker_page(self):
        """Active video should show up on it's speaker's page."""
        s = speaker(save=True)
        vid = video(state=Video.STATE_LIVE, save=True)
        vid.speakers.add(s)

        speaker_url = s.get_absolute_url()

        resp = self.client.get(speaker_url)
        assert vid.title in resp.content
Beispiel #17
0
    def test_active_video_speaker_page(self):
        """Active video should show up on it's speaker's page."""
        s = speaker(save=True)
        vid = video(state=Video.STATE_LIVE, save=True)
        vid.speakers.add(s)

        speaker_url = s.get_absolute_url()

        resp = self.client.get(speaker_url)
        assert vid.title in resp.content
Beispiel #18
0
    def test_inactive_video_speaker_page(self):
        """Inactive video should not show up on it's speaker's page."""
        s = speaker(save=True)
        vid = video(save=True)
        vid.speakers.add(s)

        speaker_url = s.get_absolute_url()

        resp = self.client.get(speaker_url)
        assert vid.title not in resp.content
Beispiel #19
0
    def test_speaker_feed(self):
        """Tests for Speaker rss feed"""

        spk = speaker(save=True)

        # Speaker feed is accessible
        resp = self.client.get(reverse("videos-speaker-feed", kwargs={"speaker_id": spk.id, "slug": spk.slug}))
        eq_(resp.status_code, 200)

        # Speaker feed returns 404, invalid speaker_id.
        resp = self.client.get(reverse("videos-speaker-feed", kwargs={"speaker_id": 50, "slug": "fake-slug"}))
        eq_(resp.status_code, 404)
Beispiel #20
0
    def test_speaker_urls(self):
        """Test the view of a speaker."""
        spe = speaker(name=u'Random Speaker', save=True)

        cases = [
            spe.get_absolute_url(),     # returns the URL with pk and slug
            u'/speaker/%s/%s/' % (spe.id, spe.slug),    # with slug and /
            u'/speaker/%s/%s' % (spe.id, spe.slug),     # with slug and no /
            u'/speaker/%s/' % spe.id,                   # no slug and /
            u'/speaker/%s' % spe.id,                    # no slug and no /
        ]

        for url in cases:
            resp = self.client.get(url)
            eq_(resp.status_code, 200)
            self.assertTemplateUsed(resp, 'videos/speaker.html')
Beispiel #21
0
    def test_speaker_urls(self):
        """Test the view of a speaker."""
        spe = speaker(name=u'Random Speaker', save=True)

        cases = [
            spe.get_absolute_url(),  # returns the URL with pk and slug
            u'/speaker/%s/%s/' % (spe.id, spe.slug),  # with slug and /
            u'/speaker/%s/%s' % (spe.id, spe.slug),  # with slug and no /
            u'/speaker/%s/' % spe.id,  # no slug and /
            u'/speaker/%s' % spe.id,  # no slug and no /
        ]

        for url in cases:
            resp = self.client.get(url)
            eq_(resp.status_code, 200)
            self.assertTemplateUsed(resp, 'videos/speaker.html')
Beispiel #22
0
    def test_post_with_speaker_url(self):
        """Test that you can post videos with url speakers"""
        cat = category(save=True)
        speaker1 = speaker(save=True)

        data = {"title": "test1", "category": "/api/v1/category/%d/" % cat.pk, "state": Video.STATE_DRAFT}

        # Post the video using /api/v1/speaker/xx.
        data.update({"speakers": ["/api/v1/speaker/%d/" % speaker1.pk]})

        resp = self.auth_post("/api/v1/video/", json.dumps(data), content_type="application/json")
        eq_(resp.status_code, 201)

        # Get the created video
        resp = self.auth_get(resp["Location"], {"format": "json"})

        # Verify the tag
        vid = Video.objects.get(title=data["title"])
        eq_(vid.speakers.values_list("name", flat=True)[0], speaker1.name)
Beispiel #23
0
    def test_get_video_data(self):
        cat = category(title=u"Foo Title", save=True)
        vid = video(title=u"Foo Bar", category=cat, state=Video.STATE_LIVE, save=True)
        t = tag(tag=u"tag", save=True)
        vid.tags = [t]
        s = speaker(name=u"Jim", save=True)
        vid.speakers = [s]

        resp = self.client.get("/api/v2/video/%d/" % vid.pk, {"format": "json"})
        eq_(resp.status_code, 200)
        content = json.loads(resp.content)
        eq_(content["title"], vid.title)
        eq_(content["slug"], "foo-bar")
        # This should be the category title--not api url
        eq_(content["category"], cat.title)
        # This should be the tag--not api url
        eq_(content["tags"], [t.tag])
        # This should be the speaker name--not api url
        eq_(content["speakers"], [s.name])
Beispiel #24
0
    def test_get_video_data(self):
        cat = category(title=u'Foo Title', save=True)
        vid = video(title=u'Foo Bar', category=cat, state=Video.STATE_LIVE,
                    save=True)
        t = tag(tag=u'tag', save=True)
        vid.tags = [t]
        s = speaker(name=u'Jim', save=True)
        vid.speakers = [s]

        resp = self.client.get('/api/v2/video/%d/' % vid.pk,
                               {'format': 'json'})
        eq_(resp.status_code, 200)
        content = json.loads(smart_text(resp.content))
        eq_(content['title'], vid.title)
        eq_(content['slug'], 'foo-bar')
        # This should be the category title--not api url
        eq_(content['category'], cat.title)
        # This should be the tag--not api url
        eq_(content['tags'], [t.tag])
        # This should be the speaker name--not api url
        eq_(content['speakers'], [s.name])
Beispiel #25
0
    def test_videos_by_speaker(self):
        speaker1 = speaker(name="webber", save=True)
        v1 = video(state=Video.STATE_LIVE, title=u"Foo1", save=True)
        v1.speakers = [speaker1]
        v1.save()
        v2 = video(state=Video.STATE_LIVE, title=u"Foo2", save=True)
        v2.speakers = [speaker1]
        v2.save()
        video(state=Video.STATE_LIVE, title=u"Foo3", save=True)

        # Filter by full name.
        resp = self.auth_get("/api/v2/video/?speaker=webber", content_type="application/json")

        data = json.loads(resp.content)
        eq_(len(data["results"]), 2)

        # Filter by partial name.
        resp = self.auth_get("/api/v2/video/?speaker=web", content_type="application/json")

        data = json.loads(resp.content)
        eq_(len(data["results"]), 2)
Beispiel #26
0
    def test_get_video_data(self):
        cat = category(title=u'Foo Title', save=True)
        vid = video(title=u'Foo Bar', category=cat, state=Video.STATE_LIVE,
                    save=True)
        t = tag(tag=u'tag', save=True)
        vid.tags = [t]
        s = speaker(name=u'Jim', save=True)
        vid.speakers = [s]

        resp = self.client.get('/api/v1/video/%d/' % vid.pk,
                               {'format': 'json'})
        eq_(resp.status_code, 200)
        content = json.loads(resp.content)
        eq_(content['title'], vid.title)
        eq_(content['slug'], 'foo-bar')
        # This should be the category title--not api url
        eq_(content['category'], cat.title)
        # This should be the tag--not api url
        eq_(content['tags'], [t.tag])
        # This should be the speaker name--not api url
        eq_(content['speakers'], [s.name])
Beispiel #27
0
    def test_speaker_feed(self):
        """Tests for Speaker rss feed"""

        spk = speaker(save=True)

        # Speaker feed is accessible
        resp = self.client.get(
            reverse('videos-speaker-feed',
                    kwargs={
                        'speaker_id': spk.id,
                        'slug': spk.slug
                    }))
        eq_(resp.status_code, 200)

        # Speaker feed returns 404, invalid speaker_id.
        resp = self.client.get(
            reverse('videos-speaker-feed',
                    kwargs={
                        'speaker_id': 50,
                        'slug': 'fake-slug'
                    }))
        eq_(resp.status_code, 404)
Beispiel #28
0
    def test_videos_by_speaker(self):
        speaker1 = speaker(name='webber', save=True)
        v1 = video(state=Video.STATE_LIVE, title=u'Foo1', save=True)
        v1.speakers = [speaker1]
        v1.save()
        v2 = video(state=Video.STATE_LIVE, title=u'Foo2', save=True)
        v2.speakers = [speaker1]
        v2.save()
        video(state=Video.STATE_LIVE, title=u'Foo3', save=True)

        # Filter by full name.
        resp = self.auth_get('/api/v1/video/?speaker=webber',
                             content_type='application/json')

        data = json.loads(resp.content)
        eq_(len(data['objects']), 2)

        # Filter by partial name.
        resp = self.auth_get('/api/v1/video/?speaker=web',
                             content_type='application/json')

        data = json.loads(resp.content)
        eq_(len(data['objects']), 2)
Beispiel #29
0
    def test_videos_by_speaker(self):
        speaker1 = speaker(name='webber', save=True)
        v1 = video(state=Video.STATE_LIVE, title=u'Foo1', save=True)
        v1.speakers = [speaker1]
        v1.save()
        v2 = video(state=Video.STATE_LIVE, title=u'Foo2', save=True)
        v2.speakers = [speaker1]
        v2.save()
        video(state=Video.STATE_LIVE, title=u'Foo3', save=True)

        # Filter by full name.
        resp = self.auth_get('/api/v2/video/?speaker=webber',
                             content_type='application/json')

        data = json.loads(smart_text(resp.content))
        eq_(len(data['results']), 2)

        # Filter by partial name.
        resp = self.auth_get('/api/v2/video/?speaker=web',
                             content_type='application/json')

        data = json.loads(smart_text(resp.content))
        eq_(len(data['results']), 2)
Beispiel #30
0
def generate_sampledata(options):
    pycon2011 = category(title=u'Pycon 2011',
                         slug=u'pycon-2011',
                         description=u'PyCon 2011 in Atlanta, GA',
                         url=u'http://us.pycon.org/2011/home/',
                         save=True)

    pycon2012 = category(title=u'Pycon 2012',
                         slug=u'pycon-2012',
                         description=u'PyCon 2011 in Santa Clara, CA',
                         url=u'http://us.pycon.org/2012/',
                         save=True)

    jm = speaker(name=u'Jessica McKellar', save=True)
    al = speaker(name=u'Asheesh Laroia', save=True)
    jkm = speaker(name=u'Jacob Kaplan-Moss', save=True)

    tag1 = tag(tag=u'documentation', save=True)
    tag2 = tag(tag=u'sphinx', save=True)

    v = video(
        state=Video.STATE_LIVE,
        category=pycon2011,
        title=u'Writing great documentation',
        summary=u'<p>Writing great documentation</p>'
        u'<p>Presented by Jacob Kaplan-Moss</p>',
        description=u'<p>This talk looks at tips, tools, and techniques you can'
        u'use to produce great technical documentation.</p>',
        copyright_text=
        u'Creative Commons Attribution-NonCommercial-ShareAlike 3.0',
        recorded=date(2011, 3, 11),
        updated=datetime(2011, 3, 14, 3, 47, 59),
        source_url=u'http://blip.tv/file/4881071',
        video_mp4_url=
        u'http://blip.tv/file/get/Pycon-PyCon2011WritingGreatDocumentation191.mp4',  # noqa
        video_ogv_length=158578172,
        video_ogv_url=
        u'http://blip.tv/file/get/Pycon-PyCon2011WritingGreatDocumentation312.ogv',  # noqa
        thumbnail_url=
        u'http://a.images.blip.tv/Pycon-PyCon2011WritingGreatDocumentation902.png',  # noqa
        save=True)

    v.speakers.add(jkm)
    v.tags.add(tag1, tag2)

    v = video(
        state=Video.STATE_LIVE,
        category=pycon2012,
        title=u'Diversity in practice: How the Boston Python User Group grew '
        u'to 1700 people and over 15% women',
        summary=u"""
            <p>How do you bring more women into programming communities with
            long-term, measurable results? In this talk we'll analyze our
            successful effort, the Boston Python Workshop, which brought over
            200 women into Boston's Python community this year.</p>""",
        recorded=date(2012, 3, 11),
        updated=datetime(2012, 3, 13, 16, 15, 17),
        source_url=u'https://www.youtube.com/watch?v=QrITN6GZDu4',
        embed=u'''
<object width="425" height="344">
<param name="movie" value="http://www.youtube.com/v/QrITN6GZDu4&amp;hl=en&amp;fs=1">
<param name="allowFullScreen" value="true">
<param name="allowscriptaccess" value="always">
<embed src="http://www.youtube.com/v/QrITN6GZDu4&amp;hl=en&amp;fs=1" allowscriptaccess="always" height="344" width="425" allowfullscreen="true" type="application/x-shockwave-flash"></embed>
</object>''',  # noqa
        thumbnail_url=u'http://img.youtube.com/vi/QrITN6GZDu4/hqdefault.jpg',
        save=True)

    v.speakers.add(jm, al)
Beispiel #31
0
def generate_sampledata(options):
    pycon2011 = category(title=u'Pycon 2011',
                         slug=u'pycon-2011',
                         description=u'PyCon 2011 in Atlanta, GA',
                         url=u'http://us.pycon.org/2011/home/',
                         save=True)

    pycon2012 = category(title=u'Pycon 2012',
                         slug=u'pycon-2012',
                         description=u'PyCon 2011 in Santa Clara, CA',
                         url=u'http://us.pycon.org/2012/',
                         save=True)

    sp1 = speaker(name=u'Jessica McKellar', save=True)
    sp2 = speaker(name=u'Asheesh Laroia', save=True)
    sp3 = speaker(name=u'Jacob Kaplan-Moss', save=True)

    tag1 = tag(tag=u'documentation', save=True)
    tag2 = tag(tag=u'sphinx', save=True)

    v = video(
        state=Video.STATE_LIVE,
        category=pycon2011,
        title=u'Writing great documentation',
        summary=dedent("""\
        Writing great documentation

        Presented by Jacob Kaplan-Moss
        """),
        description=dedent("""\
        This talk looks at tips, tools, and techniques you can
        use to produce great technical documentation.
        """),
        copyright_text=u'CC-SA-NC 3.0',
        recorded=date(2011, 3, 11),
        updated=datetime(2011, 3, 14, 3, 47, 59),
        source_url=u'http://blip.tv/file/4881071',
        video_mp4_url=(
            u'http://05d2db1380b6504cc981-8cbed8cf7e3a131cd8f1c3e383d10041'
            u'.r93.cf2.rackcdn.com/pycon-us-2011/'
            u'403_writing-great-documentation.mp4'),
        thumbnail_url=(u'http://a.images.blip.tv/'
                       u'Pycon-PyCon2011WritingGreatDocumentation902.png'),
        save=True)

    v.speakers.add(sp3)
    v.tags.add(tag1, tag2)

    v = video(
        state=Video.STATE_LIVE,
        category=pycon2012,
        title=dedent("""\
        Diversity in practice: How the Boston Python User Group grew
        to 1700 people and over 15% women
        """),
        summary=dedent(u"""\
        How do you bring more women into programming communities with
        long-term, measurable results? In this talk we'll analyze our
        successful effort, the Boston Python Workshop, which brought over
        200 women into Boston's Python community this year.
        """),
        recorded=date(2012, 3, 11),
        updated=datetime(2012, 3, 13, 16, 15, 17),
        source_url=u'https://www.youtube.com/watch?v=QrITN6GZDu4',
        embed=dedent("""\
        <object width="425" height="344">
        <param name="movie"
        value="http://www.youtube.com/v/QrITN6GZDu4&amp;hl=en&amp;fs=1">
        <param name="allowFullScreen" value="true">
        <param name="allowscriptaccess" value="always">
        <embed src="http://www.youtube.com/v/QrITN6GZDu4&amp;hl=en&amp;fs=1"
        allowscriptaccess="always" height="344"
        width="425" allowfullscreen="true"
        type="application/x-shockwave-flash"></embed>
        </object>
        """),
        thumbnail_url=u'http://img.youtube.com/vi/QrITN6GZDu4/hqdefault.jpg',
        save=True)

    v.speakers.add(sp1, sp2)

    v = video(state=Video.STATE_DRAFT,
              category=pycon2012,
              title=u'Draft video',
              summary=u'This is a draft',
              recorded=date(2012, 3, 11),
              updated=datetime(2012, 3, 13, 16, 15, 17),
              save=True)
Beispiel #32
0
def generate_sampledata(options):
    pycon2011 = category(
        title=u"Pycon 2011",
        slug=u"pycon-2011",
        description=u"PyCon 2011 in Atlanta, GA",
        url=u"http://us.pycon.org/2011/home/",
        save=True,
    )

    pycon2012 = category(
        title=u"Pycon 2012",
        slug=u"pycon-2012",
        description=u"PyCon 2011 in Santa Clara, CA",
        url=u"http://us.pycon.org/2012/",
        save=True,
    )

    sp1 = speaker(name=u"Jessica McKellar", save=True)
    sp2 = speaker(name=u"Asheesh Laroia", save=True)
    sp3 = speaker(name=u"Jacob Kaplan-Moss", save=True)

    tag1 = tag(tag=u"documentation", save=True)
    tag2 = tag(tag=u"sphinx", save=True)

    v = video(
        state=Video.STATE_LIVE,
        category=pycon2011,
        title=u"Writing great documentation",
        summary=dedent(
            """\
        Writing great documentation

        Presented by Jacob Kaplan-Moss
        """
        ),
        description=dedent(
            """\
        This talk looks at tips, tools, and techniques you can
        use to produce great technical documentation.
        """
        ),
        copyright_text=u"CC-SA-NC 3.0",
        recorded=date(2011, 3, 11),
        updated=datetime(2011, 3, 14, 3, 47, 59),
        source_url=u"http://blip.tv/file/4881071",
        video_mp4_url=(
            u"http://05d2db1380b6504cc981-8cbed8cf7e3a131cd8f1c3e383d10041"
            u".r93.cf2.rackcdn.com/pycon-us-2011/"
            u"403_writing-great-documentation.mp4"
        ),
        thumbnail_url=(u"http://a.images.blip.tv/" u"Pycon-PyCon2011WritingGreatDocumentation902.png"),
        save=True,
    )

    v.speakers.add(sp3)
    v.tags.add(tag1, tag2)

    v = video(
        state=Video.STATE_LIVE,
        category=pycon2012,
        title=dedent(
            """\
        Diversity in practice: How the Boston Python User Group grew
        to 1700 people and over 15% women
        """
        ),
        summary=dedent(
            u"""\
        How do you bring more women into programming communities with
        long-term, measurable results? In this talk we'll analyze our
        successful effort, the Boston Python Workshop, which brought over
        200 women into Boston's Python community this year.
        """
        ),
        recorded=date(2012, 3, 11),
        updated=datetime(2012, 3, 13, 16, 15, 17),
        source_url=u"https://www.youtube.com/watch?v=QrITN6GZDu4",
        embed=dedent(
            """\
        <object width="425" height="344">
        <param name="movie"
        value="http://www.youtube.com/v/QrITN6GZDu4&amp;hl=en&amp;fs=1">
        <param name="allowFullScreen" value="true">
        <param name="allowscriptaccess" value="always">
        <embed src="http://www.youtube.com/v/QrITN6GZDu4&amp;hl=en&amp;fs=1"
        allowscriptaccess="always" height="344"
        width="425" allowfullscreen="true"
        type="application/x-shockwave-flash"></embed>
        </object>
        """
        ),
        thumbnail_url=u"http://img.youtube.com/vi/QrITN6GZDu4/hqdefault.jpg",
        save=True,
    )

    v.speakers.add(sp1, sp2)

    v = video(
        state=Video.STATE_DRAFT,
        category=pycon2012,
        title=u"Draft video",
        summary=u"This is a draft",
        recorded=date(2012, 3, 11),
        updated=datetime(2012, 3, 13, 16, 15, 17),
        save=True,
    )
Beispiel #33
0
def generate_sampledata(options):
    conference = category_kind(name=u'Conference', save=True)

    pycon2011 = category(name=u'PyCon', title=u'Pycon 2011', slug=u'pycon-2011',
                         description=u'PyCon 2011 in Atlanta, GA',
                         kind=conference, url=u'http://us.pycon.org/2011/home/',
                         save=True)

    pycon2012 = category(name=u'PyCon', title=u'Pycon 2012', slug=u'pycon-2012',
                         description=u'PyCon 2011 in Santa Clara, CA',
                         kind=conference, url=u'http://us.pycon.org/2012/',
                         save=True)

    jm = speaker(name=u'Jessica McKellar', save=True)
    al = speaker(name=u'Asheesh Laroia', save=True)
    jkm = speaker(name=u'Jacob Kaplan-Moss', save=True)

    tag1 = tag(tag=u'documentation', save=True)
    tag2 = tag(tag=u'sphinx', save=True)

    v = video(
        state=Video.STATE_LIVE, category=pycon2011,
        title=u'Writing great documentation',
        summary=u'<p>Writing great documentation</p>'
                u'<p>Presented by Jacob Kaplan-Moss</p>',
        description=u'<p>This talk looks at tips, tools, and techniques you can'
                    u'use to produce great technical documentation.</p>',
        copyright_text=u'Creative Commons Attribution-NonCommercial-ShareAlike 3.0',

        recorded=date(2011, 3, 11),
        updated=datetime(2011, 3, 14, 3, 47, 59),
        source_url=u'http://blip.tv/file/4881071',
        video_mp4_url=u'http://blip.tv/file/get/Pycon-PyCon2011WritingGreatDocumentation191.mp4',
        video_ogv_length=158578172, 
        video_ogv_url=u'http://blip.tv/file/get/Pycon-PyCon2011WritingGreatDocumentation312.ogv',
        thumbnail_url=u'http://a.images.blip.tv/Pycon-PyCon2011WritingGreatDocumentation902.png',
        save=True)

    v.speakers.add(jkm)
    v.tags.add(tag1, tag2)

    v = video(
        state=Video.STATE_LIVE, category=pycon2012,
        title=u'Diversity in practice: How the Boston Python User Group grew to '
              u'1700 people and over 15% women',
        summary=u"""
            <p>How do you bring more women into programming communities with
            long-term, measurable results? In this talk we'll analyze our
            successful effort, the Boston Python Workshop, which brought over
            200 women into Boston's Python community this year.</p>""",

        recorded=date(2012, 3, 11),
        updated=datetime(2012, 3, 13, 16, 15, 17),
        source_url=u'https://www.youtube.com/watch?v=QrITN6GZDu4',
        embed=u'''
            <object width="425" height="344">
            <param name="movie" value="http://www.youtube.com/v/QrITN6GZDu4&amp;hl=en&amp;fs=1">
            <param name="allowFullScreen" value="true">
            <param name="allowscriptaccess" value="always">
            <embed src="http://www.youtube.com/v/QrITN6GZDu4&amp;hl=en&amp;fs=1" allowscriptaccess="always" height="344" width="425" allowfullscreen="true" type="application/x-shockwave-flash"></embed>
            </object>''',
        thumbnail_url=u'http://img.youtube.com/vi/QrITN6GZDu4/hqdefault.jpg',
        save=True)

    v.speakers.add(jm, al)