aboutsummaryrefslogtreecommitdiffstats
path: root/api/tests
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2019-02-18 21:04:05 +0100
committerGravatar Johannes Christ <[email protected]>2019-02-18 21:04:05 +0100
commit37608d6096cb45847c68273a65c3bbe862c2e8a4 (patch)
tree77a91a828db49d3d1ab28382939555397d39217a /api/tests
parentAdd a validator for bot setting names. (diff)
Add unit test for the new validator.
Diffstat (limited to 'api/tests')
-rw-r--r--api/tests/test_validators.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/api/tests/test_validators.py b/api/tests/test_validators.py
index 0f3f7fa9..d2c0a136 100644
--- a/api/tests/test_validators.py
+++ b/api/tests/test_validators.py
@@ -1,7 +1,10 @@
from django.core.exceptions import ValidationError
from django.test import TestCase
-from ..validators import validate_tag_embed
+from ..validators import (
+ validate_bot_setting_name,
+ validate_tag_embed
+)
REQUIRED_KEYS = (
@@ -9,6 +12,14 @@ REQUIRED_KEYS = (
)
+class BotSettingValidatorTests(TestCase):
+ def test_accepts_valid_names(self):
+ validate_bot_setting_name('defcon')
+
+ def test_rejects_bad_names(self):
+ with self.assertRaises(ValidationError):
+ validate_bot_setting_name('bad name')
+
class TagEmbedValidatorTests(TestCase):
def test_rejects_non_mapping(self):
with self.assertRaises(ValidationError):