예제 #1
0
    def test_sqla_table_addrec_create_multi(self):
        from ptah.manage.sqla import SQLAModule, AddRecord

        request = self.make_request()

        mod = SQLAModule(None, request)
        table = mod['psqla-test_sqla_table']

        request = self.make_request(
            POST={'form.buttons.createmulti': 'Create'})

        form = AddRecord(table, request)
        form.csrf = False
        form.update_form()

        self.assertIn('Please fix indicated errors',
                      request.render_messages())

        request = self.make_request(
            POST={'form.buttons.createmulti': 'Create',
                  'name': 'Test multi'})

        form = AddRecord(table, request)
        form.csrf = False
        form.update_form()

        self.assertIn('Table record has been created.',
                      request.render_messages())

        rec = ptah.get_session().query(TestSqlaModuleTable).first()
        self.assertEqual(rec.name, 'Test multi')
예제 #2
0
    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(POST={'form.buttons.create': '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.create': 'Create',
            'name': 'Test'
        })

        form = AddRecord(table, request)
        form.csrf = False
        res = form.update()

        self.assertIn('Table record has been created.',
                      ptah.view.render_messages(request))
        self.assertIsInstance(res, HTTPFound)

        rec = ptah.cms.Session.query(TestSqlaModuleTable).first()
        self.assertEqual(rec.name, 'Test')
예제 #3
0
파일: test_sqla.py 프로젝트: runyaga/ptah
    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')
예제 #4
0
파일: test_sqla.py 프로젝트: WouterVH/ptah
    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
예제 #5
0
파일: test_sqla.py 프로젝트: runyaga/ptah
    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'], '.')
예제 #6
0
    def test_sqla_table_addrec_create(self):
        from ptah.manage.sqla import SQLAModule, AddRecord

        request = self.make_request()

        mod = SQLAModule(None, request)
        table = mod['psqla-test_sqla_table']

        request = self.make_request(
            POST={'form.buttons.create': 'Create'})

        form = AddRecord(table, request)
        form.csrf = False
        form.update_form()

        self.assertIn('Please fix indicated errors',
                      request.render_messages())

        request = self.make_request(
            POST={'form.buttons.create': 'Create',
                  'name': 'Test'})

        form = AddRecord(table, request)
        form.csrf = False
        res = form()

        self.assertIn('Table record has been created.',
                      request.render_messages())
        self.assertIsInstance(res, HTTPFound)

        rec = ptah.get_session().query(TestSqlaModuleTable).first()
        self.assertEqual(rec.name, 'Test')
예제 #7
0
    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'], '.')
예제 #8
0
파일: test_sqla.py 프로젝트: WouterVH/ptah
    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