mirror of
https://github.com/Hopiu/django-embed-video.git
synced 2026-03-17 05:40:24 +00:00
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
30 lines
887 B
Python
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/')
|
|
|