summaryrefslogtreecommitdiff
path: root/src/leap/mx/tests/tester.py
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2015-09-11 11:43:31 +0200
committerRuben Pollan <meskio@sindominio.net>2015-09-11 11:43:31 +0200
commit5f2f8a65aba2672ae6661052af2f735ba17ad7a5 (patch)
tree928840a56258767619f0f488b8f13b05f8aebc68 /src/leap/mx/tests/tester.py
parentb988fcb56a2548e114f6bbcb3bb43bdfb5f61fdc (diff)
[feat] Don't add any X-Leap-Provenance header
- Resolves: #7439
Diffstat (limited to 'src/leap/mx/tests/tester.py')
-rw-r--r--src/leap/mx/tests/tester.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/leap/mx/tests/tester.py b/src/leap/mx/tests/tester.py
new file mode 100644
index 0000000..05d2d05
--- /dev/null
+++ b/src/leap/mx/tests/tester.py
@@ -0,0 +1,46 @@
+import ConfigParser
+import sys
+import os
+
+from twisted.internet import reactor, defer
+from twisted.python import filepath, log
+
+from leap.mx import couchdbhelper
+from leap.mx.mail_receiver import MailReceiver
+
+if __name__ == "__main__":
+ log.startLogging(sys.stdout)
+ fullpath = os.path.realpath(sys.argv[1])
+
+ log.msg("Starting test for %s..." % (fullpath,))
+
+ config_file = "/etc/leap/mx.conf"
+
+ config = ConfigParser.ConfigParser()
+ config.read(config_file)
+
+ user = config.get("couchdb", "user")
+ password = config.get("couchdb", "password")
+
+ server = config.get("couchdb", "server")
+ port = config.get("couchdb", "port")
+
+ cdb = couchdbhelper.ConnectedCouchDB(server,
+ port=port,
+ dbName="identities",
+ username=user,
+ password=password)
+
+ # Mail receiver
+ mail_couch_url_prefix = "http://%s:%s@%s:%s" % (user,
+ password,
+ server,
+ port)
+
+ mr = MailReceiver(mail_couch_url_prefix, cdb, [])
+ fpath = filepath.FilePath(fullpath)
+
+ d = mr._process_incoming_email(None, fpath, 0)
+ d.addCallback(lambda x: reactor.stop())
+
+ reactor.run()