def test_single_lookup_values_correctly_assigned_to_parameters(self): sender = RequestCapturingSender() serializer = FakeDeserializer({}) client = Client(sender, serializer) lookup = Lookup() lookup.street = '0' lookup.street2 = '1' lookup.secondary = '2' lookup.city = '3' lookup.state = '4' lookup.zipcode = '5' lookup.lastline = '6' lookup.addressee = '7' lookup.urbanization = '8' lookup.match = match_type.INVALID lookup.candidates = '9' client.send_lookup(lookup) self.assertEqual('0', sender.request.parameters['street']) self.assertEqual('1', sender.request.parameters['street2']) self.assertEqual('2', sender.request.parameters['secondary']) self.assertEqual('3', sender.request.parameters['city']) self.assertEqual('4', sender.request.parameters['state']) self.assertEqual('5', sender.request.parameters['zipcode']) self.assertEqual('6', sender.request.parameters['lastline']) self.assertEqual('7', sender.request.parameters['addressee']) self.assertEqual('8', sender.request.parameters['urbanization']) self.assertEqual(match_type.INVALID, sender.request.parameters['match']) self.assertEqual('9', sender.request.parameters['candidates'])
def test_deserialize_called_with_response_body(self): response = Response("Hello, World!", 0) sender = MockSender(response) deserializer = FakeDeserializer(None) client = Client(sender, deserializer) client.send_lookup(Lookup()) self.assertEqual(response.payload, deserializer.input)