-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
35 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
import os | ||
|
||
from unittest import main | ||
|
||
os.environ['DJANGO_SETTINGS_MODULE'] = 'embed_video.tests.django_settings' | ||
|
||
from tests_fields import EmbedVideoFieldTestCase, EmbedVideoFormFieldTestCase | ||
from tests_backend import EmbedVideoTestCase | ||
from tests_tags import EmbedVideoNodeTestCase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from unittest import TestCase | ||
from mock import Mock | ||
|
||
from django.template import TemplateSyntaxError | ||
|
||
from ..templatetags.embed_video_tags import VideoNode | ||
|
||
|
||
class EmbedVideoNodeTestCase(TestCase): | ||
def setUp(self): | ||
self.parser = Mock() | ||
self.token = Mock(methods=['split_contents']) | ||
|
||
def test_syntax_error(self): | ||
self.token.split_contents.return_value = [] | ||
|
||
try: | ||
instance = VideoNode(self.parser, self.token) | ||
except TemplateSyntaxError: | ||
assert True | ||
|
||
def test_repr(self): | ||
self.token.split_contents.return_value = ( | ||
'video', 'http://youtu.be/v/1234', 'as', 'myvideo' | ||
) | ||
self.parser.compile_filter.return_value = u'some_url' | ||
|
||
node = VideoNode(self.parser, self.token) | ||
self.assertEqual(str(node), '<VideoNode "some_url">') | ||
|
||
|