track4px/test.py

20 lines
648 B
Python
Raw Normal View History

from unittest import TestCase
2023-08-16 09:28:38 +00:00
from track4px import HTTPRequest, Track4PX
2023-08-16 09:28:38 +00:00
class TestHTTPRequest(TestCase):
def test_http_request(self):
http = HTTPRequest("https://httpbin.kumi.systems/get")
2023-08-16 09:28:38 +00:00
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)