From 7631ccfef001a6213c395bf8a79645220c658e08 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Sat, 14 Nov 2020 09:38:36 +0200 Subject: Create as_icon templatetag and tests for it --- pydis_site/apps/resources/tests/test_as_icon.py | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 pydis_site/apps/resources/tests/test_as_icon.py (limited to 'pydis_site/apps/resources/tests') diff --git a/pydis_site/apps/resources/tests/test_as_icon.py b/pydis_site/apps/resources/tests/test_as_icon.py new file mode 100644 index 00000000..5b33910d --- /dev/null +++ b/pydis_site/apps/resources/tests/test_as_icon.py @@ -0,0 +1,28 @@ +from django.test import TestCase + +from pydis_site.apps.resources.templatetags import as_icon + + +class TestAsIcon(TestCase): + """Tests for `as_icon` templatetag.""" + + def test_as_icon(self): + """Should return proper icon type class and icon class based on input.""" + test_cases = [ + { + "input": "regular/icon", + "output": "fas fa-icon", + }, + { + "input": "branding/brand", + "output": "fab fa-brand", + }, + { + "input": "fake/my-icon", + "output": "fas fa-my-icon", + } + ] + + for case in test_cases: + with self.subTest(input=case["input"], output=case["output"]): + self.assertEqual(case["output"], as_icon(case["input"])) -- cgit v1.2.3