1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- 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_01_0(self):
- image_path = '../images/all/0/01_0.jpg'
- self._helper(image_path, 0)
- def test_01_90(self):
- image_path = '../images/all/0/01_90.jpg'
- self._helper(image_path, 1)
- def test_01_180(self):
- image_path = '../images/all/0/01_180.jpg'
- self._helper(image_path, 2)
- def test_01_270(self):
- image_path = '../images/all/0/01_270.jpg'
- self._helper(image_path, 3)
- def test_02_0(self):
- image_path = '../images/all/0/02.jpg'
- 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)
|