Update tests after last night's refactor

This commit is contained in:
Ian Cordasco 2016-05-10 16:37:45 -05:00
parent f20d44565b
commit 559922dbbc
2 changed files with 18 additions and 26 deletions

View file

@ -119,8 +119,7 @@ def test_parse_args_normalize_paths(optmanager):
def test_format_plugin():
"""Verify that format_plugin turns a tuple into a dictionary."""
plugin = manager.OptionManager.format_plugin(('T101', 'Testing', '0.0.0'))
assert plugin['entry'] == 'T101'
plugin = manager.OptionManager.format_plugin(('Testing', '0.0.0'))
assert plugin['name'] == 'Testing'
assert plugin['version'] == '0.0.0'
@ -128,9 +127,9 @@ def test_format_plugin():
def test_generate_versions(optmanager):
"""Verify a comma-separated string is generated of registered plugins."""
optmanager.registered_plugins = [
('T100', 'Testing 100', '0.0.0'),
('T101', 'Testing 101', '0.0.0'),
('T300', 'Testing 300', '0.0.0'),
('Testing 100', '0.0.0'),
('Testing 101', '0.0.0'),
('Testing 300', '0.0.0'),
]
assert (optmanager.generate_versions() ==
'Testing 100: 0.0.0, Testing 101: 0.0.0, Testing 300: 0.0.0')
@ -138,14 +137,13 @@ def test_generate_versions(optmanager):
def test_generate_versions_with_format_string(optmanager):
"""Verify a comma-separated string is generated of registered plugins."""
optmanager.registered_plugins = [
('T100', 'Testing', '0.0.0'),
('T101', 'Testing', '0.0.0'),
('T300', 'Testing', '0.0.0'),
]
optmanager.registered_plugins.update([
('Testing', '0.0.0'),
('Testing', '0.0.0'),
('Testing', '0.0.0'),
])
assert (
optmanager.generate_versions('%(name)s(%(entry)s): %(version)s') ==
'Testing(T100): 0.0.0, Testing(T101): 0.0.0, Testing(T300): 0.0.0'
optmanager.generate_versions() == 'Testing: 0.0.0'
)
@ -155,9 +153,9 @@ def test_update_version_string(optmanager):
assert optmanager.parser.version == TEST_VERSION
optmanager.registered_plugins = [
('T100', 'Testing 100', '0.0.0'),
('T101', 'Testing 101', '0.0.0'),
('T300', 'Testing 300', '0.0.0'),
('Testing 100', '0.0.0'),
('Testing 101', '0.0.0'),
('Testing 300', '0.0.0'),
]
optmanager.update_version_string()
@ -172,14 +170,14 @@ def test_generate_epilog(optmanager):
assert optmanager.parser.epilog is None
optmanager.registered_plugins = [
('T100', 'Testing 100', '0.0.0'),
('T101', 'Testing 101', '0.0.0'),
('T300', 'Testing 300', '0.0.0'),
('Testing 100', '0.0.0'),
('Testing 101', '0.0.0'),
('Testing 300', '0.0.0'),
]
expected_value = (
'Installed plugins: Testing 100(T100): 0.0.0, Testing 101(T101): '
'0.0.0, Testing 300(T300): 0.0.0'
'Installed plugins: Testing 100: 0.0.0, Testing 101: 0.0.0, Testing'
' 300: 0.0.0'
)
optmanager.generate_epilog()

View file

@ -114,12 +114,6 @@ def test_register_options():
# Assert that we call add_options
plugin_obj.add_options.assert_called_once_with(option_manager)
# Assert that we register the plugin
option_manager.register_plugin.assert_called_once_with(
entry_point_name='T000',
version=plugin_obj.version,
name=plugin_obj.name,
)
def test_register_options_checks_plugin_for_method():