def test_get_info_calls(self, http_mock): with patch.object(CanadaPostProxy, "_get_info", return_value="<a></a>") as get_info_mock: proxy_ = CanadaPostProxy(proxy.client) proxy_.create_shipment(self.NCShipment) link = xml_tostring(get_info_mock.call_args[0][0]) self.assertEqual(strip(link), strip(ShipmentPriceLinkXML))
def test_get_quotes(self, http_mock): proxy.get_quotes(self.mailing_scenario) xmlStr = http_mock.call_args[1]["data"].decode("utf-8") reqUrl = http_mock.call_args[1]["url"] self.assertEqual(strip(xmlStr), strip(QuoteRequestXml)) self.assertEqual(reqUrl, "%s/rs/ship/price" % (proxy.client.server_url))
def test_modify_pickup(self, http_mock): proxy.modify_pickup(self.ModifyPURequest) xmlStr = http_mock.call_args[1]["data"].decode("utf-8") self.assertEqual( strip(xmlStr), _reformat_time( "CloseTime", _reformat_time("ReadyByTime", strip(ModifyPURequestXML)) ), )
def test_freight_get_quotes(self, http_mock): proxy.get_quotes(self.FreightRateRequest) xmlStr = http_mock.call_args[1]["data"].decode("utf-8") self.assertEqual(strip(xmlStr), strip(FreightRateRequestXML))
def test_cancel_pickup(self, http_mock): proxy.cancel_pickup(self.CancelPickupRequest) xmlStr = http_mock.call_args[1]["data"].decode("utf-8") self.assertEqual(strip(xmlStr), strip(PickupCancellationRequestXML))
def test_request_pickup(self, http_mock): proxy.request_pickup(self.PickupRequest) xmlStr = http_mock.call_args[1]["data"].decode("utf-8") self.assertEqual(strip(xmlStr), strip(PickupRequestXml))
def test_create_ncshipment(self, http_mock): proxy.create_shipment(self.NCShipment) xmlStr = http_mock.call_args[1]["data"].decode("utf-8") self.assertEqual(strip(xmlStr), strip(NCShipmentRequestXML))
def test_get_quotes(self, http_mock): proxy.get_quotes(self.DCTRequest) xmlStr = http_mock.call_args[1]["data"].decode("utf-8") self.assertEqual(strip(xmlStr), strip(QuoteRequestXml))
def test_get_trackings(self, http_mock): proxy.get_trackings(self.KnownTrackingRequest) xmlStr = http_mock.call_args[1]["data"].decode("utf-8") self.assertEqual(strip(xmlStr), strip(TrackingRequestXml))