aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_resources.py
diff options
context:
space:
mode:
authorGravatar Akarys42 <[email protected]>2019-09-23 16:16:10 +0200
committerGravatar Akarys42 <[email protected]>2019-09-23 16:16:10 +0200
commitf4f3b2a15ecdce5291ef2d2d98b0af6d77fbc228 (patch)
tree250036c9d5162c6ee62d1a7bd6c999a03a2caad5 /tests/test_resources.py
parentChange log.error to log.exception (diff)
parentMerge branch 'master' of https://github.com/python-discord/bot into python-di... (diff)
Merge branch 'python-discord-master'
Diffstat (limited to 'tests/test_resources.py')
-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')