Plugin: update tests

I'm taking the liberty of adding myself to supybot.authors here.
This commit is contained in:
James Lu 2019-10-19 11:32:30 -07:00
parent e3d89875ae
commit 35a64eca38
3 changed files with 18 additions and 17 deletions

View File

@ -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

View File

@ -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')

View File

@ -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.