orient_1_test.py 1005 B

12345678910111213141516171819202122232425262728293031323334
  1. import unittest
  2. import base64
  3. from pathlib import Path
  4. import time
  5. import requests
  6. from testing.utils import *
  7. class TestIdCardAddress(unittest.TestCase):
  8. def _helper(self, image_path, orient, image_type='1'):
  9. root = Path(__file__).parent
  10. image_path = str(root / image_path)
  11. r = send_request(image_path, image_type)
  12. self.assertEqual(orient, r['result']['orientation'], f'{image_path} orientation case error')
  13. def test_01_0(self):
  14. image_path = '../images/all/1/01.jpg'
  15. self._helper(image_path, 0)
  16. def test_02_0(self):
  17. image_path = '../images/all/1/02_0.png'
  18. self._helper(image_path, 0)
  19. def test_02_90(self):
  20. image_path = '../images/all/1/02_90.png'
  21. self._helper(image_path, 1)
  22. def test_02_180(self):
  23. image_path = '../images/all/1/02_180.png'
  24. self._helper(image_path, 2)
  25. def test_02_270(self):
  26. image_path = '../images/all/1/02_270.png'
  27. self._helper(image_path, 3)