diff options
author | 2019-09-16 02:17:29 +1000 | |
---|---|---|
committer | 2019-09-16 02:17:29 +1000 | |
commit | 9fb4884cb1eb4faf810c65afd112e02a8d8320ff (patch) | |
tree | dfa8ed4a86a17b409be4fb7725a573752c7ea435 | |
parent | Merge branch 'master' of github.com:python-discord/bot (diff) | |
parent | Validate `bot/resources/stars.json` in tests. (diff) |
Merge pull request #427 from python-discord/bot-resources-validation-tests
Validate `bot/resources/stars.json` in tests.
-rw-r--r-- | tests/test_resources.py | 18 |
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') |