Watch Queue
TV + Queue
\n \n\n + \ \n
\ndiff --git a/.gitignore b/.gitignore index 9b5c98f..b62e3c5 100644 --- a/.gitignore +++ b/.gitignore @@ -200,6 +200,7 @@ var/ sdist/ develop-eggs/ .installed.cfg +.eggs/ # Installer logs pip-log.txt diff --git a/.travis.yml b/.travis.yml index 161c398..a4727a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +sudo: false language: python python: - '2.7' diff --git a/pyembed/mustache/test/fixtures/cassettes/embed_template.yml b/pyembed/mustache/test/fixtures/cassettes/embed_template.yml new file mode 100644 index 0000000..1eefe38 --- /dev/null +++ b/pyembed/mustache/test/fixtures/cassettes/embed_template.yml @@ -0,0 +1,1248 @@ +interactions: +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.7.0 CPython/2.7.9 Linux/3.19.0-25-generic] + method: GET + uri: http://www.youtube.com/watch?v=qrO4YZeyl0I + response: + body: {string: !!python/unicode ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + content-type: [text/html; charset=utf-8] + date: ['Sat, 15 Aug 2015 15:23:41 GMT'] + expires: ['Tue, 27 Apr 1971 19:44:06 EST'] + location: ['https://www.youtube.com/watch?v=qrO4YZeyl0I'] + p3p: ['CP="This is not a P3P policy! See http://support.google.com/accounts/answer/151657?hl=en + for more info."'] + server: [gwiseguy/2.0] + set-cookie: ['VISITOR_INFO1_LIVE=mmER-mfGMTw; path=/; domain=.youtube.com; expires=Fri, + 15-Apr-2016 03:16:41 GMT; httponly', YSC=wK_ko7Yrzkw; path=/; domain=.youtube.com; + httponly] + x-content-type-options: [nosniff] + x-frame-options: [SAMEORIGIN] + x-xss-protection: ['1; mode=block; report=https://www.google.com/appserve/security-bugs/log/youtube'] + status: {code: 301, message: Moved Permanently} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Cookie: [YSC=wK_ko7Yrzkw; VISITOR_INFO1_LIVE=mmER-mfGMTw] + User-Agent: [python-requests/2.7.0 CPython/2.7.9 Linux/3.19.0-25-generic] + method: GET + uri: https://www.youtube.com/watch?v=qrO4YZeyl0I + response: + body: {string: "
\n \n\n\n\n\n + \ \n\n \n\n\n \n \n\n\n \n\n\n\n + \ \n \n\n \n \n \n\n\n\n\n \n\n + \ \n
\n\n \n\n + \ \n
\n\n + \\n \n\n \n
\n\nMusic video by Lady Gaga performing
+ Bad Romance. (C) 2009 Interscope Records
#VEVOCertified on January 31,
+ 2010. http://www.vevo.com/certified
+ http://www.youtube.com/vevocertified
\n \n\n \n
\n\n\n \n\n \n
\n\n
'))
+ assert MustacheRenderer('.').render('http://example.com', oembed_response) == \
+ '
'
def test_default_embed_video():
@@ -50,9 +46,7 @@ def test_default_embed_video():
oembed_response = response.OEmbedVideoResponse(
create_value_function(values))
- assert_that(
- MustacheRenderer('.').render('http://example.com', oembed_response),
- equal_to(embedding))
+ assert MustacheRenderer('.').render('http://example.com', oembed_response) == embedding
def test_default_embed_rich():
@@ -63,9 +57,7 @@ def test_default_embed_rich():
oembed_response = response.OEmbedRichResponse(
create_value_function(values))
- assert_that(
- MustacheRenderer('.').render('http://example.com', oembed_response),
- equal_to(embedding))
+ assert MustacheRenderer('.').render('http://example.com', oembed_response) == embedding
def test_default_embed_link():
@@ -74,9 +66,8 @@ def test_default_embed_link():
oembed_response = response.OEmbedLinkResponse(
create_value_function(values))
- assert_that(
- MustacheRenderer('.').render('http://example.com', oembed_response),
- equal_to('Bees!'))
+ assert MustacheRenderer('.').render('http://example.com', oembed_response) == \
+ 'Bees!'
def test_should_embed_with_template():
@@ -91,8 +82,7 @@ def test_should_embed_with_template():
renderer = MustacheRenderer('pyembed/mustache/test/fixtures')
embedding = renderer.render('http://example.com', oembed_response)
- assert_that(embedding, equal_to(
- 'Bees by Ian Bees from http://example.com'))
+ assert embedding == 'Bees by Ian Bees from http://example.com'
def test_should_use_default_embedding_if_no_template():
@@ -105,9 +95,7 @@ def test_should_use_default_embedding_if_no_template():
create_value_function(values))
renderer = MustacheRenderer('pyembed/mustache/test/fixtures')
- assert_that(
- renderer.render('http://example.com', oembed_response),
- equal_to(embedding))
+ assert renderer.render('http://example.com', oembed_response) == embedding
def create_value_function(values):
diff --git a/setup.py b/setup.py
index 98e3464..49a526f 100644
--- a/setup.py
+++ b/setup.py
@@ -65,9 +65,9 @@ def run_tests(self):
'pystache'
],
tests_require=[
- 'PyHamcrest',
'mock',
- 'pytest'
+ 'pytest',
+ 'vcrpy'
],
cmdclass={'test': PyTest},
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..71d5a5c
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,7 @@
+[tox]
+envlist = py27, py34
+
+[testenv]
+commands = python setup.py test
+deps =
+ setuptools>=17.1
\n \n\n \n
\n\n