import unittest import base64 from pathlib import Path import time import requests from testing.utils import * class TestIdCardAddress(unittest.TestCase): def _helper(self, image_path, orient, image_type='1'): root = Path(__file__).parent image_path = str(root / image_path) r = send_request(image_path, image_type) self.assertEqual(orient, r['result']['orientation'], f'{image_path} orientation case error') def test_01_0(self): image_path = '../images/all/1/01.jpg' self._helper(image_path, 0) def test_02_0(self): image_path = '../images/all/1/02_0.png' self._helper(image_path, 0) def test_02_90(self): image_path = '../images/all/1/02_90.png' self._helper(image_path, 1) def test_02_180(self): image_path = '../images/all/1/02_180.png' self._helper(image_path, 2) def test_02_270(self): image_path = '../images/all/1/02_270.png' self._helper(image_path, 3)