import unittest from pathlib import Path 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_01_270(self): image_path = '../images/false/miss_orient/01_270.jpg' self._helper(image_path, 3) def test_02_270(self): image_path = '../images/false/miss_orient/02_270.jpg' self._helper(image_path, 3) def test_04(self): image_path = '../images/false/miss_orient/04.jpg' self._helper(image_path, 0, '1') def test_05(self): image_path = '../images/false/miss_orient/05.jpg' self._helper(image_path, 3) def test_06(self): image_path = '../images/false/miss_orient/06.png' self._helper(image_path, 3) def test_07(self): image_path = '../images/false/miss_orient/07.jpg' self._helper(image_path, 0, '1') def test_08(self): image_path = '../images/false/miss_orient/08.jpg' self._helper(image_path, 2, '1') if __name__ == '__main__': unittest.main()