import unittest import base64 from pathlib import Path import requests from testing.utils import * class TestIdCardAddress(unittest.TestCase): def _helper(self, image_path, orient, image_type='2'): 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/2/01_0.png' self._helper(image_path, 0) def test_01_90(self): image_path = '../images/all/2/01_90.png' self._helper(image_path, 1) def test_01_180(self): image_path = '../images/all/2/01_180.png' self._helper(image_path, 2) def test_01_270(self): image_path = '../images/all/2/01_270.png' self._helper(image_path, 3) def test_02_0(self): image_path = '../images/all/2/02.jpeg' self._helper(image_path, 0)