1 from sqlalchemy
.exceptions
import IntegrityError
2 from floof
.model
import User
3 from floof
.model
.meta
import Session
4 from floof
.tests
import *
6 class TestMyModel(TestModel
):
8 def test_simpleassert(self
):
11 einstein
= User(name
=u
'einstein', display_name
=u
'Einstein')
14 user1
= User
.get_by(name
= u
'einstein')
15 assert user1
== einstein
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
)