aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2019-09-15 17:26:41 +0200
committerGravatar Johannes Christ <[email protected]>2019-09-15 18:14:09 +0200
commit4d2e3b1afcb2ad15ff3e091929f42907effa4496 (patch)
tree4535a736b3e6ea91859aa22d0c815e6739b6c0da /tests
parentMerge pull request #423 from python-discord/bot-pagination-tests (diff)
Validate `bot/resources/stars.json` in tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_resources.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_resources.py b/tests/test_resources.py
new file mode 100644
index 000000000..2b17aea64
--- /dev/null
+++ b/tests/test_resources.py
@@ -0,0 +1,18 @@
+import json
+import mimetypes
+from pathlib import Path
+from urllib.parse import urlparse
+
+
+def test_stars_valid():
+ """Validates that `bot/resources/stars.json` contains valid images."""
+
+ path = Path('bot', 'resources', 'stars.json')
+ content = path.read_text()
+ data = json.loads(content)
+
+ for url in data.values():
+ assert urlparse(url).scheme == 'https'
+
+ mimetype, _ = mimetypes.guess_type(url)
+ assert mimetype in ('image/jpeg', 'image/png')