コード例 #1
0
    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))
コード例 #2
0
ファイル: quote.py プロジェクト: wjshan/purplship
    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))
コード例 #3
0
    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))
            ),
        )
コード例 #4
0
ファイル: quote.py プロジェクト: wjshan/purplship
    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))
コード例 #5
0
    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))
コード例 #6
0
    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))
コード例 #7
0
    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))
コード例 #8
0
    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))
コード例 #9
0
ファイル: tracking.py プロジェクト: wjshan/purplship
    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))