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 __author__ = supybot.authors.jemfinch
# This is a dictionary mapping supybot.Author instances to lists of # This is a dictionary mapping supybot.Author instances to lists of
# contributions. # contributions.
# Note: the tests for this plugin look at some of this data - update that too
# as necessary
__contributors__ = { __contributors__ = {
supybot.authors.skorobeus: ['contributors'], supybot.authors.skorobeus: ['original contributors command'],
} supybot.authors.jlu: ['refactored contributors command'],
}
from . import config from . import config
from . import plugin from . import plugin

View File

@ -50,25 +50,22 @@ class PluginTestCase(PluginTestCase):
def testContributors(self): def testContributors(self):
# Test ability to list contributors # Test ability to list contributors
self.assertNotError('contributors Plugin') self.assertNotError('contributors Plugin')
# Test ability to list contributions # Test ability to list contributions
# Verify that when a single command contribution has been made, # As of 2019-10-19 there is no more distinction between commands and non-commands
# the word "command" is properly not pluralized. self.assertRegexp('contributors Plugin skorobeus', 'original contributors command')
# Note: This will break if the listed person ever makes more than
# one contribution to the Plugin plugin # TODO: test handling of a person with multiple contributions to a command
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'
# Test handling of invalid plugin # Test handling of invalid plugin
self.assertRegexp('contributors InvalidPlugin', 'not a valid 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', self.assertRegexp('contributors Plugin noname',
'not a registered contributor') 'not listed as a 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
self.assertRegexp('contributors Plugin bwp', self.assertRegexp('contributors Plugin bwp',
'listed as a contributor') 'not listed as a contributor')
def testContributorsIsCaseInsensitive(self): def testContributorsIsCaseInsensitive(self):
self.assertNotError('contributors Plugin Skorobeus') 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') grantbow = Author('Grant Bowman', 'Grantbow', 'grantbow@grantbow.com')
stepnem = Author('Štěpán Němec', 'stepnem', 'stepnem@gmail.com') stepnem = Author('Štěpán Němec', 'stepnem', 'stepnem@gmail.com')
progval = Author('Valentin Lorentz', 'ProgVal', 'progval@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') unknown = Author('Unknown author', 'unknown', 'unknown@email.invalid')
# Let's be somewhat safe about this. # Let's be somewhat safe about this.