def test_sqla_table_addrec_create_multi(self): from ptah.manage.sqla import SQLAModule, AddRecord request = DummyRequest() mod = SQLAModule(None, request) table = mod['psqla-test_sqla_table'] request = DummyRequest( POST={'form.buttons.createmulti': 'Create'}) form = AddRecord(table, request) form.csrf = False form.update() self.assertIn('Please fix indicated errors', ptah.view.render_messages(request)) request = DummyRequest( POST={'form.buttons.createmulti': 'Create', 'name': 'Test multi'}) form = AddRecord(table, request) form.csrf = False form.update() self.assertIn('Table record has been created.', ptah.view.render_messages(request)) rec = ptah.cms.Session.query(TestSqlaModuleTable).first() self.assertEqual(rec.name, 'Test multi')
def test_sqla_table_addrec_create_multi(self): from ptah.manage.sqla import SQLAModule, AddRecord request = DummyRequest() mod = SQLAModule(None, request) table = mod['psqla-test_sqla_table'] request = DummyRequest(POST={'form.buttons.createmulti': 'Create'}) form = AddRecord(table, request) form.csrf = False form.update() self.assertIn('Please fix indicated errors', ptah.view.render_messages(request)) request = DummyRequest(POST={ 'form.buttons.createmulti': 'Create', 'name': 'Test multi' }) form = AddRecord(table, request) form.csrf = False form.update() self.assertIn('Table record has been created.', ptah.view.render_messages(request)) rec = ptah.cms.Session.query(TestSqlaModuleTable).first() self.assertEqual(rec.name, 'Test multi')
def test_sqla_table_addrec_create(self): from ptah.manage.sqla import SQLAModule, AddRecord request = DummyRequest() mod = SQLAModule(None, request) table = mod['psqla-test_sqla_table'] request = DummyRequest( session = {}, POST={'form.buttons.create': 'Create'}) form = AddRecord(table, request) form.csrf = False form.update() self.assertIn('Please fix indicated errors', request.session['msgservice'][0]) request = DummyRequest( session = {}, POST={'form.buttons.create': 'Create', 'name': 'Test'}) form = AddRecord(table, request) form.csrf = False try: form.update() except Exception, res: pass
def test_sqla_table_addrec_basics(self): from ptah.manage.sqla import SQLAModule, AddRecord request = DummyRequest() mod = SQLAModule(None, request) table = mod['psqla-test_sqla_table'] form = AddRecord(table, request) form.update() self.assertEqual(form.label, 'test_sqla_table: new record') request = DummyRequest(POST={'form.buttons.back': 'Back'}) form = AddRecord(table, request) res = form.update() self.assertIsInstance(res, HTTPFound) self.assertEqual(res.headers['location'], '.')
def test_sqla_table_addrec_basics(self): from ptah.manage.sqla import SQLAModule, AddRecord request = DummyRequest() mod = SQLAModule(None, request) table = mod['psqla-test_sqla_table'] form = AddRecord(table, request) form.update() self.assertEqual(form.label, 'test_sqla_table: new record') request = DummyRequest( POST={'form.buttons.back': 'Back'}) form = AddRecord(table, request) res = form.update() self.assertIsInstance(res, HTTPFound) self.assertEqual(res.headers['location'], '.')
def test_sqla_table_addrec_basics(self): from ptah.manage.sqla import SQLAModule, AddRecord request = DummyRequest() mod = SQLAModule(None, request) table = mod['psqla-test_sqla_table'] form = AddRecord(table, request) form.update() self.assertEqual(form.label, 'test_sqla_table: new record') request = DummyRequest( POST={'form.buttons.back': 'Back'}) form = AddRecord(table, request) try: form.update() except Exception, res: pass