From 620140336c2115066bd36420465e09c72f7f7534 Mon Sep 17 00:00:00 2001 From: Trent Palmer Date: Mon, 5 Apr 2021 14:25:29 -0700 Subject: [PATCH] add audio/tests/test_licensechoices.py --- .gitignore | 1 + audio/tests.py | 3 --- audio/tests/__init__.py | 0 audio/tests/test_licensechoices.py | 34 ++++++++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 3 deletions(-) delete mode 100644 audio/tests.py create mode 100644 audio/tests/__init__.py create mode 100644 audio/tests/test_licensechoices.py diff --git a/.gitignore b/.gitignore index 0680aab..9d14ec9 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ accounts/__pycache__ accounts/migrations/__pycache__ audio/__pycache__ audio/migrations/__pycache__ +audio/tests/__pycache__ tp/__pycache__ diff --git a/audio/tests.py b/audio/tests.py deleted file mode 100644 index 7ce503c..0000000 --- a/audio/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/audio/tests/__init__.py b/audio/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/audio/tests/test_licensechoices.py b/audio/tests/test_licensechoices.py new file mode 100644 index 0000000..1c7b3a6 --- /dev/null +++ b/audio/tests/test_licensechoices.py @@ -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])