Test suite runs and passes!
[zzz-floof.git] / floof / tests / test_models.py
1 from sqlalchemy.exceptions import IntegrityError
2 from floof.model import User
3 from floof.model.meta import Session
4 from floof.tests import *
5
6 class TestMyModel(TestModel):
7
8 def test_simpleassert(self):
9 """test description
10 """
11 einstein = User(name=u'einstein', display_name=u'Einstein')
12 Session.commit()
13
14 user1 = User.get_by(name = u'einstein')
15 assert user1 == einstein
16
17 def test_exception(self):
18 me = User(name=u'giuseppe', display_name=u'giuseppe')
19 me_again = User(name=u'giuseppe', display_name=u'giuseppe')
20 self.assertRaises(IntegrityError, Session.commit)
21 Session.rollback()
22