Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
yetty committed Jul 26, 2014
1 parent e89a82d commit 5109317
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Release 1.0.0 (dev)
-------------------

**Backward incompatible changes:**

- filter `embed_video_tags.embed` has been removed

Backward compatible changes:
Expand Down
12 changes: 4 additions & 8 deletions embed_video/backends.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import re
import sys
import json
import requests

try:
# Python <= 2.7
import urlparse
from urllib import urlencode
except ImportError:
# support for py3
if sys.version_info.major == 3:
import urllib.parse as urlparse
from urllib.parse import urlencode
else:
import urlparse

from django.http import QueryDict
from django.template.loader import render_to_string
Expand Down Expand Up @@ -200,7 +197,6 @@ def get_info(self):
raise NotImplementedError

def set_options(self, options):
print options
for key in options:
setattr(self, key, options[key])

Expand Down
23 changes: 16 additions & 7 deletions embed_video/tests/templatetags/tests_embed_video_tags.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from unittest import TestCase, skip
from mock import Mock, patch
import re
import sys

from django.template import TemplateSyntaxError
from django.http import HttpRequest
Expand Down Expand Up @@ -206,12 +207,21 @@ def test_direct_embed_with_query(self):
{% load embed_video_tags %}
{% video 'http://www.youtube.com/watch?v=jsrRJyHBvzw' query="rel=1&wmode=transparent" %}
"""
self.assertRenderedTemplate(
template,
'<iframe width="480" height="360" '
'src="http://www.youtube.com/embed/jsrRJyHBvzw?wmode=transparent&rel=1" '
'frameborder="0" allowfullscreen></iframe>'
)

if sys.version_info.major == 3:
self.assertRenderedTemplate(
template,
'<iframe width="480" height="360" '
'src="http://www.youtube.com/embed/jsrRJyHBvzw?rel=1&wmode=transparent" '
'frameborder="0" allowfullscreen></iframe>'
)
else:
self.assertRenderedTemplate(
template,
'<iframe width="480" height="360" '
'src="http://www.youtube.com/embed/jsrRJyHBvzw?wmode=transparent&rel=1" '
'frameborder="0" allowfullscreen></iframe>'
)

def test_set_options(self):
template = """
Expand Down Expand Up @@ -240,7 +250,6 @@ def test_size_as_variable(self):
)



class EmbedVideoNodeTestCase(TestCase):
def setUp(self):
self.parser = Mock()
Expand Down

0 comments on commit 5109317

Please sign in to comment.