def test_get_list(self): """ Test retrieving a list of cost centers """ for data in test_data: result = CostCenter.get_list( filters=data.items(), pattern=data['pattern']) self.assertIsInstance(result, type([])) for cost_center, code in izip(result, data['expected']): self.assertIsInstance(cost_center, CostCenter) self.assertEqual(cost_center.code, code)
def test_get_dict(self): """ Test retrieving a dict of cost centers """ for data in test_data: result = CostCenter.get_dict( filters=data.items(), pattern=data['pattern']) self.assertIsInstance(result, type({})) for key_code, code in zip(sorted(result), data['expected']): cost_center = result[key_code] self.assertIsInstance(cost_center, CostCenter) self.assertEqual(cost_center.code, code) self.assertEqual(key_code, code)