Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_from_dict(self):
result = {
"BrokerID": "45544",
"FromCurrencyID": "4343",
"FromCurrencyUnit": 19.0,
"ToCurrencyID": "4334",
"ExchangeRate": 11.0
}
field = ApiStructure.ExchangeRateField.from_dict(result)
self.assertEqual(field.BrokerID, b"45544")
self.assertEqual(field.FromCurrencyID, b"4343")
self.assertEqual(field.FromCurrencyUnit, 19.0)
self.assertEqual(field.ToCurrencyID, b"4334")
self.assertEqual(field.ExchangeRate, 11.0)
def test_dict_missing_parameter(self):
result = {
"BrokerID": "45544",
"ToCurrencyID": "4334",
"ExchangeRate": 11.0
}
field = ApiStructure.ExchangeRateField.from_dict(result)
self.assertEqual(field.BrokerID, b"45544")
self.assertEqual(field.FromCurrencyID, b"")
self.assertEqual(field.FromCurrencyUnit, 0.0)
self.assertEqual(field.ToCurrencyID, b"4334")
self.assertEqual(field.ExchangeRate, 11.0)