@fudge.patch('samples.model.meta.Session') def test_add_user_commit_exception(FakeSession): FakeSession.provides('query').returns(1).provides("filter").returns_fake().\ provides("all").returns_fake() FakeSession.provides('commit').raises(ValueError("Commit excepion!")) FakeSession.expects("rollback").returns_fake() try: user.add_user("name") except Exception, ex: pass
Saturday, March 12, 2011
mock a rollback in pylons unit testing
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment