Ejemplo n.º 1
0
 def testZsqlInsertWithRollback(self):
     self.createDA()
     template = "INSERT INTO test (id, text) VALUES (07, 'bar')"
     manage_addZSQLMethod(self.app, 'zsql_id', 'title', 'da', '', template)
     self.app['zsql_id']()
     transaction.abort()
     rows = self.session.query(Test).all()
     self.assertEqual(len(rows), 0)
 def testZsqlInsertWithRollback(self):
     self.createDA()
     template = "INSERT INTO test (id, text) VALUES (07, 'bar')"
     manage_addZSQLMethod(self.app, 'zsql_id', 'title', 'da', '', template)
     self.app['zsql_id']()
     transaction.abort()
     rows = self.session.query(Test).all()
     self.assertEqual(len(rows), 0)
Ejemplo n.º 3
0
 def testZsqlInsertWithCommit(self):
     self.createDA()
     template = "INSERT INTO test (id, text) VALUES (07, 'bar')"
     manage_addZSQLMethod(self.app, 'zsql_id', 'title', 'da', '', template)
     self.app['zsql_id']()
     self.publish(self.folder_path)
     rows = self.session.query(Test).all()
     self.assertEqual(len(rows), 1)
 def testZsqlInsertWithCommit(self):
     self.createDA()
     template = "INSERT INTO test (id, text) VALUES (07, 'bar')"
     manage_addZSQLMethod(self.app, 'zsql_id', 'title', 'da', '', template)
     self.app['zsql_id']()
     self.publish(self.folder_path)
     rows = self.session.query(Test).all()
     self.assertEqual(len(rows), 1)
Ejemplo n.º 5
0
    def test_zsql_method(self):
        conn = self.db.open()
        try:
            app = conn.root()['Application']
            template = 'SELECT <dtml-var foo> from <dtml-var bar>'
            manage_addZSQLMethod(app, 'm', 'test sql', 'none', 'foo bar',
                                 template)
            transaction.commit()

            conn2 = self.db.open()
            try:
                app = conn2.root()['Application']
                m = app.m
                self.assertEqual(m.title, 'test sql')
                self.assertEqual(m._arg._keys, ['foo', 'bar'])
                self.assertEqual(m.src, template)
            finally:
                conn2.close()

        finally:
            conn.close()
Ejemplo n.º 6
0
    def test_zsql_method(self):
        conn = self.db.open()
        try:
            app = conn.root()['Application']
            template = 'SELECT <dtml-var foo> from <dtml-var bar>'
            manage_addZSQLMethod(app, 'm', 'test sql', 'none', 'foo bar',
                                 template)
            transaction.commit()

            conn2 = self.db.open()
            try:
                app = conn2.root()['Application']
                m = app.m
                self.assertEqual(m.title, 'test sql')
                self.assertEqual(m._arg._keys, ['foo', 'bar'])
                self.assertEqual(m.src, template)
            finally:
                conn2.close()

        finally:
            conn.close()
 def testZsqlSelect(self):
     da = self.createDA()
     template = "SELECT SYSDATE FROM DUAL"
     manage_addZSQLMethod(self.app, 'zsql_id', 'title', 'da', '', template)
     self.app['zsql_id']()
     self.publish(self.folder_path)
 def testZsqlSelect(self):
     da = self.createDA()
     template = "SELECT SYSDATE FROM DUAL"
     manage_addZSQLMethod(self.app, 'zsql_id', 'title', 'da', '', template)
     self.app['zsql_id']()
     self.publish(self.folder_path)