summaryrefslogtreecommitdiff
path: root/test/zblog/tests.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-07-27 04:08:53 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-07-27 04:08:53 +0000
commited4fc64bb0ac61c27bc4af32962fb129e74a36bf (patch)
treec1cf2fb7b1cafced82a8898e23d2a0bf5ced8526 /test/zblog/tests.py
parent3a8e235af64e36b3b711df1f069d32359fe6c967 (diff)
downloadsqlalchemy-ed4fc64bb0ac61c27bc4af32962fb129e74a36bf.tar.gz
merging 0.4 branch to trunk. see CHANGES for details. 0.3 moves to maintenance branch in branches/rel_0_3.
Diffstat (limited to 'test/zblog/tests.py')
-rw-r--r--test/zblog/tests.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/test/zblog/tests.py b/test/zblog/tests.py
index e538cff9d..ad6876937 100644
--- a/test/zblog/tests.py
+++ b/test/zblog/tests.py
@@ -1,20 +1,20 @@
-from testbase import AssertMixin
import testbase
-import unittest
-db = testbase.db
from sqlalchemy import *
-
+from sqlalchemy.orm import *
+from testlib import *
from zblog import mappers, tables
from zblog.user import *
from zblog.blog import *
+
class ZBlogTest(AssertMixin):
def create_tables(self):
- tables.metadata.create_all(connectable=db)
+ tables.metadata.drop_all(bind=testbase.db)
+ tables.metadata.create_all(bind=testbase.db)
def drop_tables(self):
- tables.metadata.drop_all(connectable=db)
+ tables.metadata.drop_all(bind=testbase.db)
def setUpAll(self):
self.create_tables()
@@ -31,7 +31,7 @@ class SavePostTest(ZBlogTest):
super(SavePostTest, self).setUpAll()
mappers.zblog_mappers()
global blog_id, user_id
- s = create_session(bind_to=db)
+ s = create_session(bind=testbase.db)
user = User('zbloguser', "Zblog User", "hello", group=administrator)
blog = Blog(owner=user)
blog.name = "this is a blog"
@@ -50,9 +50,9 @@ class SavePostTest(ZBlogTest):
"""test that a transient/pending instance has proper bi-directional behavior.
this requires that lazy loaders do not fire off for a transient/pending instance."""
- s = create_session(bind_to=db)
+ s = create_session(bind=testbase.db)
- trans = s.create_transaction()
+ s.begin()
try:
blog = s.query(Blog).get(blog_id)
post = Post(headline="asdf asdf", summary="asdfasfd")
@@ -61,14 +61,14 @@ class SavePostTest(ZBlogTest):
post.blog = blog
assert post in blog.posts
finally:
- trans.rollback()
+ s.rollback()
def testoptimisticorphans(self):
"""test that instances in the session with un-loaded parents will not
get marked as "orphans" and then deleted """
- s = create_session(bind_to=db)
+ s = create_session(bind=testbase.db)
- trans = s.create_transaction()
+ s.begin()
try:
blog = s.query(Blog).get(blog_id)
post = Post(headline="asdf asdf", summary="asdfasfd")
@@ -90,10 +90,10 @@ class SavePostTest(ZBlogTest):
assert s.query(Post).get(post.id) is not None
finally:
- trans.rollback()
+ s.rollback()
if __name__ == "__main__":
testbase.main()
- \ No newline at end of file
+