diff options
author | jelle van der Waa <jelle@vdwaa.nl> | 2018-01-29 20:10:10 +0100 |
---|---|---|
committer | Angel Velásquez <angvp@archlinux.org> | 2018-01-29 14:10:10 -0500 |
commit | 148692cd8fc79b3e43ef0f2c40a2da9d87c9da9e (patch) | |
tree | d34782a388091c4f14b24b9d0878f4a8265beef2 /mirrors/tests/test_templatetags.py | |
parent | 2ff2b26aa92c8efd21090562091361924a3a9428 (diff) | |
download | archweb-148692cd8fc79b3e43ef0f2c40a2da9d87c9da9e.tar.gz archweb-148692cd8fc79b3e43ef0f2c40a2da9d87c9da9e.zip |
More code refactoring / tests (#79)
* main: move tests to main/tests
Move the templatetags tests to main/tests/test_templatetags.
* main: Add test for templatetags country
Create a test for the templatetag country_flag.
* main: remove duplicate floatvalue
floatvalue is only used in the mirrors templates and the same exact
function exists in the mirror_status templatetags.
* main: Remove duplicate hours filter
The hours filter is also defined in the mirror_status and only used in
mirrors.
* main: move percentage filter to mirrors
Move the percentage filter to the only user of it and add a test for
basic use cases.
* main: remove duplicate duration implementation
The duration templatetag filter is also defined in mirror_status.py
* templates: remove unrequired import flags
* main: Add missing testcase for country_flag
Add the None test case, so that the function is fully covered.
* todolists: create tests for Todolist model
Add basic tests for the Todolist model
Diffstat (limited to 'mirrors/tests/test_templatetags.py')
-rw-r--r-- | mirrors/tests/test_templatetags.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/mirrors/tests/test_templatetags.py b/mirrors/tests/test_templatetags.py index 0ee2a34f..1d9e6389 100644 --- a/mirrors/tests/test_templatetags.py +++ b/mirrors/tests/test_templatetags.py @@ -2,7 +2,7 @@ from datetime import timedelta from django.test import SimpleTestCase -from mirrors.templatetags.mirror_status import duration, hours, floatvalue +from mirrors.templatetags.mirror_status import duration, hours, floatvalue, percentage class MirrorTemplateTagTest(SimpleTestCase): @@ -27,3 +27,8 @@ class MirrorTemplateTagTest(SimpleTestCase): self.assertEqual(floatvalue(123), '123.00') self.assertEqual(floatvalue(123.1), '123.10') self.assertEqual(floatvalue(123.1, 1), '123.1') + + def test_percentage(self): + self.assertEqual(percentage(None), u'') + self.assertEqual(percentage(10), '1000.0%') + self.assertEqual(percentage(10, 2), '1000.00%') |