コード例 #1
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')
コード例 #2
0
    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')
コード例 #3
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
コード例 #4
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'], '.')
コード例 #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
ファイル: 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