Test suite runs and passes!
[zzz-floof.git] / floof / tests / test_models.py
index e69de29..ccd2a41 100644 (file)
@@ -0,0 +1,22 @@
+from sqlalchemy.exceptions import IntegrityError
+from floof.model import User
+from floof.model.meta import Session
+from floof.tests import *
+
+class TestMyModel(TestModel):
+
+    def test_simpleassert(self):
+        """test description
+        """
+        einstein = User(name=u'einstein', display_name=u'Einstein')
+        Session.commit()
+
+        user1 = User.get_by(name = u'einstein')
+        assert user1 == einstein
+
+    def test_exception(self):
+        me = User(name=u'giuseppe', display_name=u'giuseppe')
+        me_again = User(name=u'giuseppe', display_name=u'giuseppe')
+        self.assertRaises(IntegrityError, Session.commit)
+        Session.rollback()
+