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)
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'})
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'})