diff options
author | 2019-10-13 12:11:13 +0200 | |
---|---|---|
committer | 2019-10-13 12:11:13 +0200 | |
commit | 7bd0be0c7dfd0d75ccaa639ccc124fffd9ef785a (patch) | |
tree | 349cdfd0b0599d801523f629d4ecd3435ab8fd9d /tests/cogs | |
parent | Move the `antispam` cog tests to `unittest`. (diff) |
Move test_antispam.py to tests.bot.cogs
Diffstat (limited to 'tests/cogs')
-rw-r--r-- | tests/cogs/__init__.py | 0 | ||||
-rw-r--r-- | tests/cogs/test_antispam.py | 35 |
2 files changed, 0 insertions, 35 deletions
diff --git a/tests/cogs/__init__.py b/tests/cogs/__init__.py deleted file mode 100644 index e69de29bb..000000000 --- a/tests/cogs/__init__.py +++ /dev/null diff --git a/tests/cogs/test_antispam.py b/tests/cogs/test_antispam.py deleted file mode 100644 index ce5472c71..000000000 --- a/tests/cogs/test_antispam.py +++ /dev/null @@ -1,35 +0,0 @@ -import unittest - -from bot.cogs import antispam - - -class AntispamConfigurationValidationTests(unittest.TestCase): - """Tests validation of the antispam cog configuration.""" - - def test_default_antispam_config_is_valid(self): - """The default antispam configuration is valid.""" - validation_errors = antispam.validate_config() - self.assertEqual(validation_errors, {}) - - def test_unknown_rule_returns_error(self): - """Configuring an unknown rule returns an error.""" - self.assertEqual( - antispam.validate_config({'invalid-rule': {}}), - {'invalid-rule': "`invalid-rule` is not recognized as an antispam rule."} - ) - - def test_missing_keys_returns_error(self): - """Not configuring required keys returns an error.""" - keys = (('interval', 'max'), ('max', 'interval')) - for configured_key, unconfigured_key in keys: - with self.subTest( - configured_key=configured_key, - unconfigured_key=unconfigured_key - ): - config = {'burst': {configured_key: 10}} - error = f"Key `{unconfigured_key}` is required but not set for rule `burst`" - - self.assertEqual( - antispam.validate_config(config), - {'burst': error} - ) |