django-embed-video/embed_video/tests/tests_custom_backend.py
Juda Kaleta 07de8a3af8 Closes #11.
Major changes:

- filter ``embed`` is replaced by tag ``video``.
- removed caching for whole backend, caching properties instead.
- HTTP or HTTPS is set by context.is_secure() (just for ``video`` tag).
- backends can be HTTP only (``allow_https = False``).

Minor changes:

- changed theme of docs to RTD theme.
- help about testing HTTPS on development server.
- added and modified tests
2013-12-21 17:18:47 +01:00

30 lines
887 B
Python

from unittest import TestCase
from embed_video.backends import detect_backend
from .custom_backend import CustomBackend
class CustomBackendTestCase(TestCase):
def setUp(self):
self.backend = detect_backend('http://myvideo.com/1530')
def test_detect_backend(self):
self.assertIsInstance(self.backend, CustomBackend)
def test_code(self):
self.assertEqual(self.backend.code, '1530')
def test_url(self):
self.assertEqual(self.backend.get_url(),
'http://play.myvideo.com/c/1530/')
def test_url_https(self):
self.backend.is_secure = True
self.assertEqual(self.backend.get_url(),
'https://play.myvideo.com/c/1530/')
def test_thumbnail(self):
self.assertEqual(self.backend.get_thumbnail_url(),
'http://thumb.myvideo.com/c/1530/')