diff --git a/tests/setup.py b/tests/setup.py new file mode 100644 index 0000000..cfc7f77 --- /dev/null +++ b/tests/setup.py @@ -0,0 +1,61 @@ +import os +import time +import shutil +import tempfile +import subprocess + +class Testobject: + bindir = None + vardir = None + cfgfile = None + +def setup_mm(testobject): + os.environ['MAILMAN_TEST_BINDIR'] = '/home/florian/Development/mailman/bin' + bindir = testobject.bindir = os.environ.get('MAILMAN_TEST_BINDIR') + if bindir is None: + raise RuntimeError("something's not quite right") + vardir = testobject.vardir = tempfile.mkdtemp() + cfgfile = testobject.cfgfile = os.path.join(vardir, 'client_test.cfg') + with open(cfgfile, 'w') as fp: + print >> fp, """\ +[mailman] +layout: tmpdir +[paths.tmpdir] +var_dir: {vardir} +log_dir: /tmp/mmclient/logs +[qrunner.archive] +start: no +[qrunner.bounces] +start: no +[qrunner.command] +start: no +[qrunner.in] +start: no +[qrunner.lmtp] +start: no +[qrunner.news] +start: no +[qrunner.out] +start: no +[qrunner.pipeline] +start: no +[qrunner.retry] +start: no +[qrunner.virgin] +start: no +[qrunner.digest] +start: no +""".format(vardir=vardir) + mailman = os.path.join(bindir, 'mailman') + subprocess.call([mailman, '-C', cfgfile, 'start', '-q']) + time.sleep(3) + return testobject + +def teardown_mm(testobject): + bindir = testobject.bindir + cfgfile = testobject.cfgfile + vardir = testobject.vardir + mailman = os.path.join(bindir, 'mailman') + subprocess.call([mailman, '-C', cfgfile, 'stop', '-q']) + shutil.rmtree(vardir) + time.sleep(3) diff --git a/tests/tests.py b/tests/tests.py index 6b4a424..779662b 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -24,6 +24,8 @@ This document both acts as a test for all the functions implemented in the UI as well as documenting what has been done. + >>> from setup import setup_mm, Testobject, teardown_mm + >>> testobject = setup_mm(Testobject()) Getting Started =============== @@ -119,8 +121,9 @@ We should now end up on a success page offering what to do next. Let's check that this was the case. - >>> print "What would you like to do next?" in response.content - True #TODO:Duplication Bug needs test DB + >>> print "What would you like to do next?" in response.content #TODO:Duplication Bug needs test DB + True + Three options appear on this page. The first one is to mass subscribe users, the second is to go to the settings page of the list just @@ -177,4 +180,6 @@ True TODO: Delete Domains + + >>> teardown_mm(testobject) """