Mercurial > sjsbox
view tests/test_server.py @ 4:0203cae3947f
Added Bunch, improved tests
author | Atul Varma <avarma@mozilla.com> |
---|---|
date | Mon, 31 May 2010 10:23:11 -0700 |
parents | b935781e3f89 |
children | ebeab25bca50 |
line wrap: on
line source
import unittest import sjsbox.server from sjsbox.bunch import Bunch class ServerTests(unittest.TestCase): def test_boxes(self): foo = Bunch( mtime = 0, name = 'foo.js', contents = 'function handle() { return 404; }' ) boxes = sjsbox.server.Boxes([foo]) try: self.assertEqual(boxes['foo'].handle('GET', '/'), 404) boxes.update() self.assertEqual(boxes['foo'].handle('GET', '/'), 404) foo.mtime = 1 foo.contents = 'function handle() { return "yo"; }'; boxes.update() self.assertEqual(boxes['foo'].handle('GET', '/'), u'yo') finally: boxes.shutdown() def test_app(): sjsbox.server.App(None)