Make User.name unique.
[zzz-floof.git] / floof / tests / test_models.py
1 from sqlalchemy.exceptions import IntegrityError
2 from floof.tests import *
3 from floof.tests import Session, metadata, Individual, create_all, drop_all
4
5 class TestMyModel(TestModel):
6
7 def test_simpleassert(self):
8 """test description
9 """
10 einstein = Individual('einstein')
11
12 Session.commit()
13
14 ind1 = Individual.get_by(name = 'einstein')
15 assert ind1 == einstein
16
17 def test_exception(self):
18 me = Individual('giuseppe')
19 me_again = Individual('giuseppe')
20 self.assertRaises(IntegrityError, Session.commit)
21 Session.rollback()
22