diff options
author | 2022-02-01 20:54:39 +0100 | |
---|---|---|
committer | 2022-02-01 20:54:39 +0100 | |
commit | f3bccff688a7f5a9eb619dbed3f726ef2c07c402 (patch) | |
tree | 9ee47402d493d97999603f7eb79f69639aada838 /pydis_site/apps/resources/tests | |
parent | Murder some space (diff) |
Refactor as_css_class to 'to_kebabcase'.
We're making a few changes here
- Changing the name to 'to_kebabcase'
- Covering all edge cases
- Adding a unit test for this utility
Diffstat (limited to 'pydis_site/apps/resources/tests')
4 files changed, 19 insertions, 11 deletions
diff --git a/pydis_site/apps/resources/tests/test_resources.py b/pydis_site/apps/resources/tests/test_resources.py deleted file mode 100644 index 81638e2f..00000000 --- a/pydis_site/apps/resources/tests/test_resources.py +++ /dev/null @@ -1,9 +0,0 @@ -from django.test import TestCase - - -class TestResources(TestCase): - """Test our resource filtering systems.""" - - def test_utils_to_retrieve_tags(self): - """Test that the utils that retrieve the tags work as intended.""" - pass diff --git a/pydis_site/apps/resources/tests/test_to_kebabcase.py b/pydis_site/apps/resources/tests/test_to_kebabcase.py new file mode 100644 index 00000000..a141143d --- /dev/null +++ b/pydis_site/apps/resources/tests/test_to_kebabcase.py @@ -0,0 +1,19 @@ +from django.test import TestCase + +from pydis_site.apps.resources.templatetags.to_kebabcase import _to_kebabcase + + +class TestToKebabcase(TestCase): + """Tests for the `as_css_class` template tag.""" + + def test_to_kebabcase(self): + """Test the to_kebabcase utility and template tag.""" + weird_input = ( + "_-_--_A_LEm0n?in&¤'the##trEE£$@€@€@@£is-NOT----QUITE//" + "as#good! as one __IN-YOUR|||HaND" + ) + + self.assertEqual( + _to_kebabcase(weird_input), + "a-lem0n-in-the-tree-is-not-quite-as-good-as-one-in-your-hand", + ) diff --git a/pydis_site/apps/resources/tests/testing_resources/testing/foobar/resource_test.yaml b/pydis_site/apps/resources/tests/testing_resources/testing/foobar/resource_test.yaml deleted file mode 100644 index 22835090..00000000 --- a/pydis_site/apps/resources/tests/testing_resources/testing/foobar/resource_test.yaml +++ /dev/null @@ -1 +0,0 @@ -name: Resource Test diff --git a/pydis_site/apps/resources/tests/testing_resources/testing/my_resource.yaml b/pydis_site/apps/resources/tests/testing_resources/testing/my_resource.yaml deleted file mode 100644 index 61df6173..00000000 --- a/pydis_site/apps/resources/tests/testing_resources/testing/my_resource.yaml +++ /dev/null @@ -1 +0,0 @@ -name: My Resource |