aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bot
diff options
context:
space:
mode:
authorGravatar Sebastiaan Zeeff <[email protected]>2019-10-13 11:36:06 +0200
committerGravatar Sebastiaan Zeeff <[email protected]>2019-10-13 11:36:06 +0200
commit776861636dbd180b8ad0bcc9540d935afaf2b873 (patch)
tree053c0dbf2ce1c6d12d45405afe5abc1dc9be6531 /tests/bot
parentMove `tests.test_resources` to `unittest`. (diff)
Add subTest + move test_resource to resources subdir
I've added a `self.subTest` to the `name` loop so we still test and get output for all names in the list if one of them fails the test. In addition, I've moved it to the `tests/bot/resources` subdirectory.
Diffstat (limited to 'tests/bot')
-rw-r--r--tests/bot/resources/test_resources.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/bot/resources/test_resources.py b/tests/bot/resources/test_resources.py
new file mode 100644
index 000000000..73937cfa6
--- /dev/null
+++ b/tests/bot/resources/test_resources.py
@@ -0,0 +1,17 @@
+import json
+import unittest
+from pathlib import Path
+
+
+class ResourceValidationTests(unittest.TestCase):
+ """Validates resources used by the bot."""
+ def test_stars_valid(self):
+ """The resource `bot/resources/stars.json` should contain a list of strings."""
+ path = Path('bot', 'resources', 'stars.json')
+ content = path.read_text()
+ data = json.loads(content)
+
+ self.assertIsInstance(data, list)
+ for name in data:
+ with self.subTest(name=name):
+ self.assertIsInstance(name, str)