summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2016-01-24 15:13:58 -0600
committerIan Cordasco <graffatcolmingov@gmail.com>2016-01-24 15:13:58 -0600
commitebdc935ffc44bbfaae863b3b07bc165c601dd88c (patch)
tree9185c22b87e5a6401fbf9fd6203cb0495f75d174 /tests
parentb0a258fe79c7f8713708b03f64cdbc832a449bf4 (diff)
downloadflake8-ebdc935ffc44bbfaae863b3b07bc165c601dd88c.tar.gz
Refactor NotifierBuilder into its own mixin
This allows for easier unit testing
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_plugin_type_manager.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/unit/test_plugin_type_manager.py b/tests/unit/test_plugin_type_manager.py
index cb121c6..2735dec 100644
--- a/tests/unit/test_plugin_type_manager.py
+++ b/tests/unit/test_plugin_type_manager.py
@@ -165,3 +165,31 @@ def test_provide_options(PluginManager):
plugin.provide_options.assert_called_with(optmanager,
options,
extra_args)
+
+
+class FakePluginTypeManager(manager.NotifierBuilder):
+ """Provide an easy way to test the NotifierBuilder."""
+
+ def __init__(self, manager):
+ """Initialize with our fake manager."""
+ self.names = sorted(manager.keys())
+ self.manager = manager
+
+
+@pytest.fixture
+def notifier_builder():
+ """Create a fake plugin type manager."""
+ return FakePluginTypeManager(manager={
+ 'T100': object(),
+ 'T101': object(),
+ 'T110': object(),
+ })
+
+
+def test_build_notifier(notifier_builder):
+ """Verify we properly build a Notifier object."""
+ notifier = notifier_builder.build_notifier()
+ for name in ('T100', 'T101', 'T110'):
+ assert list(notifier.listeners_for(name)) == [
+ notifier_builder.manager[name]
+ ]