From 35a64eca380d48e0f90b37eb4083239abcad6f93 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 19 Oct 2019 11:32:30 -0700 Subject: [PATCH] Plugin: update tests I'm taking the liberty of adding myself to supybot.authors here. --- plugins/Plugin/__init__.py | 7 +++++-- plugins/Plugin/test.py | 27 ++++++++++++--------------- src/__init__.py | 1 + 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/plugins/Plugin/__init__.py b/plugins/Plugin/__init__.py index e1ad8c51c..19087e204 100644 --- a/plugins/Plugin/__init__.py +++ b/plugins/Plugin/__init__.py @@ -39,9 +39,12 @@ __version__ = "%%VERSION%%" __author__ = supybot.authors.jemfinch # This is a dictionary mapping supybot.Author instances to lists of # contributions. +# Note: the tests for this plugin look at some of this data - update that too +# as necessary __contributors__ = { - supybot.authors.skorobeus: ['contributors'], - } + supybot.authors.skorobeus: ['original contributors command'], + supybot.authors.jlu: ['refactored contributors command'], +} from . import config from . import plugin diff --git a/plugins/Plugin/test.py b/plugins/Plugin/test.py index a18f980eb..9f9c7f91f 100644 --- a/plugins/Plugin/test.py +++ b/plugins/Plugin/test.py @@ -34,7 +34,7 @@ class PluginTestCase(PluginTestCase): def testPlugin(self): self.assertRegexp('plugin ignore', 'available.*Utilities plugin') self.assertResponse('echo [plugin ignore]', 'Utilities') - + def testPlugins(self): self.assertRegexp('plugins join', '(Format.*Admin|Admin.*Format)') self.assertRegexp('plugins plugin', 'Plugin') @@ -50,25 +50,22 @@ class PluginTestCase(PluginTestCase): def testContributors(self): # Test ability to list contributors self.assertNotError('contributors Plugin') + # Test ability to list contributions - # Verify that when a single command contribution has been made, - # the word "command" is properly not pluralized. - # Note: This will break if the listed person ever makes more than - # one contribution to the Plugin plugin - self.assertRegexp('contributors Plugin skorobeus', 'command') - # Test handling of pluralization of "command" when person has - # contributed more than one command to the plugin. - # -- Need to create this case, check it with the regexp 'commands' + # As of 2019-10-19 there is no more distinction between commands and non-commands + self.assertRegexp('contributors Plugin skorobeus', 'original contributors command') + + # TODO: test handling of a person with multiple contributions to a command + # Test handling of invalid plugin self.assertRegexp('contributors InvalidPlugin', 'not a valid plugin') - # Test handling of invalid person + + # Test handling of unknown person. As of 2019-10-19 it doesn't matter whether + # they're listed in supybot.authors or not. self.assertRegexp('contributors Plugin noname', - 'not a registered contributor') - # Test handling of valid person with no contributions - # Note: This will break if the listed person ever makes a contribution - # to the Plugin plugin + 'not listed as a contributor') self.assertRegexp('contributors Plugin bwp', - 'listed as a contributor') + 'not listed as a contributor') def testContributorsIsCaseInsensitive(self): self.assertNotError('contributors Plugin Skorobeus') diff --git a/src/__init__.py b/src/__init__.py index e4c82177a..14de16165 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -64,6 +64,7 @@ class authors(object): # This is basically a bag. grantbow = Author('Grant Bowman', 'Grantbow', 'grantbow@grantbow.com') stepnem = Author('Štěpán Němec', 'stepnem', 'stepnem@gmail.com') progval = Author('Valentin Lorentz', 'ProgVal', 'progval@gmail.com') + jlu = Author('James Lu', 'GLolol', 'james@overdrivenetworks.com') unknown = Author('Unknown author', 'unknown', 'unknown@email.invalid') # Let's be somewhat safe about this.