Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Websites UFRPE
Wagtail Videos
Commits
f4da2207
Unverified
Commit
f4da2207
authored
Dec 30, 2023
by
Seb Brown
Committed by
GitHub
Dec 30, 2023
Browse files
Merge pull request #117 from neon-jungle/lts-update
Lts update
parents
b76b4a8a
39b84fb0
Changes
5
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
f4da2207
...
@@ -12,25 +12,20 @@ stages:
...
@@ -12,25 +12,20 @@ stages:
head
:
head
:
extends
:
.python_test
extends
:
.python_test
image
:
python:3.1
0
image
:
python:3.1
1
before_script
:
before_script
:
-
pip install .['testing']
-
pip install .['testing']
lts_41
:
image
:
python:3.10
extends
:
.python_test
before_script
:
-
pip install .['testing'] wagtail~=4.1 django~=4.1
lts_52
:
lts_52
:
image
:
python:3.1
0
image
:
python:3.1
1
extends
:
.python_test
extends
:
.python_test
before_script
:
before_script
:
-
pip install .['testing'] wagtail~=5.2 django~=4.2
-
pip install .['testing'] wagtail~=5.2 django~=4.2
flake8
:
flake8
:
stage
:
lint
stage
:
lint
image
:
python:3.1
0
image
:
python:3.1
1
before_script
:
before_script
:
-
pip install flake8
-
pip install flake8
script
:
script
:
...
@@ -38,14 +33,14 @@ flake8:
...
@@ -38,14 +33,14 @@ flake8:
isort
:
isort
:
stage
:
lint
stage
:
lint
image
:
python:3.1
0
image
:
python:3.1
1
before_script
:
before_script
:
-
pip install isort -e .
-
pip install isort -e .
script
:
script
:
-
isort --recursive --diff --check-only wagtailvideos/ tests/
-
isort --recursive --diff --check-only wagtailvideos/ tests/
build
:
build
:
image
:
python:3.1
0
image
:
python:3.1
1
stage
:
release
stage
:
release
before_script
:
before_script
:
-
pip install --upgrade setuptools wheel twine
-
pip install --upgrade setuptools wheel twine
...
...
CHANGELOG.rst
View file @
f4da2207
CHANGELOG
CHANGELOG
=========
=========
5.2
---
- Upped minimum wagtail version to latest LTS (5.2)
4.0.1
4.0.1
-----
-----
...
...
setup.py
View file @
f4da2207
...
@@ -10,14 +10,14 @@ from setuptools import find_packages, setup # noqa: E4
...
@@ -10,14 +10,14 @@ from setuptools import find_packages, setup # noqa: E4
setup
(
setup
(
name
=
"wagtailvideos"
,
name
=
"wagtailvideos"
,
version
=
"
4
.2.
2
"
,
version
=
"
5
.2.
0
"
,
description
=
"A wagtail module for uploading and displaying videos in various codecs."
,
description
=
"A wagtail module for uploading and displaying videos in various codecs."
,
long_description
=
readme
,
long_description
=
readme
,
author
=
"Neon Jungle"
,
author
=
"Neon Jungle"
,
author_email
=
"developers@neonjungle.studio"
,
author_email
=
"developers@neonjungle.studio"
,
url
=
"https://github.com/neon-jungle/wagtailvideos"
,
url
=
"https://github.com/neon-jungle/wagtailvideos"
,
install_requires
=
[
install_requires
=
[
"wagtail>=
4
.2"
,
"wagtail>=
5
.2"
,
"Django>=3.2"
,
"Django>=3.2"
,
"django-enumchoicefield>=1.1.0"
,
"django-enumchoicefield>=1.1.0"
,
"bcp47==0.0.4"
,
"bcp47==0.0.4"
,
...
@@ -34,9 +34,11 @@ setup(
...
@@ -34,9 +34,11 @@ setup(
"Operating System :: OS Independent"
,
"Operating System :: OS Independent"
,
"Programming Language :: Python"
,
"Programming Language :: Python"
,
"Programming Language :: Python :: 3"
,
"Programming Language :: Python :: 3"
,
"Programming Language :: Python :: 3.4"
,
"Programming Language :: Python :: 3.8"
,
"Programming Language :: Python :: 3.5"
,
"Programming Language :: Python :: 3.9"
,
"Programming Language :: Python :: 3.6"
,
"Programming Language :: Python :: 3.10"
,
"Programming Language :: Python :: 3.11"
,
"Programming Language :: Python :: 3.12"
,
"Framework :: Django"
,
"Framework :: Django"
,
"License :: OSI Approved :: BSD License"
,
"License :: OSI Approved :: BSD License"
,
],
],
...
...
tests/app/migrations/0003_alter_customvideotrack_file_and_more.py
0 → 100644
View file @
f4da2207
# Generated by Django 4.1.13 on 2023-12-30 00:45
from
django.db
import
migrations
,
models
import
wagtailvideos.models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'app'
,
'0002_alter_testpage_video_streamfield'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'customvideotrack'
,
name
=
'file'
,
field
=
models
.
FileField
(
upload_to
=
wagtailvideos
.
models
.
get_upload_to
,
verbose_name
=
'File'
),
),
migrations
.
AlterField
(
model_name
=
'customvideotrack'
,
name
=
'kind'
,
field
=
models
.
CharField
(
choices
=
[(
'subtitles'
,
'Subtitles'
),
(
'captions'
,
'Captions'
),
(
'descriptions'
,
'Descriptions'
),
(
'chapters'
,
'Chapters'
),
(
'metadata'
,
'Metadata'
)],
default
=
'subtitles'
,
max_length
=
50
,
verbose_name
=
'Kind'
),
),
migrations
.
AlterField
(
model_name
=
'customvideotrack'
,
name
=
'label'
,
field
=
models
.
CharField
(
blank
=
True
,
help_text
=
'A user-readable title of the text track.'
,
max_length
=
255
,
verbose_name
=
'Label'
),
),
migrations
.
AlterField
(
model_name
=
'customvideotrack'
,
name
=
'language'
,
field
=
models
.
CharField
(
blank
=
True
,
choices
=
[(
'aa'
,
'Afar'
),
(
'aa-DJ'
,
'Afar - Djibouti'
),
(
'aa-ER'
,
'Afar - Eritrea'
),
(
'aa-ET'
,
'Afar - Ethiopia'
),
(
'af'
,
'Afrikaans'
),
(
'af-NA'
,
'Afrikaans - Namibia'
),
(
'af-ZA'
,
'Afrikaans - South Africa'
),
(
'agq'
,
'Aghem'
),
(
'agq-CM'
,
'Aghem - Cameroon'
),
(
'ak'
,
'Akan'
),
(
'ak-GH'
,
'Akan - Ghana'
),
(
'sq'
,
'Albanian'
),
(
'sq-AL'
,
'Albanian - Albania'
),
(
'sq-MK'
,
'Albanian - North Macedonia'
),
(
'gsw'
,
'Alsatian'
),
(
'gsw-FR'
,
'Alsatian - France'
),
(
'gsw-LI'
,
'Alsatian - Liechtenstein'
),
(
'gsw-CH'
,
'Alsatian - Switzerland'
),
(
'am'
,
'Amharic'
),
(
'am-ET'
,
'Amharic - Ethiopia'
),
(
'ar'
,
'Arabic'
),
(
'ar-DZ'
,
'Arabic - Algeria'
),
(
'ar-BH'
,
'Arabic - Bahrain'
),
(
'ar-TD'
,
'Arabic - Chad'
),
(
'ar-KM'
,
'Arabic - Comoros'
),
(
'ar-DJ'
,
'Arabic - Djibouti'
),
(
'ar-EG'
,
'Arabic - Egypt'
),
(
'ar-ER'
,
'Arabic - Eritrea'
),
(
'ar-IQ'
,
'Arabic - Iraq'
),
(
'ar-IL'
,
'Arabic - Israel'
),
(
'ar-JO'
,
'Arabic - Jordan'
),
(
'ar-KW'
,
'Arabic - Kuwait'
),
(
'ar-LB'
,
'Arabic - Lebanon'
),
(
'ar-LY'
,
'Arabic - Libya'
),
(
'ar-MR'
,
'Arabic - Mauritania'
),
(
'ar-MA'
,
'Arabic - Morocco'
),
(
'ar-OM'
,
'Arabic - Oman'
),
(
'ar-PS'
,
'Arabic - Palestinian Authority'
),
(
'ar-QA'
,
'Arabic - Qatar'
),
(
'ar-SA'
,
'Arabic - Saudi Arabia'
),
(
'ar-SO'
,
'Arabic - Somalia'
),
(
'ar-SS'
,
'Arabic - South Sudan'
),
(
'ar-SD'
,
'Arabic - Sudan'
),
(
'ar-SY'
,
'Arabic - Syria'
),
(
'ar-TN'
,
'Arabic - Tunisia'
),
(
'ar-AE'
,
'Arabic - U.A.E.'
),
(
'ar-001'
,
'Arabic - World'
),
(
'ar-YE'
,
'Arabic - Yemen'
),
(
'hy'
,
'Armenian'
),
(
'hy-AM'
,
'Armenian - Armenia'
),
(
'as'
,
'Assamese'
),
(
'as-IN'
,
'Assamese - India'
),
(
'ast'
,
'Asturian'
),
(
'ast-ES'
,
'Asturian - Spain'
),
(
'asa'
,
'Asu'
),
(
'asa-TZ'
,
'Asu - Tanzania'
),
(
'az-Cyrl'
,
'Azerbaijani (Cyrillic)'
),
(
'az-Cyrl-AZ'
,
'Azerbaijani (Cyrillic) - Azerbaijan'
),
(
'az'
,
'Azerbaijani (Latin)'
),
(
'az-Latn'
,
'Azerbaijani (Latin), Latn'
),
(
'az-Latn-AZ'
,
'Azerbaijani (Latin) - Azerbaijan'
),
(
'ksf'
,
'Bafia'
),
(
'ksf-CM'
,
'Bafia - Cameroon'
),
(
'bm'
,
'Bamanankan'
),
(
'bm-Latn-ML'
,
'Bamanankan (Latin) - Mali'
),
(
'bn'
,
'Bangla'
),
(
'bn-BD'
,
'Bangla - Bangladesh'
),
(
'bn-IN'
,
'Bangla - India'
),
(
'bas'
,
'Basaa'
),
(
'bas-CM'
,
'Basaa - Cameroon'
),
(
'ba'
,
'Bashkir'
),
(
'ba-RU'
,
'Bashkir - Russia'
),
(
'eu'
,
'Basque'
),
(
'eu-ES'
,
'Basque - Spain'
),
(
'be'
,
'Belarusian'
),
(
'be-BY'
,
'Belarusian - Belarus'
),
(
'bem'
,
'Bemba'
),
(
'bem-ZM'
,
'Bemba - Zambia'
),
(
'bez'
,
'Bena'
),
(
'bez-TZ'
,
'Bena - Tanzania'
),
(
'byn'
,
'Blin'
),
(
'byn-ER'
,
'Blin - Eritrea'
),
(
'brx'
,
'Bodo'
),
(
'brx-IN'
,
'Bodo - India'
),
(
'bs-Cyrl'
,
'Bosnian (Cyrillic)'
),
(
'bs-Cyrl-BA'
,
'Bosnian (Cyrillic) - Bosnia and Herzegovina'
),
(
'bs'
,
'Bosnian (Latin)'
),
(
'bs-Latn'
,
'Bosnian (Latin), Latn'
),
(
'bs-Latn-BA'
,
'Bosnian (Latin) - Bosnia and Herzegovina'
),
(
'br'
,
'Breton'
),
(
'br-FR'
,
'Breton - France'
),
(
'bg'
,
'Bulgarian'
),
(
'bg-BG'
,
'Bulgarian - Bulgaria'
),
(
'my'
,
'Burmese'
),
(
'my-MM'
,
'Burmese - Myanmar'
),
(
'ca'
,
'Catalan'
),
(
'ca-AD'
,
'Catalan - Andorra'
),
(
'ca-FR'
,
'Catalan - France'
),
(
'ca-IT'
,
'Catalan - Italy'
),
(
'ca-ES'
,
'Catalan - Spain'
),
(
'ceb'
,
'Cebuano'
),
(
'ceb-Latn'
,
'Cebuan (Latin)'
),
(
'ceb-Latn-PH'
,
'Cebuan (Latin) - Philippines'
),
(
'tzm-Latn-MA'
,
'Central Atlas Tamazight (Latin) - Morocco'
),
(
'ku'
,
'Central Kurdish'
),
(
'ku-Arab'
,
'Central Kurdish, Arab'
),
(
'ku-Arab-IQ'
,
'Central Kurdish - Iraq'
),
(
'ccp'
,
'Chakma'
),
(
'ccp-Cakm'
,
'Chakma - Chakma'
),
(
'ccp-Cakm-BD'
,
'Chakma - Bangladesh'
),
(
'ccp-Cakm-IN'
,
'Chakma - India'
),
(
'cd-RU'
,
'Chechen - Russia'
),
(
'chr'
,
'Cherokee'
),
(
'chr-Cher'
,
'Cherokee, Cher'
),
(
'chr-Cher-US'
,
'Cherokee - United States'
),
(
'cgg'
,
'Chiga'
),
(
'cgg-UG'
,
'Chiga - Uganda'
),
(
'zh'
,
'Chinese (Simplified)'
),
(
'zh-Hans'
,
'Chinese (Simplified), Hans'
),
(
'zh-CN'
,
"Chinese (Simplified) - People's Republic of China"
),
(
'zh-SG'
,
'Chinese (Simplified) - Singapore'
),
(
'zh-Hant'
,
'Chinese (Traditional)'
),
(
'zh-HK'
,
'Chinese (Traditional) - Hong Kong S.A.R.'
),
(
'zh-MO'
,
'Chinese (Traditional) - Macao S.A.R.'
),
(
'zh-TW'
,
'Chinese (Traditional) - Taiwan'
),
(
'cu-RU'
,
'Church Slavic - Russia'
),
(
'swc'
,
'Congo Swahili'
),
(
'swc-CD'
,
'Congo Swahili - Congo DRC'
),
(
'kw'
,
'Cornish'
),
(
'kw-GB'
,
'Cornish - United Kingdom'
),
(
'co'
,
'Corsican'
),
(
'co-FR'
,
'Corsican - France'
),
(
'hr,'
,
'Croatian'
),
(
'hr-HR'
,
'Croatian - Croatia'
),
(
'hr-BA'
,
'Croatian (Latin) - Bosnia and Herzegovina'
),
(
'cs'
,
'Czech'
),
(
'cs-CZ'
,
'Czech - Czech Republic'
),
(
'da'
,
'Danish'
),
(
'da-DK'
,
'Danish - Denmark'
),
(
'da-GL'
,
'Danish - Greenland'
),
(
'prs'
,
'Dari'
),
(
'prs-AF'
,
'Dari - Afghanistan'
),
(
'dv'
,
'Divehi'
),
(
'dv-MV'
,
'Divehi - Maldives'
),
(
'dua'
,
'Duala'
),
(
'dua-CM'
,
'Duala - Cameroon'
),
(
'nl'
,
'Dutch'
),
(
'nl-AW'
,
'Dutch - Aruba'
),
(
'nl-BE'
,
'Dutch - Belgium'
),
(
'nl-BQ'
,
'Dutch - Bonaire, Sint Eustatius and Saba'
),
(
'nl-CW'
,
'Dutch - Curaçao'
),
(
'nl-NL'
,
'Dutch - Netherlands'
),
(
'nl-SX'
,
'Dutch - Sint Maarten'
),
(
'nl-SR'
,
'Dutch - Suriname'
),
(
'dz'
,
'Dzongkha'
),
(
'dz-BT'
,
'Dzongkha - Bhutan'
),
(
'ebu'
,
'Embu'
),
(
'ebu-KE'
,
'Embu - Kenya'
),
(
'en'
,
'English'
),
(
'en-AS'
,
'English - American Samoa'
),
(
'en-AI'
,
'English - Anguilla'
),
(
'en-AG'
,
'English - Antigua and Barbuda'
),
(
'en-AU'
,
'English - Australia'
),
(
'en-AT'
,
'English - Austria'
),
(
'en-BS'
,
'English - Bahamas'
),
(
'en-BB'
,
'English - Barbados'
),
(
'en-BE'
,
'English - Belgium'
),
(
'en-BZ'
,
'English - Belize'
),
(
'en-BM'
,
'English - Bermuda'
),
(
'en-BW'
,
'English - Botswana'
),
(
'en-IO'
,
'English - British Indian Ocean Territory'
),
(
'en-VG'
,
'English - British Virgin Islands'
),
(
'en-BI'
,
'English - Burundi'
),
(
'en-CM'
,
'English - Cameroon'
),
(
'en-CA'
,
'English - Canada'
),
(
'en-029'
,
'English - Caribbean'
),
(
'en-KY'
,
'English - Cayman Islands'
),
(
'en-CX'
,
'English - Christmas Island'
),
(
'en-CC'
,
'English - Cocos [Keeling] Islands'
),
(
'en-CK'
,
'English - Cook Islands'
),
(
'en-CY'
,
'English - Cyprus'
),
(
'en-DK'
,
'English - Denmark'
),
(
'en-DM'
,
'English - Dominica'
),
(
'en-ER'
,
'English - Eritrea'
),
(
'en-150'
,
'English - Europe'
),
(
'en-FK'
,
'English - Falkland Islands'
),
(
'en-FI'
,
'English - Finland'
),
(
'en-FJ'
,
'English - Fiji'
),
(
'en-GM'
,
'English - Gambia'
),
(
'en-DE'
,
'English - Germany'
),
(
'en-GH'
,
'English - Ghana'
),
(
'en-GI'
,
'English - Gibraltar'
),
(
'en-GD'
,
'English - Grenada'
),
(
'en-GU'
,
'English - Guam'
),
(
'en-GG'
,
'English - Guernsey'
),
(
'en-GY'
,
'English - Guyana'
),
(
'en-HK'
,
'English - Hong Kong'
),
(
'en-IN'
,
'English - India'
),
(
'en-IE'
,
'English - Ireland'
),
(
'en-IM'
,
'English - Isle of Man'
),
(
'en-IL'
,
'English - Israel'
),
(
'en-JM'
,
'English - Jamaica'
),
(
'en-JE'
,
'English - Jersey'
),
(
'en-KE'
,
'English - Kenya'
),
(
'en-KI'
,
'English - Kiribati'
),
(
'en-LS'
,
'English - Lesotho'
),
(
'en-LR'
,
'English - Liberia'
),
(
'en-MO'
,
'English - Macao SAR'
),
(
'en-MG'
,
'English - Madagascar'
),
(
'en-MW'
,
'English - Malawi'
),
(
'en-MY'
,
'English - Malaysia'
),
(
'en-MT'
,
'English - Malta'
),
(
'en-MH'
,
'English - Marshall Islands'
),
(
'en-MU'
,
'English - Mauritius'
),
(
'en-FM'
,
'English - Micronesia'
),
(
'en-MS'
,
'English - Montserrat'
),
(
'en-NA'
,
'English - Namibia'
),
(
'en-NR'
,
'English - Nauru'
),
(
'en-NL'
,
'English - Netherlands'
),
(
'en-NZ'
,
'English - New Zealand'
),
(
'en-NG'
,
'English - Nigeria'
),
(
'en-NU'
,
'English - Niue'
),
(
'en-NF'
,
'English - Norfolk Island'
),
(
'en-MP'
,
'English - Northern Mariana Islands'
),
(
'en-PK'
,
'English - Pakistan'
),
(
'en-PW'
,
'English - Palau'
),
(
'en-PG'
,
'English - Papua New Guinea'
),
(
'en-PN'
,
'English - Pitcairn Islands'
),
(
'en-PR'
,
'English - Puerto Rico'
),
(
'en-PH'
,
'English - Republic of the Philippines'
),
(
'en-RW'
,
'English - Rwanda'
),
(
'en-KN'
,
'English - Saint Kitts and Nevis'
),
(
'en-LC'
,
'English - Saint Lucia'
),
(
'en-VC'
,
'English - Saint Vincent and the Grenadines'
),
(
'en-WS'
,
'English - Samoa'
),
(
'en-SC'
,
'English - Seychelles'
),
(
'en-SL'
,
'English - Sierra Leone'
),
(
'en-SG'
,
'English - Singapore'
),
(
'en-SX'
,
'English - Sint Maarten'
),
(
'en-SI'
,
'English - Slovenia'
),
(
'en-SB'
,
'English - Solomon Islands'
),
(
'en-ZA'
,
'English - South Africa'
),
(
'en-SS'
,
'English - South Sudan'
),
(
'en-SH'
,
'English - St Helena, Ascension, Tristan da Cunha'
),
(
'en-SD'
,
'English - Sudan'
),
(
'en-SZ'
,
'English - Swaziland'
),
(
'en-SE'
,
'English - Sweden'
),
(
'en-CH'
,
'English - Switzerland'
),
(
'en-TZ'
,
'English - Tanzania'
),
(
'en-TK'
,
'English - Tokelau'
),
(
'en-TO'
,
'English - Tonga'
),
(
'en-TT'
,
'English - Trinidad and Tobago'
),
(
'en-TC'
,
'English - Turks and Caicos Islands'
),
(
'en-TV'
,
'English - Tuvalu'
),
(
'en-UG'
,
'English - Uganda'
),
(
'en-AE'
,
'English - United Arab Emirates'
),
(
'en-GB'
,
'English - United Kingdom'
),
(
'en-US'
,
'English - United States'
),
(
'en-UM'
,
'English - US Minor Outlying Islands'
),
(
'en-VI'
,
'English - US Virgin Islands'
),
(
'en-VU'
,
'English - Vanuatu'
),
(
'en-001'
,
'English - World'
),
(
'en-ZM'
,
'English - Zambia'
),
(
'en-ZW'
,
'English - Zimbabwe'
),
(
'eo'
,
'Esperanto'
),
(
'eo-001'
,
'Esperanto - World'
),
(
'et'
,
'Estonian'
),
(
'et-EE'
,
'Estonian - Estonia'
),
(
'ee'
,
'Ewe'
),
(
'ee-GH'
,
'Ewe - Ghana'
),
(
'ee-TG'
,
'Ewe - Togo'
),
(
'ewo'
,
'Ewondo'
),
(
'ewo-CM'
,
'Ewondo - Cameroon'
),
(
'fo'
,
'Faroese'
),
(
'fo-DK'
,
'Faroese - Denmark'
),
(
'fo-FO'
,
'Faroese - Faroe Islands'
),
(
'fil'
,
'Filipino'
),
(
'fil-PH'
,
'Filipino - Philippines'
),
(
'fi'
,
'Finnish'
),
(
'fi-FI'
,
'Finnish - Finland'
),
(
'fr'
,
'French'
),
(
'fr-DZ'
,
'French - Algeria'
),
(
'fr-BE'
,
'French - Belgium'
),
(
'fr-BJ'
,
'French - Benin'
),
(
'fr-BF'
,
'French - Burkina Faso'
),
(
'fr-BI'
,
'French - Burundi'
),
(
'fr-CM'
,
'French - Cameroon'
),
(
'fr-CA'
,
'French - Canada'
),
(
'fr-CF'
,
'French - Central African Republic'
),
(
'fr-TD'
,
'French - Chad'
),
(
'fr-KM'
,
'French - Comoros'
),
(
'fr-CG'
,
'French - Congo'
),
(
'fr-CD'
,
'French - Congo, DRC'
),
(
'fr-CI'
,
"French - Côte d'Ivoire"
),
(
'fr-DJ'
,
'French - Djibouti'
),
(
'fr-GQ'
,
'French - Equatorial Guinea'
),
(
'fr-FR'
,
'French - France'
),
(
'fr-GF'
,
'French - French Guiana'
),
(
'fr-PF'
,
'French - French Polynesia'
),
(
'fr-GA'
,
'French - Gabon'
),
(
'fr-GP'
,
'French - Guadeloupe'
),
(
'fr-GN'
,
'French - Guinea'
),
(
'fr-HT'
,
'French - Haiti'
),
(
'fr-LU'
,
'French - Luxembourg'
),
(
'fr-MG'
,
'French - Madagascar'
),
(
'fr-ML'
,
'French - Mali'
),
(
'fr-MQ'
,
'French - Martinique'
),
(
'fr-MR'
,
'French - Mauritania'
),
(
'fr-MU'
,
'French - Mauritius'
),
(
'fr-YT'
,
'French - Mayotte'
),
(
'fr-MA'
,
'French - Morocco'
),
(
'fr-NC'
,
'French - New Caledonia'
),
(
'fr-NE'
,
'French - Niger'
),
(
'fr-MC'
,
'French - Principality of Monaco'
),
(
'fr-RE'
,
'French - Reunion'
),
(
'fr-RW'
,
'French - Rwanda'
),
(
'fr-BL'
,
'French - Saint Barthélemy'
),
(
'fr-MF'
,
'French - Saint Martin'
),
(
'fr-PM'
,
'French - Saint Pierre and Miquelon'
),
(
'fr-SN'
,
'French - Senegal'
),
(
'fr-SC'
,
'French - Seychelles'
),
(
'fr-CH'
,
'French - Switzerland'
),
(
'fr-SY'
,
'French - Syria'
),
(
'fr-TG'
,
'French - Togo'
),
(
'fr-TN'
,
'French - Tunisia'
),
(
'fr-VU'
,
'French - Vanuatu'
),
(
'fr-WF'
,
'French - Wallis and Futuna'
),
(
'fy'
,
'Frisian'
),
(
'fy-NL'
,
'Frisian - Netherlands'
),
(
'fur'
,
'Friulian'
),
(
'fur-IT'
,
'Friulian - Italy'
),
(
'ff'
,
'Fulah'
),
(
'ff-Latn'
,
'Fulah (Latin)'
),
(
'ff-Latn-BF'
,
'Fulah (Latin) - Burkina Faso'
),
(
'ff-CM'
,
'Fulah - Cameroon'
),
(
'ff-Latn-CM'
,
'Fulah (Latin) - Cameroon'
),
(
'ff-Latn-GM'
,
'Fulah (Latin) - Gambia'
),
(
'ff-Latn-GH'
,
'Fulah (Latin) - Ghana'
),
(
'ff-GN'
,
'Fulah - Guinea'
),
(
'ff-Latn-GN'
,
'Fulah (Latin) - Guinea'
),
(
'ff-Latn-GW'
,
'Fulah (Latin) - Guinea-Bissau'
),
(
'ff-Latn-LR'
,
'Fulah (Latin) - Liberia'
),
(
'ff-MR'
,
'Fulah - Mauritania'
),
(
'ff-Latn-MR'
,
'Fulah (Latin) - Mauritania'
),
(
'ff-Latn-NE'
,
'Fulah (Latin) - Niger'
),
(
'ff-NG'
,
'Fulah - Nigeria'
),
(
'ff-Latn-NG'
,
'Fulah (Latin) - Nigeria'
),
(
'ff-Latn-SN'
,
'Fulah - Senegal'
),
(
'ff-Latn-SL'
,
'Fulah (Latin) - Sierra Leone'
),
(
'gl'
,
'Galician'
),
(
'gl-ES'
,
'Galician - Spain'
),
(
'lg'
,
'Ganda'
),
(
'lg-UG'
,
'Ganda - Uganda'
),
(
'ka'
,
'Georgian'
),
(
'ka-GE'
,
'Georgian - Georgia'
),
(
'de'
,
'German'
),
(
'de-AT'
,
'German - Austria'
),
(
'de-BE'
,
'German - Belgium'
),
(
'de-DE'
,
'German - Germany'
),
(
'de-IT'
,
'German - Italy'
),
(
'de-LI'
,
'German - Liechtenstein'
),
(
'de-LU'
,
'German - Luxembourg'
),
(
'de-CH'
,
'German - Switzerland'
),
(
'el'
,
'Greek'
),
(
'el-CY'
,
'Greek - Cyprus'
),
(
'el-GR'
,
'Greek - Greece'
),
(
'kl'
,
'Greenlandic'
),
(
'kl-GL'
,
'Greenlandic - Greenland'
),
(
'gn'
,
'Guarani'
),
(
'gn-PY'
,
'Guarani - Paraguay'
),
(
'gu'
,
'Gujarati'
),
(
'gu-IN'
,
'Gujarati - India'
),
(
'guz'
,
'Gusii'
),
(
'guz-KE'
,
'Gusii - Kenya'
),
(
'ha'
,
'Hausa (Latin)'
),
(
'ha-Latn'
,
'Hausa (Latin), Latn'
),
(
'ha-Latn-GH'
,
'Hausa (Latin) - Ghana'
),
(
'ha-Latn-NE'
,
'Hausa (Latin) - Niger'
),
(
'ha-Latn-NG'
,
'Hausa (Latin) - Nigeria'
),
(
'haw'
,
'Hawaiian'
),
(
'haw-US'
,
'Hawaiian - United States'
),
(
'he'
,
'Hebrew'
),
(
'he-IL'
,
'Hebrew - Israel'
),
(
'hi'
,
'Hindi'
),
(
'hi-IN'
,
'Hindi - India'
),
(
'hu'
,
'Hungarian'
),
(
'hu-HU'
,
'Hungarian - Hungary'
),
(
'is'
,
'Icelandic'
),
(
'is-IS'
,
'Icelandic - Iceland'
),
(
'ig'
,
'Igbo'
),
(
'ig-NG'
,
'Igbo - Nigeria'
),
(
'id'
,
'Indonesian'
),
(
'id-ID'
,
'Indonesian - Indonesia'
),
(
'ia'
,
'Interlingua'
),
(
'ia-FR'
,
'Interlingua - France'
),
(
'ia-001'
,
'Interlingua - World'
),
(
'iu'
,
'Inuktitut (Latin)'
),
(
'iu-Latn'
,
'Inuktitut (Latin), Latn'
),
(
'iu-Latn-CA'
,
'Inuktitut (Latin) - Canada'
),
(
'iu-Cans'
,
'Inuktitut (Syllabics)'
),
(
'iu-Cans-CA'
,
'Inuktitut (Syllabics) - Canada'
),
(
'ga'
,
'Irish'
),
(
'ga-IE'
,
'Irish - Ireland'
),
(
'it'
,
'Italian'
),
(
'it-IT'
,
'Italian - Italy'
),
(
'it-SM'
,
'Italian - San Marino'
),
(
'it-CH'
,
'Italian - Switzerland'
),
(
'it-VA'
,
'Italian - Vatican City'
),
(
'ja'
,
'Japanese'
),
(
'ja-JP'
,
'Japanese - Japan'
),
(
'jv'
,
'Javanese'
),
(
'jv-Latn'
,
'Javanese - Latin'
),
(
'jv-Latn-ID'
,
'Javanese - Latin, Indonesia'
),
(
'dyo'
,
'Jola-Fonyi'
),
(
'dyo-SN'
,
'Jola-Fonyi - Senegal'
),
(
'kea'
,
'Kabuverdianu'
),
(
'kea-CV'
,
'Kabuverdianu - Cabo Verde'
),
(
'kab'
,
'Kabyle'
),
(
'kab-DZ'
,
'Kabyle - Algeria'
),
(
'kkj'
,
'Kako'
),
(
'kkj-CM'
,
'Kako - Cameroon'
),
(
'kln'
,
'Kalenjin'
),
(
'kln-KE'
,
'Kalenjin - Kenya'
),
(
'kam'
,
'Kamba'
),
(
'kam-KE'
,
'Kamba - Kenya'
),
(
'kn'
,
'Kannada'
),
(
'kn-IN'
,
'Kannada - India'
),
(
'ks'
,
'Kashmiri'
),
(
'ks-Arab'
,
'Kashmiri - Perso-Arabic'
),
(
'ks-Arab-IN'
,
'Kashmiri - Perso-Arabic, IN'
),
(
'kk'
,
'Kazakh'
),
(
'kk-KZ'
,
'Kazakh - Kazakhstan'
),
(
'km'
,
'Khmer'
),
(
'km-KH'
,
'Khmer - Cambodia'
),
(
'quc'
,
"K'iche"
),
(
'quc-Latn-GT'
,
"K'iche - Guatemala"
),
(
'ki'
,
'Kikuyu'
),
(
'ki-KE'
,
'Kikuyu - Kenya'
),
(
'rw'
,
'Kinyarwanda'
),
(
'rw-RW'
,
'Kinyarwanda - Rwanda'
),
(
'sw'
,
'Kiswahili'
),
(
'sw-KE'
,
'Kiswahili - Kenya'
),
(
'sw-TZ'
,
'Kiswahili - Tanzania'
),
(
'sw-UG'
,
'Kiswahili - Uganda'
),
(
'kok'
,
'Konkani'
),
(
'kok-IN'
,
'Konkani - India'
),
(
'ko'
,
'Korean'
),
(
'ko-KR'
,
'Korean - Korea'
),
(
'ko-KP'
,
'Korean - North Korea'
),
(
'khq'
,
'Koyra Chiini'
),
(
'khq-ML'
,
'Koyra Chiini - Mali'
),
(
'ses'
,
'Koyraboro Senni'
),
(
'ses-ML'
,
'Koyraboro Senni - Mali'
),
(
'nmg'
,
'Kwasio'
),
(
'nmg-CM'
,
'Kwasio - Cameroon'
),
(
'ky'
,
'Kyrgyz'
),
(
'ky-KG'
,
'Kyrgyz - Kyrgyzstan'
),
(
'ku-Arab-IR'
,
'Kurdish - Perso-Arabic, Iran'
),
(
'lkt'
,
'Lakota'
),
(
'lkt-US'
,
'Lakota - United States'
),
(
'lag'
,
'Langi'
),
(
'lag-TZ'
,
'Langi - Tanzania'
),
(
'lo'
,
'Lao'
),
(
'lo-LA'
,
'Lao - Lao P.D.R.'
),
(
'lv'
,
'Latvian'
),
(
'lv-LV'
,
'Latvian - Latvia'
),
(
'ln'
,
'Lingala'
),
(
'ln-AO'
,
'Lingala - Angola'
),
(
'ln-CF'
,
'Lingala - Central African Republic'
),
(
'ln-CG'
,
'Lingala - Congo'
),
(
'ln-CD'
,
'Lingala - Congo DRC'
),
(
'lt'
,
'Lithuanian'
),
(
'lt-LT'
,
'Lithuanian - Lithuania'
),
(
'nds'
,
'Low German'
),
(
'nds-DE'
,
'Low German - Germany'
),
(
'nds-NL'
,
'Low German - Netherlands'
),
(
'dsb'
,
'Lower Sorbian'
),
(
'dsb-DE'
,
'Lower Sorbian - Germany'
),
(
'lu'
,
'Luba-Katanga'
),
(
'lu-CD'
,
'Luba-Katanga - Congo DRC'
),
(
'luo'
,
'Luo'
),
(
'luo-KE'
,
'Luo - Kenya'
),
(
'lb'
,
'Luxembourgish'
),
(
'lb-LU'
,
'Luxembourgish - Luxembourg'
),
(
'luy'
,
'Luyia'
),
(
'luy-KE'
,
'Luyia - Kenya'
),
(
'mk'
,
'Macedonian'
),
(
'mk-MK'
,
'Macedonian - North Macedonia'
),
(
'jmc'
,
'Machame'
),
(
'jmc-TZ'
,
'Machame - Tanzania'
),
(
'mgh'
,
'Makhuwa-Meetto'
),
(
'mgh-MZ'
,
'Makhuwa-Meetto - Mozambique'
),
(
'kde'
,
'Makonde'
),
(
'kde-TZ'
,
'Makonde - Tanzania'
),
(
'mg'
,
'Malagasy'
),
(
'mg-MG'
,
'Malagasy - Madagascar'
),
(
'ms'
,
'Malay'
),
(
'ms-BN'
,
'Malay - Brunei Darussalam'
),
(
'ms-MY'
,
'Malay - Malaysia'
),
(
'ml'
,
'Malayalam'
),
(
'ml-IN'
,
'Malayalam - India'
),
(
'mt'
,
'Maltese'
),
(
'mt-MT'
,
'Maltese - Malta'
),
(
'gv'
,
'Manx'
),
(
'gv-IM'
,
'Manx - Isle of Man'
),
(
'mi'
,
'Maori'
),
(
'mi-NZ'
,
'Maori - New Zealand'
),
(
'arn'
,
'Mapudungun'
),
(
'arn-CL'
,
'Mapudungun - Chile'
),
(
'mr'
,
'Marathi'
),
(
'mr-IN'
,
'Marathi - India'
),
(
'mas'
,
'Masai'
),
(
'mas-KE'
,
'Masai - Kenya'
),
(
'mas-TZ'
,
'Masai - Tanzania'
),
(
'mzn-IR'
,
'Mazanderani - Iran'
),
(
'mer'
,
'Meru'
),
(
'mer-KE'
,
'Meru - Kenya'
),
(
'mgo'
,
"Meta'"
),
(
'mgo-CM'
,
"Meta' - Cameroon"
),
(
'moh'
,
'Mohawk'
),
(
'moh-CA'
,
'Mohawk - Canada'
),
(
'mn'
,
'Mongolian (Cyrillic)'
),
(
'mn-Cyrl'
,
'Mongolian (Cyrillic), Cyrl'
),
(
'mn-MN'
,
'Mongolian (Cyrillic) - Mongolia'
),
(
'mn-Mong'
,
'Mongolian (Traditional Mongolian)'
),
(
'mn-Mong-CN'
,
"Mongolian (Traditional Mongolian) - People's Republic of China"
),
(
'mn-Mong-MN'
,
'Mongolian (Traditional Mongolian) - Mongolia'
),
(
'mfe'
,
'Morisyen'
),
(
'mfe-MU'
,
'Morisyen - Mauritius'
),
(
'mua'
,
'Mundang'
),
(
'mua-CM'
,
'Mundang - Cameroon'
),
(
'nqo'
,
"N'ko"
),
(
'nqo-GN'
,
"N'ko - Guinea"
),
(
'naq'
,
'Nama'
),
(
'naq-NA'
,
'Nama - Namibia'
),
(
'ne'
,
'Nepali'
),
(
'ne-IN'
,
'Nepali - India'
),
(
'ne-NP'
,
'Nepali - Nepal'
),
(
'nnh'
,
'Ngiemboon'
),
(
'nnh-CM'
,
'Ngiemboon - Cameroon'
),
(
'jgo'
,
'Ngomba'
),
(
'jgo-CM'
,
'Ngomba - Cameroon'
),
(
'lrc-IQ'
,
'Northern Luri - Iraq'
),
(
'lrc-IR'
,
'Northern Luri - Iran'
),
(
'nd'
,
'North Ndebele'
),
(
'nd-ZW'
,
'North Ndebele - Zimbabwe'
),
(
'no'
,
'Norwegian (Bokmal)'
),
(
'nb'
,
'Norwegian (Bokmal), nb'
),
(
'nb-NO'
,
'Norwegian (Bokmal) - Norway'
),
(
'nn'
,
'Norwegian (Nynorsk)'
),
(
'nn-NO'
,
'Norwegian (Nynorsk) - Norway'
),
(
'nb-SJ'
,
'Norwegian Bokmål - Svalbard and Jan Mayen'
),
(
'nus'
,
'Nuer'
),
(
'nus-SD'
,
'Nuer - Sudan'
),
(
'nus-SS'
,
'Nuer - South Sudan'
),
(
'nyn'
,
'Nyankole'
),
(
'nyn-UG'
,
'Nyankole - Uganda'
),
(
'oc'
,
'Occitan'
),
(
'oc-FR'
,
'Occitan - France'
),
(
'or'
,
'Odia'
),
(
'or-IN'
,
'Odia - India'
),
(
'om'
,
'Oromo'
),
(
'om-ET'
,
'Oromo - Ethiopia'
),
(
'om-KE'
,
'Oromo - Kenya'
),
(
'os'
,
'Ossetian'
),
(
'os-GE'
,
'Ossetian - Cyrillic, Georgia'
),
(
'os-RU'
,
'Ossetian - Cyrillic, Russia'
),
(
'ps'
,
'Pashto'
),
(
'ps-AF'
,
'Pashto - Afghanistan'
),
(
'ps-PK'
,
'Pashto - Pakistan'
),
(
'fa'
,
'Persian'
),
(
'fa-AF'
,
'Persian - Afghanistan'
),
(
'fa-IR'
,
'Persian - Iran'
),
(
'pl'
,
'Polish'
),
(
'pl-PL'
,
'Polish - Poland'
),
(
'pt'
,
'Portuguese'
),
(
'pt-AO'
,
'Portuguese - Angola'
),
(
'pt-BR'
,
'Portuguese - Brazil'
),
(
'pt-CV'
,
'Portuguese - Cabo Verde'
),
(
'pt-GQ'
,
'Portuguese - Equatorial Guinea'
),
(
'pt-GW'
,
'Portuguese - Guinea-Bissau'
),
(
'pt-LU'
,
'Portuguese - Luxembourg'
),
(
'pt-MO'
,
'Portuguese - Macao SAR'
),
(
'pt-MZ'
,
'Portuguese - Mozambique'
),
(
'pt-PT'
,
'Portuguese - Portugal'
),
(
'pt-ST'
,
'Portuguese - São Tomé and Príncipe'
),
(
'pt-CH'
,
'Portuguese - Switzerland'
),
(
'pt-TL'
,
'Portuguese - Timor-Leste'
),
(
'prg-001'
,
'Prussian'
),
(
'qps-ploca'
,
'Pseudo Language - Pseudo locale for east Asian/complex script localization testing'
),
(
'qps-ploc'
,
'Pseudo Language - Pseudo locale used for localization testing'
),
(
'qps-plocm'
,
'Pseudo Language - Pseudo locale used for localization testing of mirroredlocales'
),
(
'pa'
,
'Punjabi'
),
(
'pa-Arab'
,
'Punjabi, Arab'
),
(
'pa-IN'
,
'Punjabi - India'
),
(
'pa-Arab-PK'
,
'Punjabi - Islamic Republic of Pakistan'
),
(
'quz'
,
'Quechua'
),
(
'quz-BO'
,
'Quechua - Bolivia'
),
(
'quz-EC'
,
'Quechua - Ecuador'
),
(
'quz-PE'
,
'Quechua - Peru'
),
(
'ksh'
,
'Ripuarian'
),
(
'ksh-DE'
,
'Ripuarian - Germany'
),
(
'ro'
,
'Romanian'
),
(
'ro-MD'
,
'Romanian - Moldova'
),
(
'ro-RO'
,
'Romanian - Romania'
),
(
'rm'
,
'Romansh'
),
(
'rm-CH'
,
'Romansh - Switzerland'
),
(
'rof'
,
'Rombo'
),
(
'rof-TZ'
,
'Rombo - Tanzania'
),
(
'rn'
,
'Rundi'
),
(
'rn-BI'
,
'Rundi - Burundi'
),
(
'ru'
,
'Russian'
),
(
'ru-BY'
,
'Russian - Belarus'
),
(
'ru-KZ'
,
'Russian - Kazakhstan'
),
(
'ru-KG'
,
'Russian - Kyrgyzstan'
),
(
'ru-MD'
,
'Russian - Moldova'
),
(
'ru-RU'
,
'Russian - Russia'
),
(
'ru-UA'
,
'Russian - Ukraine'
),
(
'rwk'
,
'Rwa'
),
(
'rwk-TZ'
,
'Rwa - Tanzania'
),
(
'ssy'
,
'Saho'
),
(
'ssy-ER'
,
'Saho - Eritrea'
),
(
'sah'
,
'Sakha'
),
(
'sah-RU'
,
'Sakha - Russia'
),
(
'saq'
,
'Samburu'
),
(
'saq-KE'
,
'Samburu - Kenya'
),
(
'smn'
,
'Sami (Inari)'
),
(
'smn-FI'
,
'Sami (Inari) - Finland'
),
(
'smj'
,
'Sami (Lule)'
),
(
'smj-NO'
,
'Sami (Lule) - Norway'
),
(
'smj-SE'
,
'Sami (Lule) - Sweden'
),
(
'se'
,
'Sami (Northern)'
),
(
'se-FI'
,
'Sami (Northern) - Finland'
),
(
'se-NO'
,
'Sami (Northern) - Norway'
),
(
'se-SE'
,
'Sami (Northern) - Sweden'
),
(
'sms'
,
'Sami (Skolt)'
),
(
'sms-FI'
,
'Sami (Skolt) - Finland'
),
(
'sma'
,
'Sami (Southern)'
),
(
'sma-NO'
,
'Sami (Southern) - Norway'
),
(
'sma-SE'
,
'Sami (Southern) - Sweden'
),
(
'sg'
,
'Sango'
),
(
'sg-CF'
,
'Sango - Central African Republic'
),
(
'sbp'
,
'Sangu'
),
(
'sbp-TZ'
,
'Sangu - Tanzania'
),
(
'sa'
,
'Sanskrit'
),
(
'sa-IN'
,
'Sanskrit - India'
),
(
'gd'
,
'Scottish Gaelic'
),
(
'gd-GB'
,
'Scottish Gaelic - United Kingdom'
),
(
'seh'
,
'Sena'
),
(
'seh-MZ'
,
'Sena - Mozambique'
),
(
'sr-Cyrl'
,
'Serbian (Cyrillic)'
),
(
'sr-Cyrl-BA'
,
'Serbian (Cyrillic) - Bosnia and Herzegovina'
),
(
'sr-Cyrl-ME'
,
'Serbian (Cyrillic) - Montenegro'
),
(
'sr-Cyrl-RS'
,
'Serbian (Cyrillic) - Serbia'
),
(
'sr-Cyrl-CS'
,
'Serbian (Cyrillic) - Serbia and Montenegro (Former)'
),
(
'sr'
,
'Serbian (Latin)'
),
(
'sr-Latn'
,
'Serbian (Latin), Latn'
),
(
'sr-Latn-BA'
,
'Serbian (Latin) - Bosnia and Herzegovina'
),
(
'sr-Latn-ME'
,
'Serbian (Latin) - Montenegro'
),
(
'sr-Latn-RS'
,
'Serbian (Latin) - Serbia'
),
(
'sr-Latn-CS'
,
'Serbian (Latin) - Serbia and Montenegro (Former)'
),
(
'nso'
,
'Sesotho sa Leboa'
),
(
'nso-ZA'
,
'Sesotho sa Leboa - South Africa'
),
(
'tn'
,
'Setswana'
),
(
'tn-BW'
,
'Setswana - Botswana'
),
(
'tn-ZA'
,
'Setswana - South Africa'
),
(
'ksb'
,
'Shambala'
),
(
'ksb-TZ'
,
'Shambala - Tanzania'
),
(
'sn'
,
'Shona'
),
(
'sn-Latn'
,
'Shona - Latin'
),
(
'sn-Latn-ZW'
,
'Shona - Zimbabwe'
),
(
'sd'
,
'Sindhi'
),
(
'sd-Arab'
,
'Sindhi, Arab'
),
(
'sd-Arab-PK'
,
'Sindhi - Islamic Republic of Pakistan'
),
(
'si'
,
'Sinhala'
),
(
'si-LK'
,
'Sinhala - Sri Lanka'
),
(
'sk'
,
'Slovak'
),
(
'sk-SK'
,
'Slovak - Slovakia'
),
(
'sl'
,
'Slovenian'
),
(
'sl-SI'
,
'Slovenian - Slovenia'
),
(
'xog'
,
'Soga'
),
(
'xog-UG'
,
'Soga - Uganda'
),
(
'so'
,
'Somali'
),
(
'so-DJ'
,
'Somali - Djibouti'
),
(
'so-ET'
,
'Somali - Ethiopia'
),
(
'so-KE'
,
'Somali - Kenya'
),
(
'so-SO'
,
'Somali - Somalia'
),
(
'st'
,
'Sotho'
),
(
'st-ZA'
,
'Sotho - South Africa'
),
(
'nr'
,
'South Ndebele'
),
(
'nr-ZA'
,
'South Ndebele - South Africa'
),
(
'st-LS'
,
'Southern Sotho - Lesotho'
),
(
'es'
,
'Spanish'
),
(
'es-AR'
,
'Spanish - Argentina'
),
(
'es-BZ'
,
'Spanish - Belize'
),
(
'es-VE'
,
'Spanish - Bolivarian Republic of Venezuela'
),
(
'es-BO'
,
'Spanish - Bolivia'
),
(
'es-BR'
,
'Spanish - Brazil'
),
(
'es-CL'
,
'Spanish - Chile'
),
(
'es-CO'
,
'Spanish - Colombia'
),
(
'es-CR'
,
'Spanish - Costa Rica'
),
(
'es-CU'
,
'Spanish - Cuba'
),
(
'es-DO'
,
'Spanish - Dominican Republic'
),
(
'es-EC'
,
'Spanish - Ecuador'
),
(
'es-SV'
,
'Spanish - El Salvador'
),
(
'es-GQ'
,
'Spanish - Equatorial Guinea'
),
(
'es-GT'
,
'Spanish - Guatemala'
),
(
'es-HN'
,
'Spanish - Honduras'
),
(
'es-419'
,
'Spanish - Latin America'
),
(
'es-MX'
,
'Spanish - Mexico'
),
(
'es-NI'
,
'Spanish - Nicaragua'
),
(
'es-PA'
,
'Spanish - Panama'
),
(
'es-PY'
,
'Spanish - Paraguay'
),
(
'es-PE'
,
'Spanish - Peru'
),
(
'es-PH'
,
'Spanish - Philippines'
),
(
'es-PR'
,
'Spanish - Puerto Rico'
),
(
'es-ES'
,
'Spanish - Spain'
),
(
'es-ES_tradnl'
,
'Spanish - Spain, ES_tradnl'
),
(
'es-US'
,
'Spanish - United - States'
),
(
'es-UY'
,
'Spanish - Uruguay'
),
(
'zgh'
,
'Standard Moroccan Tamazight'
),
(
'zgh-Tfng-MA'
,
'Standard Moroccan Tamazight - Morocco'
),
(
'zgh-Tfng'
,
'Standard Moroccan Tamazight - Tifinagh'
),
(
'ss'
,
'Swati'
),
(
'ss-ZA'
,
'Swati - South Africa'
),
(
'ss-SZ'
,
'Swati - Swaziland'
),
(
'sv'
,
'Swedish'
),
(
'sv-AX'
,
'Swedish - Åland Islands'
),
(
'sv-FI'
,
'Swedish - Finland'
),
(
'sv-SE'
,
'Swedish - Sweden'
),
(
'syr'
,
'Syriac'
),
(
'syr-SY'
,
'Syriac - Syria'
),
(
'shi'
,
'Tachelhit'
),
(
'shi-Tfng'
,
'Tachelhit - Tifinagh'
),
(
'shi-Tfng-MA'
,
'Tachelhit - Tifinagh, Morocco'
),
(
'shi-Latn'
,
'Tachelhit (Latin)'
),
(
'shi-Latn-MA'
,
'Tachelhit (Latin) - Morocco'
),
(
'dav'
,
'Taita'
),
(
'dav-KE'
,
'Taita - Kenya'
),
(
'tg'
,
'Tajik (Cyrillic)'
),
(
'tg-Cyrl'
,
'Tajik (Cyrillic), Cyrl'
),
(
'tg-Cyrl-TJ'
,
'Tajik (Cyrillic) - Tajikistan'
),
(
'tzm'
,
'Tamazight (Latin)'
),
(
'tzm-Latn'
,
'Tamazight (Latin), Latn'
),
(
'tzm-Latn-DZ'
,
'Tamazight (Latin) - Algeria'
),
(
'ta'
,
'Tamil'
),
(
'ta-IN'
,
'Tamil - India'
),
(
'ta-MY'
,
'Tamil - Malaysia'
),
(
'ta-SG'
,
'Tamil - Singapore'
),
(
'ta-LK'
,
'Tamil - Sri Lanka'
),
(
'twq'
,
'Tasawaq'
),
(
'twq-NE'
,
'Tasawaq - Niger'
),
(
'tt'
,
'Tatar'
),
(
'tt-RU'
,
'Tatar - Russia'
),
(
'te'
,
'Telugu'
),
(
'te-IN'
,
'Telugu - India'
),
(
'teo'
,
'Teso'
),
(
'teo-KE'
,
'Teso - Kenya'
),
(
'teo-UG'
,
'Teso - Uganda'
),
(
'th'
,
'Thai'
),
(
'th-TH'
,
'Thai - Thailand'
),
(
'bo'
,
'Tibetan'
),
(
'bo-IN'
,
'Tibetan - India'
),
(
'bo-CN'
,
"Tibetan - People's Republic of China"
),
(
'tig'
,
'Tigre'
),
(
'tig-ER'
,
'Tigre - Eritrea'
),
(
'ti'
,
'Tigrinya'
),
(
'ti-ER'
,
'Tigrinya - Eritrea'
),
(
'ti-ET'
,
'Tigrinya - Ethiopia'
),
(
'to'
,
'Tongan'
),
(
'to-TO'
,
'Tongan - Tonga'
),
(
'ts'
,
'Tsonga'
),
(
'ts-ZA'
,
'Tsonga - South Africa'
),
(
'tr'
,
'Turkish'
),
(
'tr-CY'
,
'Turkish - Cyprus'
),
(
'tr-TR'
,
'Turkish - Turkey'
),
(
'tk'
,
'Turkmen'
),
(
'tk-TM'
,
'Turkmen - Turkmenistan'
),
(
'uk'
,
'Ukrainian'
),
(
'uk-UA'
,
'Ukrainian - Ukraine'
),
(
'hsb'
,
'Upper Sorbian'
),
(
'hsb-DE'
,
'Upper Sorbian - Germany'
),
(
'ur'
,
'Urdu'
),
(
'ur-IN'
,
'Urdu - India'
),
(
'ur-PK'
,
'Urdu - Islamic Republic of Pakistan'
),
(
'ug'
,
'Uyghur'
),
(
'ug-CN'
,
"Uyghur - People's Republic of China"
),
(
'uz-Arab'
,
'Uzbek - Perso-Arabic'
),
(
'uz-Arab-AF'
,
'Uzbek - Perso-Arabic, Afghanistan'
),
(
'uz-Cyrl'
,
'Uzbek (Cyrillic)'
),
(
'uz-Cyrl-UZ'
,
'Uzbek (Cyrillic) - Uzbekistan'
),
(
'uz'
,
'Uzbek (Latin)'
),
(
'uz-Latn'
,
'Uzbek (Latin), Latn'
),
(
'uz-Latn-UZ'
,
'Uzbek (Latin) - Uzbekistan'
),
(
'vai'
,
'Vai'
),
(
'vai-Vaii'
,
'Vai, Vaii'
),
(
'vai-Vaii-LR'
,
'Vai - Liberia'
),
(
'vai-Latn-LR'
,
'Vai (Latin) - Liberia'
),
(
'vai-Latn'
,
'Vai (Latin)'
),
(
'ca-ES-valencia'
,
'Valencian - Spain'
),
(
've'
,
'Venda'
),
(
've-ZA'
,
'Venda - South Africa'
),
(
'vi'
,
'Vietnamese'
),
(
'vi-VN'
,
'Vietnamese - Vietnam'
),
(
'vo'
,
'Volapük'
),
(
'vo-001'
,
'Volapük - World'
),
(
'vun'
,
'Vunjo'
),
(
'vun-TZ'
,
'Vunjo - Tanzania'
),
(
'wae'
,
'Walser'
),
(
'wae-CH'
,
'Walser - Switzerland'
),
(
'cy'
,
'Welsh'
),
(
'cy-GB'
,
'Welsh - United Kingdom'
),
(
'wal'
,
'Wolaytta'
),
(
'wal-ET'
,
'Wolaytta - Ethiopia'
),
(
'wo'
,
'Wolof'
),
(
'wo-SN'
,
'Wolof - Senegal'
),
(
'xh'
,
'Xhosa'
),
(
'xh-ZA'
,
'Xhosa - South Africa'
),
(
'yav'
,
'Yangben'
),
(
'yav-CM'
,
'Yangben - Cameroon'
),
(
'ii'
,
'Yi'
),
(
'ii-CN'
,
"Yi - People's Republic of China"
),
(
'yo'
,
'Yoruba'
),
(
'yo-BJ'
,
'Yoruba - Benin'
),
(
'yo-NG'
,
'Yoruba - Nigeria'
),
(
'dje'
,
'Zarma'
),
(
'dje-NE'
,
'Zarma - Niger'
),
(
'zu'
,
'Zulu'
),
(
'zu-ZA'
,
'Zulu - South Africa'
)],
default
=
'en'
,
help_text
=
'Required if type is "Subtitle"'
,
max_length
=
50
,
verbose_name
=
'Language'
),
),
]
tests/test_admin_views.py
View file @
f4da2207
...
@@ -19,29 +19,29 @@ class TestVideoIndexView(WagtailTestUtils, TestCase):
...
@@ -19,29 +19,29 @@ class TestVideoIndexView(WagtailTestUtils, TestCase):
self
.
login
()
self
.
login
()
def
get
(
self
,
params
=
{}):
def
get
(
self
,
params
=
{}):
return
self
.
client
.
get
(
reverse
(
'
wagtailvideos:index
'
),
params
)
return
self
.
client
.
get
(
reverse
(
"
wagtailvideos:index
"
),
params
)
def
test_simple
(
self
):
def
test_simple
(
self
):
response
=
self
.
get
()
response
=
self
.
get
()
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertTemplateUsed
(
response
,
'
wagtailvideos/videos/index.html
'
)
self
.
assertTemplateUsed
(
response
,
"
wagtailvideos/videos/index.html
"
)
self
.
assertContains
(
response
,
"Add a video"
)
self
.
assertContains
(
response
,
"Add a video"
)
def
test_search
(
self
):
def
test_search
(
self
):
response
=
self
.
get
({
'q'
:
"Hello"
})
response
=
self
.
get
({
"q"
:
"Hello"
})
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
context
[
'
query_string
'
],
"Hello"
)
self
.
assertEqual
(
response
.
context
[
"
query_string
"
],
"Hello"
)
def
test_pagination
(
self
):
def
test_pagination
(
self
):
pages
=
[
'0'
,
'1'
,
'
-1
'
,
'
9999
'
,
'
Not a page
'
]
pages
=
[
"0"
,
"1"
,
"
-1
"
,
"
9999
"
,
"
Not a page
"
]
for
page
in
pages
:
for
page
in
pages
:
response
=
self
.
get
({
'p'
:
page
})
response
=
self
.
get
({
"p"
:
page
})
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
def
test_ordering
(
self
):
def
test_ordering
(
self
):
orderings
=
[
'
title
'
,
'
-created_at
'
]
orderings
=
[
"
title
"
,
"
-created_at
"
]
for
ordering
in
orderings
:
for
ordering
in
orderings
:
response
=
self
.
get
({
'
ordering
'
:
ordering
})
response
=
self
.
get
({
"
ordering
"
:
ordering
})
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
...
@@ -50,19 +50,22 @@ class TestVideoAddView(TestCase, WagtailTestUtils):
...
@@ -50,19 +50,22 @@ class TestVideoAddView(TestCase, WagtailTestUtils):
self
.
login
()
self
.
login
()
def
get
(
self
,
params
=
{}):
def
get
(
self
,
params
=
{}):
return
self
.
client
.
get
(
reverse
(
'
wagtailvideos:add
'
),
params
)
return
self
.
client
.
get
(
reverse
(
"
wagtailvideos:add
"
),
params
)
def
post
(
self
,
post_data
=
{}):
def
post
(
self
,
post_data
=
{}):
return
self
.
client
.
post
(
reverse
(
'
wagtailvideos:add
'
),
post_data
)
return
self
.
client
.
post
(
reverse
(
"
wagtailvideos:add
"
),
post_data
)
def
test_get
(
self
):
def
test_get
(
self
):
response
=
self
.
get
()
response
=
self
.
get
()
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertTemplateUsed
(
response
,
'
wagtailvideos/videos/add.html
'
)
self
.
assertTemplateUsed
(
response
,
"
wagtailvideos/videos/add.html
"
)
# as standard, only the root collection exists and so no 'Collection' option
# as standard, only the root collection exists and so no 'Collection' option
# is displayed on the form
# is displayed on the form
self
.
assertNotContains
(
response
,
'<label class="w-field__label" for="id_collection" id="id_collection-label">'
)
self
.
assertNotContains
(
response
,
'<label class="w-field__label" for="id_collection" id="id_collection-label">'
,
)
# Ensure the form supports file uploads
# Ensure the form supports file uploads
self
.
assertContains
(
response
,
'enctype="multipart/form-data"'
)
self
.
assertContains
(
response
,
'enctype="multipart/form-data"'
)
...
@@ -74,21 +77,26 @@ class TestVideoAddView(TestCase, WagtailTestUtils):
...
@@ -74,21 +77,26 @@ class TestVideoAddView(TestCase, WagtailTestUtils):
response
=
self
.
get
()
response
=
self
.
get
()
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertTemplateUsed
(
response
,
'
wagtailvideos/videos/add.html
'
)
self
.
assertTemplateUsed
(
response
,
"
wagtailvideos/videos/add.html
"
)
self
.
assertContains
(
response
,
'<label class="w-field__label" for="id_collection" id="id_collection-label">'
)
self
.
assertContains
(
response
,
'<label class="w-field__label" for="id_collection" id="id_collection-label">'
,
)
self
.
assertContains
(
response
,
collection_name
)
self
.
assertContains
(
response
,
collection_name
)
def
test_add
(
self
):
def
test_add
(
self
):
video_file
=
create_test_video_file
()
video_file
=
create_test_video_file
()
title
=
"Test Video"
title
=
"Test Video"
response
=
self
.
post
({
response
=
self
.
post
(
'title'
:
title
,
{
'file'
:
SimpleUploadedFile
(
'small.mp4'
,
video_file
.
read
(),
"video/mp4"
),
"title"
:
title
,
})
"file"
:
SimpleUploadedFile
(
"small.mp4"
,
video_file
.
read
(),
"video/mp4"
),
}
)
# Should redirect back to index
# Should redirect back to index
self
.
assertRedirects
(
response
,
reverse
(
'
wagtailvideos:index
'
))
self
.
assertRedirects
(
response
,
reverse
(
"
wagtailvideos:index
"
))
# Check that the video was created
# Check that the video was created
videos
=
Video
.
objects
.
filter
(
title
=
title
)
videos
=
Video
.
objects
.
filter
(
title
=
title
)
...
@@ -104,20 +112,22 @@ class TestVideoAddView(TestCase, WagtailTestUtils):
...
@@ -104,20 +112,22 @@ class TestVideoAddView(TestCase, WagtailTestUtils):
root_collection
=
Collection
.
get_first_root_node
()
root_collection
=
Collection
.
get_first_root_node
()
self
.
assertEqual
(
video
.
collection
,
root_collection
)
self
.
assertEqual
(
video
.
collection
,
root_collection
)
@
patch
(
'
wagtailvideos.ffmpeg.installed
'
)
@
patch
(
"
wagtailvideos.ffmpeg.installed
"
)
def
test_add_no_ffmpeg
(
self
,
ffmpeg_installed
):
def
test_add_no_ffmpeg
(
self
,
ffmpeg_installed
):
ffmpeg_installed
.
return_value
=
False
ffmpeg_installed
.
return_value
=
False
video_file
=
create_test_video_file
()
video_file
=
create_test_video_file
()
title
=
'
no_ffmpeg
'
title
=
"
no_ffmpeg
"
response
=
self
.
post
({
response
=
self
.
post
(
'title'
:
title
,
{
'file'
:
SimpleUploadedFile
(
'small.mp4'
,
video_file
.
read
(),
"video/mp4"
),
"title"
:
title
,
})
"file"
:
SimpleUploadedFile
(
"small.mp4"
,
video_file
.
read
(),
"video/mp4"
),
}
)
# Should redirect back to index
# Should redirect back to index
self
.
assertRedirects
(
response
,
reverse
(
'
wagtailvideos:index
'
))
self
.
assertRedirects
(
response
,
reverse
(
"
wagtailvideos:index
"
))
# Check video exists but has no thumb or duration
# Check video exists but has no thumb or duration
videos
=
Video
.
objects
.
filter
(
title
=
title
)
videos
=
Video
.
objects
.
filter
(
title
=
title
)
...
@@ -128,66 +138,79 @@ class TestVideoAddView(TestCase, WagtailTestUtils):
...
@@ -128,66 +138,79 @@ class TestVideoAddView(TestCase, WagtailTestUtils):
self
.
assertFalse
(
video
.
duration
)
self
.
assertFalse
(
video
.
duration
)
def
test_add_no_file_selected
(
self
):
def
test_add_no_file_selected
(
self
):
response
=
self
.
post
({
response
=
self
.
post
(
'title'
:
"nothing here"
,
{
})
"title"
:
"nothing here"
,
}
)
# Shouldn't redirect anywhere
# Shouldn't redirect anywhere
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertTemplateUsed
(
response
,
'
wagtailvideos/videos/add.html
'
)
self
.
assertTemplateUsed
(
response
,
"
wagtailvideos/videos/add.html
"
)
# The form should have an error
# The form should have an error
self
.
assertFormError
(
response
,
'form'
,
'file'
,
"This field is required."
)
self
.
assertFormError
(
response
.
context
[
"form"
],
"file"
,
"This field is required."
)
@
override_settings
(
WAGTAILVIDEOS_MAX_UPLOAD_SIZE
=
1
)
@
override_settings
(
WAGTAILVIDEOS_MAX_UPLOAD_SIZE
=
1
)
def
test_add_too_large_file
(
self
):
def
test_add_too_large_file
(
self
):
video_file
=
create_test_video_file
()
video_file
=
create_test_video_file
()
response
=
self
.
post
({
response
=
self
.
post
(
'title'
:
"Test video"
,
{
'file'
:
SimpleUploadedFile
(
'small.mp4'
,
video_file
.
read
(),
"video/mp4"
),
"title"
:
"Test video"
,
})
"file"
:
SimpleUploadedFile
(
"small.mp4"
,
video_file
.
read
(),
"video/mp4"
),
}
)
# Shouldn't redirect anywhere
# Shouldn't redirect anywhere
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertTemplateUsed
(
response
,
'
wagtailvideos/videos/add.html
'
)
self
.
assertTemplateUsed
(
response
,
"
wagtailvideos/videos/add.html
"
)
# The form should have an error
# The form should have an error
self
.
assertFormError
(
self
.
assertFormError
(
response
,
'form'
,
'file'
,
response
.
context
[
"form"
],
"file"
,
"This file is too big ({file_size}). Maximum filesize {max_file_size}."
.
format
(
"This file is too big ({file_size}). Maximum filesize {max_file_size}."
.
format
(
file_size
=
filesizeformat
(
video_file
.
size
),
file_size
=
filesizeformat
(
video_file
.
size
),
max_file_size
=
filesizeformat
(
1
),
max_file_size
=
filesizeformat
(
1
),
)
)
,
)
)
def
test_add_too_long_filename
(
self
):
def
test_add_too_long_filename
(
self
):
video_file
=
create_test_video_file
()
video_file
=
create_test_video_file
()
name
=
'a_very_long_filename_'
+
(
'x'
*
100
)
+
'.mp4'
name
=
"a_very_long_filename_"
+
(
"x"
*
100
)
+
".mp4"
response
=
self
.
post
({
response
=
self
.
post
(
'title'
:
"Test video"
,
{
'file'
:
SimpleUploadedFile
(
name
,
video_file
.
read
(),
"video/mp4"
),
"title"
:
"Test video"
,
})
"file"
:
SimpleUploadedFile
(
name
,
video_file
.
read
(),
"video/mp4"
),
}
)
# Should be valid
# Should be valid
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
response
.
status_code
,
302
)
video
=
Video
.
objects
.
get
()
video
=
Video
.
objects
.
get
()
self
.
assertEqual
(
len
(
video
.
file
.
name
),
Video
.
_meta
.
get_field
(
'
file
'
).
max_length
)
self
.
assertEqual
(
len
(
video
.
file
.
name
),
Video
.
_meta
.
get_field
(
"
file
"
).
max_length
)
def
test_add_with_collections
(
self
):
def
test_add_with_collections
(
self
):
root_collection
=
Collection
.
get_first_root_node
()
root_collection
=
Collection
.
get_first_root_node
()
evil_plans_collection
=
root_collection
.
add_child
(
name
=
"Evil plans"
)
evil_plans_collection
=
root_collection
.
add_child
(
name
=
"Evil plans"
)
response
=
self
.
post
({
response
=
self
.
post
(
'title'
:
"Test video"
,
{
'file'
:
SimpleUploadedFile
(
'small.mp4'
,
create_test_video_file
().
read
(),
"video/mp4"
),
"title"
:
"Test video"
,
'collection'
:
evil_plans_collection
.
id
,
"file"
:
SimpleUploadedFile
(
})
"small.mp4"
,
create_test_video_file
().
read
(),
"video/mp4"
),
"collection"
:
evil_plans_collection
.
id
,
}
)
# Should redirect back to index
# Should redirect back to index
self
.
assertRedirects
(
response
,
reverse
(
'
wagtailvideos:index
'
))
self
.
assertRedirects
(
response
,
reverse
(
"
wagtailvideos:index
"
))
# Check that the video was created
# Check that the video was created
videos
=
Video
.
objects
.
filter
(
title
=
"Test video"
)
videos
=
Video
.
objects
.
filter
(
title
=
"Test video"
)
...
@@ -208,15 +231,19 @@ class TestVideoEditView(TestCase, WagtailTestUtils):
...
@@ -208,15 +231,19 @@ class TestVideoEditView(TestCase, WagtailTestUtils):
)
)
def
get
(
self
,
params
=
{}):
def
get
(
self
,
params
=
{}):
return
self
.
client
.
get
(
reverse
(
'wagtailvideos:edit'
,
args
=
(
self
.
video
.
id
,)),
params
)
return
self
.
client
.
get
(
reverse
(
"wagtailvideos:edit"
,
args
=
(
self
.
video
.
id
,)),
params
)
def
post
(
self
,
post_data
=
{}):
def
post
(
self
,
post_data
=
{}):
return
self
.
client
.
post
(
reverse
(
'wagtailvideos:edit'
,
args
=
(
self
.
video
.
id
,)),
post_data
)
return
self
.
client
.
post
(
reverse
(
"wagtailvideos:edit"
,
args
=
(
self
.
video
.
id
,)),
post_data
)
def
test_simple
(
self
):
def
test_simple
(
self
):
response
=
self
.
get
()
response
=
self
.
get
()
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertTemplateUsed
(
response
,
'
wagtailvideos/videos/edit.html
'
)
self
.
assertTemplateUsed
(
response
,
"
wagtailvideos/videos/edit.html
"
)
# Ensure the form supports file uploads
# Ensure the form supports file uploads
self
.
assertContains
(
response
,
'enctype="multipart/form-data"'
)
self
.
assertContains
(
response
,
'enctype="multipart/form-data"'
)
...
@@ -224,15 +251,17 @@ class TestVideoEditView(TestCase, WagtailTestUtils):
...
@@ -224,15 +251,17 @@ class TestVideoEditView(TestCase, WagtailTestUtils):
def
test_usage_count
(
self
):
def
test_usage_count
(
self
):
response
=
self
.
get
()
response
=
self
.
get
()
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertTemplateUsed
(
response
,
'
wagtailvideos/videos/edit.html
'
)
self
.
assertTemplateUsed
(
response
,
"
wagtailvideos/videos/edit.html
"
)
self
.
assertContains
(
response
,
"Used 0 times"
)
self
.
assertContains
(
response
,
"Used 0 times"
)
expected_url
=
'
/admin/videos/usage/%d/
'
%
self
.
video
.
id
expected_url
=
"
/admin/videos/usage/%d/
"
%
self
.
video
.
id
self
.
assertContains
(
response
,
expected_url
)
self
.
assertContains
(
response
,
expected_url
)
def
test_edit
(
self
):
def
test_edit
(
self
):
self
.
post
({
self
.
post
(
'title'
:
"Edited"
,
{
})
"title"
:
"Edited"
,
}
)
# Check that the video was edited
# Check that the video was edited
video
=
Video
.
objects
.
get
(
id
=
self
.
video
.
id
)
video
=
Video
.
objects
.
get
(
id
=
self
.
video
.
id
)
...
@@ -245,10 +274,12 @@ class TestVideoEditView(TestCase, WagtailTestUtils):
...
@@ -245,10 +274,12 @@ class TestVideoEditView(TestCase, WagtailTestUtils):
self
.
video
.
save
()
self
.
video
.
save
()
new_file
=
create_test_video_file
()
new_file
=
create_test_video_file
()
self
.
post
({
self
.
post
(
'title'
:
"Edited"
,
{
'file'
:
SimpleUploadedFile
(
'new.mp4'
,
new_file
.
read
(),
"video/mp4"
),
"title"
:
"Edited"
,
})
"file"
:
SimpleUploadedFile
(
"new.mp4"
,
new_file
.
read
(),
"video/mp4"
),
}
)
# Check that the video file size changed (assume it changed to the correct value)
# Check that the video file size changed (assume it changed to the correct value)
video
=
Video
.
objects
.
get
(
id
=
self
.
video
.
id
)
video
=
Video
.
objects
.
get
(
id
=
self
.
video
.
id
)
...
@@ -259,8 +290,8 @@ class TestVideoEditView(TestCase, WagtailTestUtils):
...
@@ -259,8 +290,8 @@ class TestVideoEditView(TestCase, WagtailTestUtils):
response
=
self
.
get
()
response
=
self
.
get
()
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertTemplateUsed
(
response
,
'
wagtailvideos/videos/edit.html
'
)
self
.
assertTemplateUsed
(
response
,
"
wagtailvideos/videos/edit.html
"
)
self
.
assertContains
(
response
,
'
The source video file could not be found
'
)
self
.
assertContains
(
response
,
"
The source video file could not be found
"
)
class
TestVideoDeleteView
(
TestCase
,
WagtailTestUtils
):
class
TestVideoDeleteView
(
TestCase
,
WagtailTestUtils
):
...
@@ -274,22 +305,26 @@ class TestVideoDeleteView(TestCase, WagtailTestUtils):
...
@@ -274,22 +305,26 @@ class TestVideoDeleteView(TestCase, WagtailTestUtils):
)
)
def
get
(
self
,
params
=
{}):
def
get
(
self
,
params
=
{}):
return
self
.
client
.
get
(
reverse
(
'wagtailvideos:delete'
,
args
=
(
self
.
video
.
id
,)),
params
)
return
self
.
client
.
get
(
reverse
(
"wagtailvideos:delete"
,
args
=
(
self
.
video
.
id
,)),
params
)
def
post
(
self
,
post_data
=
{}):
def
post
(
self
,
post_data
=
{}):
return
self
.
client
.
post
(
reverse
(
'wagtailvideos:delete'
,
args
=
(
self
.
video
.
id
,)),
post_data
)
return
self
.
client
.
post
(
reverse
(
"wagtailvideos:delete"
,
args
=
(
self
.
video
.
id
,)),
post_data
)
def
test_simple
(
self
):
def
test_simple
(
self
):
response
=
self
.
get
()
response
=
self
.
get
()
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertTemplateUsed
(
response
,
'
wagtailvideos/videos/confirm_delete.html
'
)
self
.
assertTemplateUsed
(
response
,
"
wagtailvideos/videos/confirm_delete.html
"
)
def
test_delete
(
self
):
def
test_delete
(
self
):
# FIXME HACK Not sure why the test fails when no data is posted
# FIXME HACK Not sure why the test fails when no data is posted
response
=
self
.
post
({
'
data
'
:
'
data
'
})
response
=
self
.
post
({
"
data
"
:
"
data
"
})
# Should redirect back to index
# Should redirect back to index
self
.
assertRedirects
(
response
,
reverse
(
'
wagtailvideos:index
'
))
self
.
assertRedirects
(
response
,
reverse
(
"
wagtailvideos:index
"
))
# Check that the video was deleted
# Check that the video was deleted
videos
=
Video
.
objects
.
filter
(
title
=
"Test video"
)
videos
=
Video
.
objects
.
filter
(
title
=
"Test video"
)
...
@@ -301,24 +336,26 @@ class TestVideoChooserView(TestCase, WagtailTestUtils):
...
@@ -301,24 +336,26 @@ class TestVideoChooserView(TestCase, WagtailTestUtils):
self
.
login
()
self
.
login
()
def
get
(
self
,
params
=
{}):
def
get
(
self
,
params
=
{}):
return
self
.
client
.
get
(
reverse
(
'
wagtailvideos_chooser:choose
'
),
params
)
return
self
.
client
.
get
(
reverse
(
"
wagtailvideos_chooser:choose
"
),
params
)
def
test_simple
(
self
):
def
test_simple
(
self
):
response
=
self
.
get
()
response
=
self
.
get
()
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
response_json
=
json
.
loads
(
response
.
content
.
decode
())
response_json
=
json
.
loads
(
response
.
content
.
decode
())
self
.
assertEqual
(
response_json
[
'
step
'
],
'
choose
'
)
self
.
assertEqual
(
response_json
[
"
step
"
],
"
choose
"
)
def
test_search
(
self
):
def
test_search
(
self
):
response
=
self
.
get
({
'q'
:
"Hello"
})
response
=
self
.
get
({
"q"
:
"Hello"
})
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
context
[
'
search_query
'
],
"Hello"
)
self
.
assertEqual
(
response
.
context
[
"
search_query
"
],
"Hello"
)
def
test_pagination
(
self
):
def
test_pagination
(
self
):
pages
=
[
'0'
,
'1'
,
'-1'
,
'9999'
,
'Not a page'
]
# page numbers in range should be accepted
for
page
in
pages
:
response
=
self
.
get
({
"p"
:
1
})
response
=
self
.
get
({
'p'
:
page
})
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
# page numbers out of range should return 404
response
=
self
.
get
({
"p"
:
9999
})
self
.
assertEqual
(
response
.
status_code
,
404
)
def
test_filter_by_tag
(
self
):
def
test_filter_by_tag
(
self
):
for
i
in
range
(
0
,
10
):
for
i
in
range
(
0
,
10
):
...
@@ -327,9 +364,9 @@ class TestVideoChooserView(TestCase, WagtailTestUtils):
...
@@ -327,9 +364,9 @@ class TestVideoChooserView(TestCase, WagtailTestUtils):
file
=
create_test_video_file
(),
file
=
create_test_video_file
(),
)
)
if
i
%
2
==
0
:
if
i
%
2
==
0
:
video
.
tags
.
add
(
'
even
'
)
video
.
tags
.
add
(
"
even
"
)
response
=
self
.
get
({
'
tag
'
:
"even"
})
response
=
self
.
get
({
"
tag
"
:
"even"
})
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
# Results should include videos tagged 'even'
# Results should include videos tagged 'even'
...
@@ -350,13 +387,15 @@ class TestVideoChooserChosenView(TestCase, WagtailTestUtils):
...
@@ -350,13 +387,15 @@ class TestVideoChooserChosenView(TestCase, WagtailTestUtils):
)
)
def
get
(
self
,
params
=
{}):
def
get
(
self
,
params
=
{}):
return
self
.
client
.
get
(
reverse
(
'wagtailvideos_chooser:chosen'
,
args
=
(
self
.
video
.
id
,)),
params
)
return
self
.
client
.
get
(
reverse
(
"wagtailvideos_chooser:chosen"
,
args
=
(
self
.
video
.
id
,)),
params
)
def
test_simple
(
self
):
def
test_simple
(
self
):
response
=
self
.
get
()
response
=
self
.
get
()
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
response_json
=
json
.
loads
(
response
.
content
.
decode
())
response_json
=
json
.
loads
(
response
.
content
.
decode
())
self
.
assertEqual
(
response_json
[
'
step
'
],
'
chosen
'
)
self
.
assertEqual
(
response_json
[
"
step
"
],
"
chosen
"
)
class
TestVideoChooserUploadView
(
TestCase
,
WagtailTestUtils
):
class
TestVideoChooserUploadView
(
TestCase
,
WagtailTestUtils
):
...
@@ -364,7 +403,7 @@ class TestVideoChooserUploadView(TestCase, WagtailTestUtils):
...
@@ -364,7 +403,7 @@ class TestVideoChooserUploadView(TestCase, WagtailTestUtils):
self
.
login
()
self
.
login
()
def
get
(
self
,
params
=
{}):
def
get
(
self
,
params
=
{}):
return
self
.
client
.
get
(
reverse
(
'
wagtailvideos_chooser:create
'
),
params
)
return
self
.
client
.
get
(
reverse
(
"
wagtailvideos_chooser:create
"
),
params
)
def
test_simple
(
self
):
def
test_simple
(
self
):
response
=
self
.
get
()
response
=
self
.
get
()
...
@@ -376,10 +415,15 @@ class TestVideoChooserUploadView(TestCase, WagtailTestUtils):
...
@@ -376,10 +415,15 @@ class TestVideoChooserUploadView(TestCase, WagtailTestUtils):
self
.
assertEqual
(
response_json
[
"step"
],
"reshow_creation_form"
)
self
.
assertEqual
(
response_json
[
"step"
],
"reshow_creation_form"
)
def
test_upload
(
self
):
def
test_upload
(
self
):
response
=
self
.
client
.
post
(
reverse
(
'wagtailvideos_chooser:create'
),
{
response
=
self
.
client
.
post
(
'title'
:
"Test video"
,
reverse
(
"wagtailvideos_chooser:create"
),
'file'
:
SimpleUploadedFile
(
'small.mp4'
,
create_test_video_file
().
read
(),
"video/mp4"
),
{
})
"title"
:
"Test video"
,
"file"
:
SimpleUploadedFile
(
"small.mp4"
,
create_test_video_file
().
read
(),
"video/mp4"
),
},
)
# Check response
# Check response
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
...
@@ -389,25 +433,32 @@ class TestVideoChooserUploadView(TestCase, WagtailTestUtils):
...
@@ -389,25 +433,32 @@ class TestVideoChooserUploadView(TestCase, WagtailTestUtils):
self
.
assertEqual
(
videos
.
count
(),
1
)
self
.
assertEqual
(
videos
.
count
(),
1
)
def
test_upload_no_file_selected
(
self
):
def
test_upload_no_file_selected
(
self
):
response
=
self
.
client
.
post
(
reverse
(
'wagtailvideos_chooser:create'
),
{
response
=
self
.
client
.
post
(
'title'
:
"Test video"
,
reverse
(
"wagtailvideos_chooser:create"
),
})
{
"title"
:
"Test video"
,
},
)
# Shouldn't redirect anywhere
# Shouldn't redirect anywhere
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertTemplateUsed
(
response
,
'wagtailadmin/generic/chooser/creation_form.html'
)
self
.
assertTemplateUsed
(
response
,
"wagtailadmin/generic/chooser/creation_form.html"
)
# The form should have an error
# The form should have an error
self
.
assertFormError
(
response
,
'form'
,
'file'
,
"This field is required."
)
self
.
assertFormError
(
response
.
context
[
"form"
],
"file"
,
"This field is required."
)
class
TestVideoChooserUploadViewWithLimitedPermissions
(
TestCase
,
WagtailTestUtils
):
class
TestVideoChooserUploadViewWithLimitedPermissions
(
TestCase
,
WagtailTestUtils
):
def
setUp
(
self
):
def
setUp
(
self
):
add_video_permission
=
Permission
.
objects
.
get
(
add_video_permission
=
Permission
.
objects
.
get
(
content_type__app_label
=
'
wagtailvideos
'
,
codename
=
'
add_video
'
content_type__app_label
=
"
wagtailvideos
"
,
codename
=
"
add_video
"
)
)
admin_permission
=
Permission
.
objects
.
get
(
admin_permission
=
Permission
.
objects
.
get
(
content_type__app_label
=
'
wagtailadmin
'
,
codename
=
'
access_admin
'
content_type__app_label
=
"
wagtailadmin
"
,
codename
=
"
access_admin
"
)
)
root_collection
=
Collection
.
get_first_root_node
()
root_collection
=
Collection
.
get_first_root_node
()
...
@@ -418,20 +469,18 @@ class TestVideoChooserUploadViewWithLimitedPermissions(TestCase, WagtailTestUtil
...
@@ -418,20 +469,18 @@ class TestVideoChooserUploadViewWithLimitedPermissions(TestCase, WagtailTestUtil
GroupCollectionPermission
.
objects
.
create
(
GroupCollectionPermission
.
objects
.
create
(
group
=
conspirators_group
,
group
=
conspirators_group
,
collection
=
self
.
evil_plans_collection
,
collection
=
self
.
evil_plans_collection
,
permission
=
add_video_permission
permission
=
add_video_permission
,
)
)
user
=
get_user_model
().
objects
.
create_user
(
user
=
get_user_model
().
objects
.
create_user
(
username
=
'moriarty'
,
username
=
"moriarty"
,
email
=
"moriarty@example.com"
,
password
=
"password"
email
=
'moriarty@example.com'
,
password
=
'password'
)
)
user
.
groups
.
add
(
conspirators_group
)
user
.
groups
.
add
(
conspirators_group
)
self
.
client
.
login
(
username
=
'
moriarty
'
,
password
=
'
password
'
)
self
.
client
.
login
(
username
=
"
moriarty
"
,
password
=
"
password
"
)
def
test_get
(
self
):
def
test_get
(
self
):
response
=
self
.
client
.
get
(
reverse
(
'
wagtailvideos_chooser:create
'
))
response
=
self
.
client
.
get
(
reverse
(
"
wagtailvideos_chooser:create
"
))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertTemplateUsed
(
self
.
assertTemplateUsed
(
response
,
"wagtailadmin/generic/chooser/creation_form.html"
response
,
"wagtailadmin/generic/chooser/creation_form.html"
...
@@ -445,9 +494,9 @@ class TestVideoChooserUploadViewWithLimitedPermissions(TestCase, WagtailTestUtil
...
@@ -445,9 +494,9 @@ class TestVideoChooserUploadViewWithLimitedPermissions(TestCase, WagtailTestUtil
)
)
def
test_get_chooser
(
self
):
def
test_get_chooser
(
self
):
response
=
self
.
client
.
get
(
reverse
(
'
wagtailvideos_chooser:choose
'
))
response
=
self
.
client
.
get
(
reverse
(
"
wagtailvideos_chooser:choose
"
))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertTemplateUsed
(
response
,
'
wagtailvideos/chooser/chooser.html
'
)
self
.
assertTemplateUsed
(
response
,
"
wagtailvideos/chooser/chooser.html
"
)
# user only has access to one collection, so no 'Collection' option
# user only has access to one collection, so no 'Collection' option
# is displayed on the form
# is displayed on the form
...
@@ -476,47 +525,53 @@ class TestMultipleVideoUploader(TestCase, WagtailTestUtils):
...
@@ -476,47 +525,53 @@ class TestMultipleVideoUploader(TestCase, WagtailTestUtils):
This tests that the add view responds correctly on a GET request
This tests that the add view responds correctly on a GET request
"""
"""
# Send request
# Send request
response
=
self
.
client
.
get
(
reverse
(
'
wagtailvideos:add_multiple
'
))
response
=
self
.
client
.
get
(
reverse
(
"
wagtailvideos:add_multiple
"
))
# Check response
# Check response
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertTemplateUsed
(
response
,
'
wagtailvideos/multiple/add.html
'
)
self
.
assertTemplateUsed
(
response
,
"
wagtailvideos/multiple/add.html
"
)
def
test_add_post
(
self
):
def
test_add_post
(
self
):
"""
"""
This tests that a POST request to the add view saves the video and returns an edit form
This tests that a POST request to the add view saves the video and returns an edit form
"""
"""
response
=
self
.
client
.
post
(
reverse
(
'wagtailvideos:add_multiple'
),
{
response
=
self
.
client
.
post
(
'files[]'
:
SimpleUploadedFile
(
'small.mp4'
,
create_test_video_file
().
read
(),
"video/mp4"
),
reverse
(
"wagtailvideos:add_multiple"
),
},
HTTP_X_REQUESTED_WITH
=
'XMLHttpRequest'
)
{
"files[]"
:
SimpleUploadedFile
(
"small.mp4"
,
create_test_video_file
().
read
(),
"video/mp4"
),
},
HTTP_X_REQUESTED_WITH
=
"XMLHttpRequest"
,
)
# Check response
# Check response
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
[
'
Content-Type
'
],
'
application/json
'
)
self
.
assertEqual
(
response
[
"
Content-Type
"
],
"
application/json
"
)
self
.
assertTemplateUsed
(
response
,
'
wagtailvideos/multiple/edit_form.html
'
)
self
.
assertTemplateUsed
(
response
,
"
wagtailvideos/multiple/edit_form.html
"
)
# Check video
# Check video
self
.
assertIn
(
'
video
'
,
response
.
context
)
self
.
assertIn
(
"
video
"
,
response
.
context
)
self
.
assertEqual
(
response
.
context
[
'
video
'
].
title
,
'
small.mp4
'
)
self
.
assertEqual
(
response
.
context
[
"
video
"
].
title
,
"
small.mp4
"
)
self
.
assertTrue
(
response
.
context
[
'
video
'
].
file_size
)
self
.
assertTrue
(
response
.
context
[
"
video
"
].
file_size
)
# Check form
# Check form
self
.
assertIn
(
'
form
'
,
response
.
context
)
self
.
assertIn
(
"
form
"
,
response
.
context
)
self
.
assertEqual
(
response
.
context
[
'
form
'
].
initial
[
'
title
'
],
'
small.mp4
'
)
self
.
assertEqual
(
response
.
context
[
"
form
"
].
initial
[
"
title
"
],
"
small.mp4
"
)
# Check JSON
# Check JSON
response_json
=
json
.
loads
(
response
.
content
.
decode
())
response_json
=
json
.
loads
(
response
.
content
.
decode
())
self
.
assertIn
(
'
video_id
'
,
response_json
)
self
.
assertIn
(
"
video_id
"
,
response_json
)
self
.
assertIn
(
'
form
'
,
response_json
)
self
.
assertIn
(
"
form
"
,
response_json
)
self
.
assertIn
(
'
success
'
,
response_json
)
self
.
assertIn
(
"
success
"
,
response_json
)
self
.
assertEqual
(
response_json
[
'
video_id
'
],
response
.
context
[
'
video
'
].
id
)
self
.
assertEqual
(
response_json
[
"
video_id
"
],
response
.
context
[
"
video
"
].
id
)
self
.
assertTrue
(
response_json
[
'
success
'
])
self
.
assertTrue
(
response_json
[
"
success
"
])
def
test_add_post_noajax
(
self
):
def
test_add_post_noajax
(
self
):
"""
"""
This tests that only AJAX requests are allowed to POST to the add view
This tests that only AJAX requests are allowed to POST to the add view
"""
"""
response
=
self
.
client
.
post
(
reverse
(
'
wagtailvideos:add_multiple
'
),
{})
response
=
self
.
client
.
post
(
reverse
(
"
wagtailvideos:add_multiple
"
),
{})
# Check response
# Check response
self
.
assertEqual
(
response
.
status_code
,
400
)
self
.
assertEqual
(
response
.
status_code
,
400
)
...
@@ -525,7 +580,11 @@ class TestMultipleVideoUploader(TestCase, WagtailTestUtils):
...
@@ -525,7 +580,11 @@ class TestMultipleVideoUploader(TestCase, WagtailTestUtils):
"""
"""
This tests that the add view checks for a file when a user POSTs to it
This tests that the add view checks for a file when a user POSTs to it
"""
"""
response
=
self
.
client
.
post
(
reverse
(
'wagtailvideos:add_multiple'
),
{},
HTTP_X_REQUESTED_WITH
=
'XMLHttpRequest'
)
response
=
self
.
client
.
post
(
reverse
(
"wagtailvideos:add_multiple"
),
{},
HTTP_X_REQUESTED_WITH
=
"XMLHttpRequest"
,
)
# Check response
# Check response
self
.
assertEqual
(
response
.
status_code
,
400
)
self
.
assertEqual
(
response
.
status_code
,
400
)
...
@@ -534,29 +593,35 @@ class TestMultipleVideoUploader(TestCase, WagtailTestUtils):
...
@@ -534,29 +593,35 @@ class TestMultipleVideoUploader(TestCase, WagtailTestUtils):
"""
"""
This tests that the add view checks for a file when a user POSTs to it
This tests that the add view checks for a file when a user POSTs to it
"""
"""
response
=
self
.
client
.
post
(
reverse
(
'wagtailvideos:add_multiple'
),
{
response
=
self
.
client
.
post
(
'files[]'
:
SimpleUploadedFile
(
'small.mp4'
,
b
"This is not an video!"
),
reverse
(
"wagtailvideos:add_multiple"
),
},
HTTP_X_REQUESTED_WITH
=
'XMLHttpRequest'
)
{
"files[]"
:
SimpleUploadedFile
(
"small.mp4"
,
b
"This is not an video!"
),
},
HTTP_X_REQUESTED_WITH
=
"XMLHttpRequest"
,
)
# Check response
# Check response
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
[
'
Content-Type
'
],
'
application/json
'
)
self
.
assertEqual
(
response
[
"
Content-Type
"
],
"
application/json
"
)
# Check JSON
# Check JSON
response_json
=
json
.
loads
(
response
.
content
.
decode
())
response_json
=
json
.
loads
(
response
.
content
.
decode
())
self
.
assertNotIn
(
'
video_id
'
,
response_json
)
self
.
assertNotIn
(
"
video_id
"
,
response_json
)
self
.
assertNotIn
(
'
form
'
,
response_json
)
self
.
assertNotIn
(
"
form
"
,
response_json
)
self
.
assertIn
(
'
success
'
,
response_json
)
self
.
assertIn
(
"
success
"
,
response_json
)
self
.
assertIn
(
'
error_message
'
,
response_json
)
self
.
assertIn
(
"
error_message
"
,
response_json
)
self
.
assertFalse
(
response_json
[
'
success
'
])
self
.
assertFalse
(
response_json
[
"
success
"
])
self
.
assertIn
(
"Not a valid video."
,
response_json
[
'
error_message
'
])
self
.
assertIn
(
"Not a valid video."
,
response_json
[
"
error_message
"
])
def
test_edit_get
(
self
):
def
test_edit_get
(
self
):
"""
"""
This tests that a GET request to the edit view returns a 405 "METHOD NOT ALLOWED" response
This tests that a GET request to the edit view returns a 405 "METHOD NOT ALLOWED" response
"""
"""
# Send request
# Send request
response
=
self
.
client
.
get
(
reverse
(
'wagtailvideos:edit_multiple'
,
args
=
(
self
.
video
.
id
,
)))
response
=
self
.
client
.
get
(
reverse
(
"wagtailvideos:edit_multiple"
,
args
=
(
self
.
video
.
id
,))
)
# Check response
# Check response
self
.
assertEqual
(
response
.
status_code
,
405
)
self
.
assertEqual
(
response
.
status_code
,
405
)
...
@@ -566,32 +631,39 @@ class TestMultipleVideoUploader(TestCase, WagtailTestUtils):
...
@@ -566,32 +631,39 @@ class TestMultipleVideoUploader(TestCase, WagtailTestUtils):
This tests that a POST request to the edit view edits the video
This tests that a POST request to the edit view edits the video
"""
"""
# Send request
# Send request
response
=
self
.
client
.
post
(
reverse
(
'wagtailvideos:edit_multiple'
,
args
=
(
self
.
video
.
id
,
)),
{
response
=
self
.
client
.
post
(
(
'video-%d-title'
%
self
.
video
.
id
):
"New title!"
,
reverse
(
"wagtailvideos:edit_multiple"
,
args
=
(
self
.
video
.
id
,)),
(
'video-%d-tags'
%
self
.
video
.
id
):
""
,
{
},
HTTP_X_REQUESTED_WITH
=
'XMLHttpRequest'
)
(
"video-%d-title"
%
self
.
video
.
id
):
"New title!"
,
(
"video-%d-tags"
%
self
.
video
.
id
):
""
,
},
HTTP_X_REQUESTED_WITH
=
"XMLHttpRequest"
,
)
# Check response
# Check response
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
[
'
Content-Type
'
],
'
application/json
'
)
self
.
assertEqual
(
response
[
"
Content-Type
"
],
"
application/json
"
)
# Check JSON
# Check JSON
response_json
=
json
.
loads
(
response
.
content
.
decode
())
response_json
=
json
.
loads
(
response
.
content
.
decode
())
self
.
assertIn
(
'
video_id
'
,
response_json
)
self
.
assertIn
(
"
video_id
"
,
response_json
)
self
.
assertNotIn
(
'
form
'
,
response_json
)
self
.
assertNotIn
(
"
form
"
,
response_json
)
self
.
assertIn
(
'
success
'
,
response_json
)
self
.
assertIn
(
"
success
"
,
response_json
)
self
.
assertEqual
(
response_json
[
'
video_id
'
],
self
.
video
.
id
)
self
.
assertEqual
(
response_json
[
"
video_id
"
],
self
.
video
.
id
)
self
.
assertTrue
(
response_json
[
'
success
'
])
self
.
assertTrue
(
response_json
[
"
success
"
])
def
test_edit_post_noajax
(
self
):
def
test_edit_post_noajax
(
self
):
"""
"""
This tests that a POST request to the edit view without AJAX returns a 400 response
This tests that a POST request to the edit view without AJAX returns a 400 response
"""
"""
# Send request
# Send request
response
=
self
.
client
.
post
(
reverse
(
'wagtailvideos:edit_multiple'
,
args
=
(
self
.
video
.
id
,
)),
{
response
=
self
.
client
.
post
(
(
'video-%d-title'
%
self
.
video
.
id
):
"New title!"
,
reverse
(
"wagtailvideos:edit_multiple"
,
args
=
(
self
.
video
.
id
,)),
(
'video-%d-tags'
%
self
.
video
.
id
):
""
,
{
})
(
"video-%d-title"
%
self
.
video
.
id
):
"New title!"
,
(
"video-%d-tags"
%
self
.
video
.
id
):
""
,
},
)
# Check response
# Check response
self
.
assertEqual
(
response
.
status_code
,
400
)
self
.
assertEqual
(
response
.
status_code
,
400
)
...
@@ -602,33 +674,41 @@ class TestMultipleVideoUploader(TestCase, WagtailTestUtils):
...
@@ -602,33 +674,41 @@ class TestMultipleVideoUploader(TestCase, WagtailTestUtils):
and a form with the validation error indicated
and a form with the validation error indicated
"""
"""
# Send request
# Send request
response
=
self
.
client
.
post
(
reverse
(
'wagtailvideos:edit_multiple'
,
args
=
(
self
.
video
.
id
,
)),
{
response
=
self
.
client
.
post
(
(
'video-%d-title'
%
self
.
video
.
id
):
""
,
# Required
reverse
(
"wagtailvideos:edit_multiple"
,
args
=
(
self
.
video
.
id
,)),
(
'video-%d-tags'
%
self
.
video
.
id
):
""
,
{
},
HTTP_X_REQUESTED_WITH
=
'XMLHttpRequest'
)
(
"video-%d-title"
%
self
.
video
.
id
):
""
,
# Required
(
"video-%d-tags"
%
self
.
video
.
id
):
""
,
},
HTTP_X_REQUESTED_WITH
=
"XMLHttpRequest"
,
)
# Check response
# Check response
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
[
'
Content-Type
'
],
'
application/json
'
)
self
.
assertEqual
(
response
[
"
Content-Type
"
],
"
application/json
"
)
self
.
assertTemplateUsed
(
response
,
'
wagtailvideos/multiple/edit_form.html
'
)
self
.
assertTemplateUsed
(
response
,
"
wagtailvideos/multiple/edit_form.html
"
)
# Check that a form error was raised
# Check that a form error was raised
self
.
assertFormError
(
response
,
'form'
,
'title'
,
"This field is required."
)
self
.
assertFormError
(
response
.
context
[
"form"
],
"title"
,
"This field is required."
)
# Check JSON
# Check JSON
response_json
=
json
.
loads
(
response
.
content
.
decode
())
response_json
=
json
.
loads
(
response
.
content
.
decode
())
self
.
assertIn
(
'
video_id
'
,
response_json
)
self
.
assertIn
(
"
video_id
"
,
response_json
)
self
.
assertIn
(
'
form
'
,
response_json
)
self
.
assertIn
(
"
form
"
,
response_json
)
self
.
assertIn
(
'
success
'
,
response_json
)
self
.
assertIn
(
"
success
"
,
response_json
)
self
.
assertEqual
(
response_json
[
'
video_id
'
],
self
.
video
.
id
)
self
.
assertEqual
(
response_json
[
"
video_id
"
],
self
.
video
.
id
)
self
.
assertFalse
(
response_json
[
'
success
'
])
self
.
assertFalse
(
response_json
[
"
success
"
])
def
test_delete_get
(
self
):
def
test_delete_get
(
self
):
"""
"""
This tests that a GET request to the delete view returns a 405 "METHOD NOT ALLOWED" response
This tests that a GET request to the delete view returns a 405 "METHOD NOT ALLOWED" response
"""
"""
# Send request
# Send request
response
=
self
.
client
.
get
(
reverse
(
'wagtailvideos:delete_multiple'
,
args
=
(
self
.
video
.
id
,
)))
response
=
self
.
client
.
get
(
reverse
(
"wagtailvideos:delete_multiple"
,
args
=
(
self
.
video
.
id
,))
)
# Check response
# Check response
self
.
assertEqual
(
response
.
status_code
,
405
)
self
.
assertEqual
(
response
.
status_code
,
405
)
...
@@ -638,30 +718,33 @@ class TestMultipleVideoUploader(TestCase, WagtailTestUtils):
...
@@ -638,30 +718,33 @@ class TestMultipleVideoUploader(TestCase, WagtailTestUtils):
This tests that a POST request to the delete view deletes the video
This tests that a POST request to the delete view deletes the video
"""
"""
# Send request
# Send request
response
=
self
.
client
.
post
(
reverse
(
response
=
self
.
client
.
post
(
'wagtailvideos:delete_multiple'
,
args
=
(
self
.
video
.
id
,
)
reverse
(
"wagtailvideos:delete_multiple"
,
args
=
(
self
.
video
.
id
,)),
),
HTTP_X_REQUESTED_WITH
=
'XMLHttpRequest'
)
HTTP_X_REQUESTED_WITH
=
"XMLHttpRequest"
,
)
# Check response
# Check response
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
[
'
Content-Type
'
],
'
application/json
'
)
self
.
assertEqual
(
response
[
"
Content-Type
"
],
"
application/json
"
)
# Make sure the video is deleted
# Make sure the video is deleted
self
.
assertFalse
(
Video
.
objects
.
filter
(
id
=
self
.
video
.
id
).
exists
())
self
.
assertFalse
(
Video
.
objects
.
filter
(
id
=
self
.
video
.
id
).
exists
())
# Check JSON
# Check JSON
response_json
=
json
.
loads
(
response
.
content
.
decode
())
response_json
=
json
.
loads
(
response
.
content
.
decode
())
self
.
assertIn
(
'
video_id
'
,
response_json
)
self
.
assertIn
(
"
video_id
"
,
response_json
)
self
.
assertIn
(
'
success
'
,
response_json
)
self
.
assertIn
(
"
success
"
,
response_json
)
self
.
assertEqual
(
response_json
[
'
video_id
'
],
self
.
video
.
id
)
self
.
assertEqual
(
response_json
[
"
video_id
"
],
self
.
video
.
id
)
self
.
assertTrue
(
response_json
[
'
success
'
])
self
.
assertTrue
(
response_json
[
"
success
"
])
def
test_delete_post_noajax
(
self
):
def
test_delete_post_noajax
(
self
):
"""
"""
This tests that a POST request to the delete view without AJAX returns a 400 response
This tests that a POST request to the delete view without AJAX returns a 400 response
"""
"""
# Send request
# Send request
response
=
self
.
client
.
post
(
reverse
(
'wagtailvideos:delete_multiple'
,
args
=
(
self
.
video
.
id
,
)))
response
=
self
.
client
.
post
(
reverse
(
"wagtailvideos:delete_multiple"
,
args
=
(
self
.
video
.
id
,))
)
# Check response
# Check response
self
.
assertEqual
(
response
.
status_code
,
400
)
self
.
assertEqual
(
response
.
status_code
,
400
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment