aboutsummaryrefslogtreecommitdiffstats
path: root/local/testing
diff options
context:
space:
mode:
authorkongr45gpen <electrovesta@gmail.com>2014-05-11 13:52:29 +0300
committerkongr45gpen <electrovesta@gmail.com>2014-05-11 13:54:26 +0300
commit9b117389606bbe5c398c52bf7001c0324ba83183 (patch)
treef1bc94fef6b6ffa5c1587481d41306473e02a49b /local/testing
parent32f28055bd0e6368f0b13c8d40e9fc11e18b8cef (diff)
downloadsupybot_github-9b117389606bbe5c398c52bf7001c0324ba83183.tar.gz
supybot_github-9b117389606bbe5c398c52bf7001c0324ba83183.tar.bz2
supybot_github-9b117389606bbe5c398c52bf7001c0324ba83183.zip
Handle travis hook messages
Diffstat (limited to 'local/testing')
-rw-r--r--local/testing/ExpectationPluginTestCase.py23
1 files changed, 20 insertions, 3 deletions
diff --git a/local/testing/ExpectationPluginTestCase.py b/local/testing/ExpectationPluginTestCase.py
index af6e56d..9027927 100644
--- a/local/testing/ExpectationPluginTestCase.py
+++ b/local/testing/ExpectationPluginTestCase.py
@@ -2,6 +2,8 @@
from supybot.log import info
from supybot.test import *
+from copy import deepcopy
+
from sys import stdout
from time import sleep
@@ -40,7 +42,7 @@ class ExpectationPluginTestCase(PluginTestCase):
for error in errors:
print "- Failed to assert that %s" % (error,)
print tcolors.ENDC
- self.fail()
+ self.fail("%i assertions failed while describing %s" % (len(errors), query))
def sendRequest(self, file):
""" Opens the `samples` folder and sends a file as a request
@@ -87,11 +89,22 @@ def it():
class Expectation:
def __init__(self):
self.error = ''
+ self.negation = False
+
self.should = self
self.to = self
+ self.should_not = self.negate()
def evaluate(self):
- return self.assertion()
+ if self.negation is True:
+ return not self.assertion()
+ else:
+ return self.assertion()
+
+ def negate(self):
+ other = deepcopy(self)
+ other.negation = not other.negation
+ return other
def cleanReply(self):
return clean(self.reply)
@@ -105,7 +118,11 @@ class Expectation:
def contain(self, what):
self.assertion = self.contains
self.assertionParameter = what
- self.summary = "'%s' contains '%s'"
+ if self.negation:
+ verb = "does not contain"
+ else:
+ verb = "contains"
+ self.summary = "'%s' " +verb+ " '%s'"
return self
def contains(self, flags=re.I):

© 2014-2024 Faster IT GmbH | imprint | privacy policy