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='0'): 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_03_0(self): image_path = '../images/all/0/03.png' self._helper(image_path, 0) def test_05_0(self): image_path = '../images/all/0/05_0.jpg' self._helper(image_path, 0) def test_05_90(self): image_path = '../images/all/0/05_90.jpg' self._helper(image_path, 1) def test_05_180(self): image_path = '../images/all/0/05_180.jpg' self._helper(image_path, 2) def test_05_270(self): image_path = '../images/all/0/05_270.jpg' self._helper(image_path, 3) def test_06_0(self): image_path = '../images/all/0/06_0.jpg' self._helper(image_path, 0) def test_06_90(self): image_path = '../images/all/0/06_90.jpg' self._helper(image_path, 1) def test_06_180(self): image_path = '../images/all/0/06_180.jpg' self._helper(image_path, 2) def test_06_270(self): image_path = '../images/all/0/06_270.jpg' self._helper(image_path, 3)