~yeliabmas/sloecode/wiki-merge-proposal

« back to all changes in this revision

Viewing changes to sloecode/tests/__init__.py

Merged code to improve unit tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
from paste.script.appinstall import SetupCommand
13
13
from pylons import url
14
14
from routes.util import URLGenerator
 
15
from sloecode.model.meta import Session, Base, engine
15
16
from webtest import TestApp
16
17
 
17
18
import pylons.test
32
33
        self.app = TestApp(wsgiapp)
33
34
        url._push_object(URLGenerator(config['routes.map'], environ))
34
35
        TestCase.__init__(self, *args, **kwargs)
 
36
 
 
37
 
 
38
class SloecodeTestCase(TestCase):
 
39
 
 
40
    def setUp(self):
 
41
        # create all DB tables:
 
42
        Base.metadata.create_all(engine)
 
43
 
 
44
    def tearDown(self):
 
45
        # remove all DB tables.
 
46
        Base.metadata.drop_all(engine)
 
47
        # remove session - avoids a memory leak, apparently.
 
48
        Session.remove()