aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/resources/tests
diff options
context:
space:
mode:
authorGravatar hedy <[email protected]>2023-12-14 20:28:17 +0800
committerGravatar hedy <[email protected]>2023-12-14 20:28:17 +0800
commit449c08fd5459b2f804dbf825086ec1dd0f244d8a (patch)
treee4589cb227cdb2e611bcbf9b02ea481fe24cdb34 /pydis_site/apps/resources/tests
parentResize theme switch (diff)
parentMerge pull request #1173 from python-discord/dependabot/pip/sentry-sdk-1.39.0 (diff)
Fix all conflicts
hopefully I dont have to do this again
Diffstat (limited to 'pydis_site/apps/resources/tests')
-rw-r--r--pydis_site/apps/resources/tests/test_resource_data.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/pydis_site/apps/resources/tests/test_resource_data.py b/pydis_site/apps/resources/tests/test_resource_data.py
new file mode 100644
index 00000000..3a96e8b9
--- /dev/null
+++ b/pydis_site/apps/resources/tests/test_resource_data.py
@@ -0,0 +1,25 @@
+import yaml
+from django.test import TestCase
+
+from pydis_site.apps.resources.views import RESOURCES_PATH
+
+
+class TestResourceData(TestCase):
+ """Test data validity of resources."""
+
+ def test_no_duplicate_links(self):
+ """Test that there are no duplicate links in each resource."""
+ for path in RESOURCES_PATH.rglob('*.yaml'):
+ with self.subTest(resource=path.stem):
+ content = yaml.safe_load(path.read_text())
+ url_links = tuple(item['url'] for item in content.get('urls', ()))
+ if 'title_url' in content:
+ all_links = url_links + (content['title_url'],)
+ else:
+ all_links = url_links
+
+ self.assertCountEqual(
+ all_links,
+ set(all_links),
+ msg="One or more links are duplicated on the resource",
+ )