unitstorm 0.1.1

Unit testing microframework for Storm ORM models

  Add it to your Download Basket!

 Add it to your Watch List!

0/5

Rate it!
send us
an update
LICENSE TYPE:
LGPL v2 (GNU Lesser General Public Lic... 
USER RATING:
UNRATED
  0.0/5
DEVELOPED BY:
Vsevolod Balashov
HOMEPAGE:
pypi.python.org
CATEGORY:
ROOT \ Programming \ Quality Assurance and Testing
Storm is a small, fast and powerful object-relational mapper. Try it to use in db-aware applications.

Effective unit-testing DB-models needed:

 * easy access to testing-DB inside testcases
 * setting up testing-DB before each test (and tear down after)

To help this unitstorm provides class ModelTestCase, that can be used both in unittest and nosetest testing frameworks.

Simple example

from unitstorm import ModelTestCase
from os import path

import models as model # models define somewhere else

class TestMyModel(ModelTestCase):
 dburi = 'postgres://test:test@localhost/test'

 fixtures = path.join(path.dirname(__file__), 'fixtures')

 fixture_setup = 'create.sql', 'filldata.sql'
 fixture_teardown = 'drop.sql'

 sql_setup = 'INSERT INTO my_model (id, name) VALUES (1, "foo");',\
 'INSERT INTO my_model (id, name) VALUES (2, "bar");'
 sql_teardown = 'DELETE FROM my_model WHERE id = 1;'

 def test_stub(self):
 assert self.store.get(model.MyModel, 1).name == "foo"

Last updated on July 7th, 2010

requirements

#unit testing #Storm models #Storm #models #testing #ORM

Add your review!

SUBMIT