From 1caa029bf254c2119a308f06e40cb79ef6aae5f5 Mon Sep 17 00:00:00 2001
From: Martijn Vermaat <martijn@vermaat.name>
Date: Tue, 13 Sep 2011 12:02:36 +0000
Subject: [PATCH] Use test mail address in batch unit tests

git-svn-id: https://humgenprojects.lumc.nl/svn/mutalyzer/branches/refactor-mutalyzer-branch@358 eb6bd6ab-9ccd-42b9-aceb-e2899b4a52f1
---
 mutalyzer/Scheduler.py | 8 ++++++++
 tests/test_website.py  | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/mutalyzer/Scheduler.py b/mutalyzer/Scheduler.py
index 005864db..cc10261d 100644
--- a/mutalyzer/Scheduler.py
+++ b/mutalyzer/Scheduler.py
@@ -103,6 +103,14 @@ class Scheduler() :
         if mutalyzer.is_test():
             return
 
+        # Note: The above check with mutalyzer.is_test is bogus, since during
+        # a normal unit test, the batch checker process is not started in the
+        # environment of the unit tests.
+        # As sort of a hack, we therefore check for the patented address
+        # 'test@test.test', used in the unit tests.
+        if mailTo == 'test@test.test':
+            return
+
         #TODO: Handle Connection errors in a try, except clause
         #Expected errors: socket.error
 
diff --git a/tests/test_website.py b/tests/test_website.py
index ead0e93f..44abe1dd 100644
--- a/tests/test_website.py
+++ b/tests/test_website.py
@@ -284,7 +284,7 @@ class TestWSGI():
         if arg1:
             form['arg1'] = arg1
         form['batchType'] = batch_type
-        form['batchEmail'] = 'm.vermaat.hg@lumc.nl'
+        form['batchEmail'] = 'test@test.test'
         form.set('batchFile', ('test_%s.txt' % batch_type,
                                file))
         r = form.submit()
-- 
GitLab