Pārlūkot izejas kodu

update 合并测试接口脚本

zeke-chin 2 gadi atpakaļ
vecāks
revīzija
df56c0d61b
2 mainītis faili ar 14 papildinājumiem un 49 dzēšanām
  1. 8 46
      TestAllOcr/test_interface.py
  2. 6 3
      to_md/use.py

+ 8 - 46
TestAllOcr/test_interface.py

@@ -11,46 +11,8 @@ envl = 'DX_test'
 url = config.URL[envl]
 token = config.TOKEN[envl]
 
-# 生产集群
-class TestSbOcr(unittest.TestCase):
 
-    def _helper(self, image_path, suffix):
-        root = Path(__file__).parent
-        image_path = str(root / image_path)
-        r = send_request(image_path, suffix, url, token)
-        self.assertIn('result', r, f'{suffix} test error')
-
-    def test_bank(self):
-        image_path = './image/bankcard.jpg'
-        suffix = '/yhksb/bankcard'
-        self._helper(image_path, suffix)
-
-    def test_idcard(self):
-        image_path = './image/idcard.jpg'
-        suffix = '/sfzsb/idcard'
-        self._helper(image_path, suffix)
-
-    def test_regbook(self):
-        image_path = './image/regbook.jpg'
-        suffix = '/hkbsb/regbook'
-        self._helper(image_path, suffix)
-
-    def test_schoolcert(self):
-        image_path = './image/schoolcert.jpg'
-        suffix = '/xxw/schoolcert'
-        self._helper(image_path, suffix)
-
-    def test_cet(self):
-        image_path = './image/cet.jpg'
-        suffix = '/cet/cet'
-        self._helper(image_path, suffix)
-
-    def test_blef(self):
-        image_path = './image/blfe.jpg'
-        suffix = '/blfe/blfe'
-        self._helper(image_path, suffix)
-
-# 测试集群
+# 生产集群
 class TestOcr(unittest.TestCase):
 
     def _helper(self, image_path, suffix):
@@ -61,31 +23,31 @@ class TestOcr(unittest.TestCase):
 
     def test_bank(self):
         image_path = './image/bankcard.jpg'
-        suffix = '/yhksbtest/bankcard'
+        suffix = '/yhksb/bankcard' if 'sb' in envl else '/yhksbtest/bankcard'
+        print(suffix)
         self._helper(image_path, suffix)
 
     def test_idcard(self):
         image_path = './image/idcard.jpg'
-        suffix = '/sfzsbtest/idcard'
+        suffix = '/sfzsb/idcard' if 'sb' in envl else '/sfzsbtest/idcard'
         self._helper(image_path, suffix)
 
     def test_regbook(self):
         image_path = './image/regbook.jpg'
-        suffix = '/hkbsbtest/regbook'
+        suffix = '/hkbsb/regbook' if 'sb' in envl else '/hkbsbtest/regbook'
         self._helper(image_path, suffix)
 
     def test_schoolcert(self):
         image_path = './image/schoolcert.jpg'
-        suffix = '/xxwtest/schoolcert'
+        suffix = '/xxw/schoolcert' if 'sb' in envl else '/xxwtest/schoolcert'
         self._helper(image_path, suffix)
 
     def test_cet(self):
         image_path = './image/cet.jpg'
-        suffix = '/cettest/cet'
+        suffix = '/cet/cet' if 'sb' in envl else '/cettest/cet'
         self._helper(image_path, suffix)
 
     def test_blef(self):
         image_path = './image/blfe.jpg'
-        suffix = '/blfetest/blfe'
+        suffix = '/blfe/blfe' if 'sb' in envl else '/blfetest/blfe'
         self._helper(image_path, suffix)
-

+ 6 - 3
to_md/use.py

@@ -2,7 +2,7 @@
 Author: zeke-chin zeke-chin@icloud.com
 Date: 2022-09-26 14:58:10
 LastEditors: zeke-chin zeke-chin@icloud.com
-LastEditTime: 2022-09-26 20:28:55
+LastEditTime: 2022-09-27 10:00:47
 FilePath: /HROCR/to_md/to_md/use.py
 Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE`
 '''
@@ -13,8 +13,11 @@ from new import MD, Image, Dataset, parser_path
 
 # config
 # 图片路径
-image_path = Path('/Users/zeke/work/sx/OCR/image_data/户口本——9.11/首页')
-image_type = 1
+image_path = Path('/Users/zeke/Downloads/户口本9.8/9.26')
+# image_path = Path('/Users/zeke/work/sx/OCR/image_data/户口本——9.11/img')
+# image_path = Path('/Users/zeke/work/sx/OCR/image_data/户口本——9.11/首页')
+
+image_type = 0
 # 是否旋转
 image_rotate = False
 ocr_address = 'local'  # 'local' 'test' 'sb'