def setUp(self): self.mox = mox.Mox() drop_db() init_db() super(ParticipantApiTest, self).setUp()
def setUp(self): self.mox = mox.Mox() drop_db() init_db() super(DojoToHttpTest, self).setUp()
from tornado.testing import AsyncHTTPTestCase from tornado.web import Application from tornado.options import parse_config_file, parse_command_line, options from dojoapp import DojoApp from tornado import database from testutils import init_db, drop_db APP_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".")) sys.path.append(os.path.join(APP_ROOT, ".")) parse_config_file(os.getenv("HOME") + "/.dojo_to.conf") drop_db() init_db() class AccessTest(AsyncHTTPTestCase): def get_app(self): return DojoApp(options) def test_homepage(self): response = self.fetch("/") self.assertEquals(200, response.code) self.assertNotRegexpMatches(response.body, r"None") def test_dojos(self): response = self.fetch("/dojos") self.assertEquals(200, response.code) self.assertRegexpMatches(response.body, r"<title>.+</title>")