[pypy-svn] buildbot default: test the behaviour of the irc message sender

RonnyPfannschmidt commits-noreply at bitbucket.org
Wed Apr 20 15:54:03 CEST 2011


Author: Ronny Pfannschmidt <Ronny.Pfannschmidt at gmx.de>
Branch: 
Changeset: r482:9e68e0dd7772
Date: 2011-04-20 11:33 +0200
http://bitbucket.org/pypy/buildbot/changeset/9e68e0dd7772/

Log:	test the behaviour of the irc message sender

diff --git a/bitbucket_hook/test/test_irc.py b/bitbucket_hook/test/test_irc.py
--- a/bitbucket_hook/test/test_irc.py
+++ b/bitbucket_hook/test/test_irc.py
@@ -1,5 +1,5 @@
-from bitbucket_hook.irc import getpaths
-
+from bitbucket_hook import irc
+import subprocess
 
 def fl(*paths):
     return [{'file': x} for x in paths]
@@ -77,6 +77,19 @@
 
 
 def test_getpaths(files, expected_common, expected_listfiles):
-    common, files = getpaths(files, listfiles=bool(expected_listfiles))
+    common, files = irc.getpaths(files, listfiles=bool(expected_listfiles))
     assert common == expected_common
     assert files == expected_listfiles
+
+def test_send_message(monkeypatch):
+    monkeypatch.undo()  # hack to get at the functions
+
+    # gets called in normal mode
+    monkeypatch.setattr(subprocess, 'call', lambda *k, **kw: None)
+    irc.send_message('test')
+
+    # doesnt get called in test mode
+    monkeypatch.setattr(subprocess, 'call', lambda: None)
+    irc.send_message('test', test=True)
+
+


More information about the Pypy-commit mailing list