aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/resources/tests/test_as_icon.py
blob: 5b33910d81edcefeee7f0f48cdc16d12b830ab6c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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"]))