Skip to content
Browse files

RatingSystem: return replies rather than errors when there's no data.

  • Loading branch information...
1 parent 53b88b2 commit f3bc32a6a4484366aeb8d413a8d7e39034a3ed12 Daniel Folkinshteyn committed Feb 26, 2012
Showing with 5 additions and 5 deletions.
  1. +2 −2 RatingSystem/plugin.py
  2. +3 −3 RatingSystem/test.py
View
4 RatingSystem/plugin.py
@@ -355,7 +355,7 @@ def rated(self, irc, msg, args, nick):
sourcenick = msg.nick
data = self.db.getRatingDetail(sourcenick, nick)
if len(data) == 0:
- irc.error("You have not yet rated user %s" % nick)
+ irc.reply("You have not yet rated user %s" % (nick,))
return
data = data[0]
irc.reply("You rated user %s on %s, giving him a rating of %s, and "
@@ -417,7 +417,7 @@ def getrating(self, irc, msg, args, nick):
authstatus = " Currently not authenticated."
data = self.db.get(nick)
if len(data) == 0:
- irc.error("This user has not yet been rated." + authstatus)
+ irc.reply("This user has not yet been rated." + authstatus)
return
data = data[0]
irc.reply("User %s, created on %s. "
View
6 RatingSystem/test.py
@@ -97,7 +97,7 @@ def testRate(self):
self.assertRegexp('getrating nanotube', 'Sent ratings.*1 negative')
self.assertNotError('rate registeredGUY 5')
self.assertRegexp('getrating registeredguy', 'Cumulative rating 14')
- self.assertError('rated nobody')
+ self.assertRegexp('rated nobody', 'not yet rated')
self.assertRegexp('rated registeredguy', 'You rated user registeredguy .* giving him a rating of 5')
finally:
self.prefix = origuser
@@ -111,7 +111,7 @@ def testUnrate(self):
self.assertNotError('rate registeredguy 4')
self.assertRegexp('getrating registeredguy', 'Cumulative rating 4')
self.assertNotError('unrate regISTEredguy')
- self.assertError('getrating registeredguy') # guy should be gone, having no connections.
+ self.assertRegexp('getrating registeredguy', 'not yet been rated') # guy should be gone, having no connections.
finally:
self.prefix = origuser
@@ -152,7 +152,7 @@ def testDeleteUser(self):
self.assertNotError('rate registeredguy 4')
self.assertRegexp('getrating registeredguy', 'Cumulative rating 4')
self.assertNotError('deleteuser registeredGUy')
- self.assertError('getrating registeredguy') # guy should be gone
+ self.assertRegexp('getrating registeredguy', 'not yet been rated') # guy should be gone
finally:
self.prefix = origuser

0 comments on commit f3bc32a

Please sign in to comment.
Something went wrong with that request. Please try again.