mirror of
https://github.com/TrentSPalmer/trentpalmerdotorg.git
synced 2024-11-25 19:01:30 -08:00
add audio/tests/test_licensechoices.py
This commit is contained in:
parent
fa30e89b0e
commit
620140336c
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,4 +4,5 @@ accounts/__pycache__
|
|||||||
accounts/migrations/__pycache__
|
accounts/migrations/__pycache__
|
||||||
audio/__pycache__
|
audio/__pycache__
|
||||||
audio/migrations/__pycache__
|
audio/migrations/__pycache__
|
||||||
|
audio/tests/__pycache__
|
||||||
tp/__pycache__
|
tp/__pycache__
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
|
0
audio/tests/__init__.py
Normal file
0
audio/tests/__init__.py
Normal file
34
audio/tests/test_licensechoices.py
Normal file
34
audio/tests/test_licensechoices.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
from audio.choices import LICENSE_CHOICES, get_license_info
|
||||||
|
|
||||||
|
TEST_LICENSE_CHOICES = (
|
||||||
|
(1, 'Public Domain'),
|
||||||
|
(2, 'Unknown'),
|
||||||
|
(3, 'CC BY-SA 2.5'),
|
||||||
|
(4, 'CC BY-SA 3.0'),
|
||||||
|
(5, 'CC BY 3.0'),
|
||||||
|
(6, 'CC BY 1.0'),
|
||||||
|
(7, 'CC0 1.0')
|
||||||
|
)
|
||||||
|
|
||||||
|
TEST_LICENSE_INFO = (
|
||||||
|
('Public Domain', 'https://en.wikipedia.org/wiki/Public_domain'),
|
||||||
|
('Unknown', 'https://example.com'),
|
||||||
|
('CC BY-SA 2.5', 'https://creativecommons.org/licenses/by-sa/2.5'),
|
||||||
|
('CC BY-SA 3.0', 'https://creativecommons.org/licenses/by-sa/3.0'),
|
||||||
|
('CC BY 3.0', 'https://creativecommons.org/licenses/by/3.0'),
|
||||||
|
('CC BY 1.0', 'https://creativecommons.org/licenses/by/1.0'),
|
||||||
|
('CC0 1.0', 'https://creativecommons.org/publicdomain/zero/1.0')
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class LicenseChoicesTestCase(TestCase):
|
||||||
|
|
||||||
|
def test_license_choices(self):
|
||||||
|
self.assertEqual(len(LICENSE_CHOICES), 7)
|
||||||
|
for i, x in enumerate(TEST_LICENSE_CHOICES):
|
||||||
|
self.assertEqual(TEST_LICENSE_CHOICES[i], LICENSE_CHOICES[i])
|
||||||
|
|
||||||
|
def test_license_info(self):
|
||||||
|
for i in range(len(LICENSE_CHOICES)):
|
||||||
|
self.assertEqual(get_license_info(i + 1), TEST_LICENSE_INFO[i])
|
Loading…
Reference in New Issue
Block a user