示例#1
0
    def test_serializeData(self):
        class FakeModel:
            foo = '1'

        queryset = [FakeModel(), FakeModel()]

        d = Table("name", 'querySet', [('foo', 'label')])

        with Mock() as d.serializeRow:
            d.serializeRow(1, None)
            d.serializeRow(1, None)

        d.serializeData(queryset, output=None)
示例#2
0
    def test_serializeData(self):
        class FakeModel:
            foo = '1'

        queryset = [FakeModel(), FakeModel()]

        d = Table("name", 'querySet', [('foo', 'label')])

        with Mock() as d.serializeRow:
            d.serializeRow(1, None)
            d.serializeRow(1, None)

        d.serializeData(queryset, output=None)
示例#3
0
    def test_serializeRow(self):
        class FakeModel:
            foo = '123'

        fm = FakeModel()

        with Mock() as column:
            column.name >> "foo"
            column.serialize(fm, output=0) >> 'bar'

        d = Table("name", 'querySet', [column])
        self.assertEquals(d.serializeRow(fm, output=0), {'foo': 'bar'})
示例#4
0
    def test_serializeRow(self):
        class FakeModel:
            foo = '123'

        fm = FakeModel()

        with Mock() as column:
            column.name >> "foo"
            column.serialize(fm, output=0) >> 'bar'

        d = Table("name", 'querySet', [column])
        self.assertEquals(
            d.serializeRow(fm, output=0),
            {'foo':'bar'})