aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/resources/tests
diff options
context:
space:
mode:
authorGravatar ks129 <[email protected]>2020-11-14 09:38:36 +0200
committerGravatar ks129 <[email protected]>2020-11-14 09:38:36 +0200
commit7631ccfef001a6213c395bf8a79645220c658e08 (patch)
tree0a8301db45f51643a2b9ad671dc1eb7cb1b9af01 /pydis_site/apps/resources/tests
parentUpdate resources YAML files to match with new system (diff)
Create as_icon templatetag and tests for it
Diffstat (limited to 'pydis_site/apps/resources/tests')
-rw-r--r--pydis_site/apps/resources/tests/test_as_icon.py28
1 files changed, 28 insertions, 0 deletions
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"]))