aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps
diff options
context:
space:
mode:
authorGravatar jchristgit <[email protected]>2023-07-15 15:05:29 +0200
committerGravatar GitHub <[email protected]>2023-07-15 14:05:29 +0100
commit2227c8d42846d45e0529dfe9f56e24f938e60d86 (patch)
treecc0d58fed799c01e2a9fe627ffc5c37cb1851e24 /pydis_site/apps
parentFix empty <h1> tag on page listing (#1033) (diff)
Fix duplicated links in resources (#1034)
* Add test for duplicate links * Remove duplicated links Closes #1022. Closes #1023. Closes #1024.
Diffstat (limited to 'pydis_site/apps')
-rw-r--r--pydis_site/apps/resources/resources/kivy.yaml5
-rw-r--r--pydis_site/apps/resources/resources/panda3d.yaml5
-rw-r--r--pydis_site/apps/resources/resources/people_postgres_data.yaml5
-rw-r--r--pydis_site/apps/resources/tests/test_resource_data.py25
4 files changed, 28 insertions, 12 deletions
diff --git a/pydis_site/apps/resources/resources/kivy.yaml b/pydis_site/apps/resources/resources/kivy.yaml
index e9c14129..f49c33fb 100644
--- a/pydis_site/apps/resources/resources/kivy.yaml
+++ b/pydis_site/apps/resources/resources/kivy.yaml
@@ -5,11 +5,8 @@ description: The Kivy project, through the Kivy framework and its sister project
icon_image: https://raw.githubusercontent.com/kivy/kivy-website/master/content/logos/kivy-logo-black-256.png
icon_size: 50
title_image: https://i.imgur.com/EVP3jZR.png
-title_url: https://discord.gg/djPtTRJ
+title_url: https://kivy.org/
urls:
- - icon: solid/external-link-alt
- url: https://kivy.org/
- color: teal
- icon: branding/discord
url: https://discord.gg/djPtTRJ
color: blurple
diff --git a/pydis_site/apps/resources/resources/panda3d.yaml b/pydis_site/apps/resources/resources/panda3d.yaml
index eeb54465..51861474 100644
--- a/pydis_site/apps/resources/resources/panda3d.yaml
+++ b/pydis_site/apps/resources/resources/panda3d.yaml
@@ -2,12 +2,9 @@ name: Panda3D
description: Panda3D is a Python-focused 3-D framework for rapid development of games,
visualizations, and simulations, written in C++ with an emphasis on performance and flexibility.
title_image: https://www.panda3d.org/wp-content/uploads/2019/01/panda3d_logo.png
-title_url: https://discord.gg/9XsucTT
+title_url: https://www.panda3d.org/
position: 9
urls:
- - icon: solid/external-link-alt
- url: https://www.panda3d.org/
- color: teal
- icon: branding/discord
url: https://discord.gg/9XsucTT
color: blurple
diff --git a/pydis_site/apps/resources/resources/people_postgres_data.yaml b/pydis_site/apps/resources/resources/people_postgres_data.yaml
index 9fec6634..212eed89 100644
--- a/pydis_site/apps/resources/resources/people_postgres_data.yaml
+++ b/pydis_site/apps/resources/resources/people_postgres_data.yaml
@@ -5,11 +5,8 @@ description: People, Postgres, Data specializes in building users of Postgres
They take a holistic approach to their community inviting not only technical topics but Professional Development
and Life in general including movies, games, books and travel.
title_image: https://media.discordapp.net/attachments/748954447857844318/750519488268730377/people_postgres_data.png
-title_url: https://discord.gg/Ujw8m8v
+title_url: https://postgresconf.org/
urls:
- - icon: solid/external-link-alt
- url: https://postgresconf.org/
- color: teal
- icon: branding/discord
url: https://discord.gg/Ujw8m8v
color: bluple
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",
+ )