orient_2_test.py 995 B

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