-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathtest_embedding.py
More file actions
64 lines (53 loc) · 2.16 KB
/
Copy pathtest_embedding.py
File metadata and controls
64 lines (53 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
from feincms3.embedding import embed
def test_no_handlers():
"""Embed video without handlers"""
assert embed("stuff") is None
def test_youtube():
"""YouTube video embedding works"""
assert (
embed("https://www.youtube.com/watch?v=dQw4w9WgXcQ")
== """\
<div class="responsive-embed widescreen youtube"><iframe \
src="https://www.youtube.com/embed/dQw4w9WgXcQ?rel=0" frameborder="0" \
allow="autoplay; fullscreen" referrerpolicy="strict-origin-when-cross-origin" \
allowfullscreen=""></iframe></div>"""
)
assert (
embed("https://youtu.be/y7-s5ZvC_2A")
== """\
<div class="responsive-embed widescreen youtube"><iframe \
src="https://www.youtube.com/embed/y7-s5ZvC_2A?rel=0" frameborder="0" \
allow="autoplay; fullscreen" referrerpolicy="strict-origin-when-cross-origin" \
allowfullscreen=""></iframe></div>"""
)
assert embed("https://www.youtube.com/watch?v=4zGnNmncJWg&feature=emb_title")
assert embed(
"https://www.youtube.com/watch?v=DYu_bGbZiiQ&list=RDJMOOG7rWTPg&index=7"
)
assert embed("https://www.youtube.com/watch/ZumRshfKdtM")
assert embed("https://www.youtube.com/shorts/ZumRshfKdtM")
assert (
embed("https://www.youtube.com/live/ljSZ0xrJjCs")
== """\
<div class="responsive-embed widescreen youtube"><iframe \
src="https://www.youtube.com/embed/ljSZ0xrJjCs?rel=0" frameborder="0" \
allow="autoplay; fullscreen" referrerpolicy="strict-origin-when-cross-origin" \
allowfullscreen=""></iframe></div>"""
)
def test_vimeo():
"""Vimeo video embedding works"""
assert (
embed("https://vimeo.com/455728498")
== """\
<div class="responsive-embed widescreen vimeo"><iframe \
src="https://player.vimeo.com/video/455728498?dnt=1" frameborder="0" \
allow="autoplay; fullscreen" allowfullscreen=""></iframe></div>"""
)
assert embed("https://player.vimeo.com/video/417955670")
assert (
embed("https://vimeo.com/12345678/3213124324")
== """\
<div class="responsive-embed widescreen vimeo"><iframe \
src="https://player.vimeo.com/video/12345678?dnt=1" frameborder="0" \
allow="autoplay; fullscreen" allowfullscreen=""></iframe></div>"""
)