track4px/test.py
Kumi c37fe815c1
refactor: update unit tests to use Track4PX API
Replaced DPD API references with Track4PX in unit tests to align with the updated API structure. Removed unused imports to clean up the code. This ensures compatibility with the current API implementation and improves maintainability.
2024-09-06 08:28:37 +02:00

19 lines
648 B
Python

from unittest import TestCase
from track4px import HTTPRequest, Track4PX
class TestHTTPRequest(TestCase):
def test_http_request(self):
http = HTTPRequest("https://httpbin.kumi.systems/get")
response = http.execute()
self.assertEqual(response["headers"]["User-Agent"], http.USER_AGENT)
class TestTrack4PX(TestCase):
def setUp(self):
self.api = Track4PX()
def test_tracking(self):
tracking_number = "4PX3001291278502CN"
response = self.api.tracking(tracking_number, wrap=True)
self.assertTrue(response.events)
self.assertEqual(response.tracking_number, tracking_number)