Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: coala/corobo
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b0e5fb355d10e767aedd801faab6924ad9cf7e25
Choose a base ref
..
head repository: coala/corobo
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 112fbb4e2fc65a75028f49f678fe1c5abf074fa5
Choose a head ref
Showing with 45 additions and 38 deletions.
  1. +2 −2 tests/ghetto_test.py
  2. +1 −1 tests/lmgtfy_test.py
  3. +10 −9 tests/nevermind_test.py
  4. +2 −1 tests/ship_it_test.py
  5. +30 −25 tests/spam_test.py
4 changes: 2 additions & 2 deletions tests/ghetto_test.py
Original file line number Diff line number Diff line change
@@ -8,8 +8,8 @@ class GhettoTest(IsolatedTestCase):

@vcr.use_cassette('tests/cassettes/ghetto.yaml')
def test_ghetto(self):
self.assertCommand("!ghetto hi, whats up?", "hi, wassup?")
self.assertCommand('!ghetto hi, whats up?', 'hi, wassup?')
with requests_mock.Mocker() as m:
m.register_uri('POST', 'http://www.gizoogle.net/textilizer.php',
text='test text which will not match with the regex')
self.assertCommand("!ghetto ...", "Shiznit happens!")
self.assertCommand('!ghetto ...', 'Shiznit happens!')
2 changes: 1 addition & 1 deletion tests/lmgtfy_test.py
Original file line number Diff line number Diff line change
@@ -9,4 +9,4 @@
class LmgtfyTest(IsolatedTestCase):

def test_lmgtfy(self):
self.assertCommand("!lmgtfy py c", "https://www.lmgtfy.com/?q=py c")
self.assertCommand('!lmgtfy py c', 'https://www.lmgtfy.com/?q=py c')
19 changes: 10 additions & 9 deletions tests/nevermind_test.py
Original file line number Diff line number Diff line change
@@ -2,13 +2,14 @@


class NevermindTest(IsolatedTestCase):

def test_nevermind(self):
self.assertCommand("!nevermind", "I'm sorry :(")
self.assertCommand("!nm", "I'm sorry :(")
self.assertCommand("!nEverMINd", "I'm sorry :(")
self.assertCommand("!nM", "I'm sorry :(")
self.assertCommand("!nmxyz", 'Command "nmxyz" not found.')
self.assertCommand("!hey nM", 'Command "hey" / "hey nM" not found.')
self.assertCommand("!nevermindxyz", 'Command "nevermindxyz" not found.')
self.assertCommand(
"!hey nEverMINd", 'Command "hey" / "hey nEverMINd" not found.')
self.assertCommand('!nevermind', 'I\'m sorry :(')
self.assertCommand('!nm', 'I\'m sorry :(')
self.assertCommand('!nEverMINd', 'I\'m sorry :(')
self.assertCommand('!nM', 'I\'m sorry :(')
self.assertCommand('!nmxyz', 'Command "nmxyz" not found.')
self.assertCommand('!hey nM', 'Command "hey" / "hey nM" not found.')
self.assertCommand('!nevermindxyz', 'Command "nevermindxyz" not found.')
self.assertCommand('!hey nEverMINd',
'Command "hey" / "hey nEverMINd" not found.')
3 changes: 2 additions & 1 deletion tests/ship_it_test.py
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@


class ShipItTest(IsolatedTestCase):

def test_ship_it(self):
text = errbot.rendering.text()
self.assertCommand("!shipit", text.convert("![ship it!]()"))
self.assertCommand('!shipit', text.convert('![ship it!]()'))
55 changes: 30 additions & 25 deletions tests/spam_test.py
Original file line number Diff line number Diff line change
@@ -5,21 +5,25 @@

class TestSpam(IsolatedTestCase):

def setUp(self):
super().setUp()
self.testbot = self

def test_spam_callback(self):
self.assertCommand('c'*1001, 'you\'re spamming')
self.assertCommand('\n\n'*11, 'you\'re spamming')
self.testbot.assertCommand('c'*1001, 'you\'re spamming')
self.testbot.assertCommand('\n\n'*11, 'you\'re spamming')

def test_spam_configuration(self):
self.assertCommand('!plugin config SpammingAlert '
'{\'MAX_LINES\': 10}',
'configuration done')
self.assertCommand('!plugin config SpammingAlert',
'{\'MAX_LINES\': 10}')
self.assertCommand('!plugin config SpammingAlert '
'{\'MAX_LINES\': 20, \'MAX_MSG_LEN\': 200}',
'configuration done')
self.assertCommand('!plugin config SpammingAlert',
'{\'MAX_LINES\': 20, \'MAX_MSG_LEN\': 200}')
self.testbot.assertCommand('!plugin config SpammingAlert '
'{\'MAX_LINES\': 10}',
'configuration done')
self.testbot.assertCommand('!plugin config SpammingAlert',
'{\'MAX_LINES\': 10}')
self.testbot.assertCommand('!plugin config SpammingAlert '
'{\'MAX_LINES\': 20, \'MAX_MSG_LEN\': 200}',
'configuration done')
self.testbot.assertCommand('!plugin config SpammingAlert',
'{\'MAX_LINES\': 20, \'MAX_MSG_LEN\': 200}')


class TestSpamExtraConfig(IsolatedTestCase):
@@ -34,23 +38,24 @@ def setUp(self):
}
}
super().setUp(extra_config=extra_config)
self.testbot = self

def test_spam_extra_config_callback(self):
self.assertCommand('c'*501, 'you\'re spamming')
self.assertCommand('\n'*6, 'you\'re spamming')
self.testbot.assertCommand('c'*501, 'you\'re spamming')
self.testbot.assertCommand('\n'*6, 'you\'re spamming')
# Since the message is not a spam, testbot will timeout
# waiting for a response
with self.assertRaises(queue.Empty):
self.assertCommand('Not a spam', 'you\'re spamming')
self.testbot.assertCommand('Not a spam', 'you\'re spamming')

def test_spam_extra_config_configuration(self):
self.assertCommand('!plugin config SpammingAlert '
'{\'MAX_LINES\': 10}',
'configuration done')
self.assertCommand('!plugin config SpammingAlert',
'{\'MAX_LINES\': 10}')
self.assertCommand('!plugin config SpammingAlert '
'{\'MAX_LINES\': 20, \'MAX_MSG_LEN\': 200}',
'configuration done')
self.assertCommand('!plugin config SpammingAlert',
'{\'MAX_LINES\': 20, \'MAX_MSG_LEN\': 200}')
self.testbot.assertCommand('!plugin config SpammingAlert '
'{\'MAX_LINES\': 10}',
'configuration done')
self.testbot.assertCommand('!plugin config SpammingAlert',
'{\'MAX_LINES\': 10}')
self.testbot.assertCommand('!plugin config SpammingAlert '
'{\'MAX_LINES\': 20, \'MAX_MSG_LEN\': 200}',
'configuration done')
self.testbot.assertCommand('!plugin config SpammingAlert',
'{\'MAX_LINES\': 20, \'MAX_MSG_LEN\': 200}')