Beispiel #1
0
    def test_asset_create_noasset(self):
        data = {'title': 'Bad Asset',
                'foobar': 'http://www.youtube.com/abcdefghi'}

        request = RequestFactory().post('/save/', data)
        request.user = User.objects.get(username='******')
        request.course = Course.objects.get(title='Sample Course')

        try:
            asset_create(request)
            self.fail("An assertion error should have been raised")
        except AssertionError:
            pass  # expected
Beispiel #2
0
    def test_asset_create_via_bookmarklet(self):
        data = {'title': 'YouTube Asset',
                'youtube': 'http://www.youtube.com/abcdefghi',
                'asset-source': 'bookmarklet'}

        request = RequestFactory().post('/save/', data)
        request.user = User.objects.get(username='******')
        request.course = Course.objects.get(title='Sample Course')

        response = asset_create(request)
        self.assertEquals(response.status_code, 200)

        Asset.objects.get(title='YouTube Asset')