def test_type_property_works_as_expected(self): expected = 'Test string' item = Device() item.type = expected actual = item.type self.assertEqual(expected, actual) expected = 'Other string' item.type = expected actual = item.type self.assertEqual(expected, actual)
def test_serialize_works_as_expected(self): item = Device() item.id = 'Test string' item.locale = 'Test string' item.model = 'Test string' item.oem_name = 'Test string' item.os_version = 'Test string' item.type = 'Test string' actual = json.dumps(item.write(), separators=(',', ':'), cls=TestJsonEncoder) expected = '{"ai.device.id":"Test string","ai.device.locale":"Test string","ai.device.model":"Test string","ai.device.oemName":"Test string","ai.device.osVersion":"Test string","ai.device.type":"Test string"}' self.assertEqual(expected, actual)
def test_serialize_works_as_expected(self): item = Device() item.id = 'Test string' item.locale = 'Test string' item.model = 'Test string' item.oem_name = 'Test string' item.os_version = 'Test string' item.type = 'Test string' actual = json.dumps(item.write(), separators=(',', ':'), cls=JsonEncoder) expected = '{"ai.device.id":"Test string","ai.device.locale":"Test string","ai.device.model":"Test string","ai.device.oemName":"Test string","ai.device.osVersion":"Test string","ai.device.type":"Test string"}' self.assertEqual(expected, actual)