import unittest import requests from util import req, reqGet, reqForm, reqDelete, reqPut def get_token(): headers = { 'authority': 'edsp.rxdpdev.k5.bigtree.tech', 'accept': 'application/json, text/plain, */*', 'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8', } json_data = { 'username': 'jitiantian', 'password': 'Aa123456', 'token': True, } response = requests.post('https://edsp.rxdpdev.k5.bigtree.tech/api/rxdp-auth-web/auth/login', headers=headers, json=json_data) return response.json()['token'] class MyTest(unittest.TestCase): def setUp(self) -> None: # self.host = "https://edsp.rxdpdev.k5.bigtree.tech/api/rxdp-xdata-web/rxdp-file" self.host = "http://127.1:8080" self.head = { "Access-Token": get_token() } # def test_insert_dataBase(self): req(self.host + "/dataBase", { # "sourceCode": "wcf_dataBase11asese1111", "sourceName": "wcf测试数据库链接1", "enableFlag": "1", "sourceType": "mysql", "sourceConfig": "{\"driverName\":\"com.mysql.cj.jdbc.Driver\",\"jdbcUrl\":\"jdbc:mysql://mysql.flinkdev.svc.k5.bigtree.zone:3306/bi_application?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false\",\"username\":\"biapp_user\",\"password\":\"OuKA5#AWG2Cq\"}" }, self.head) def test_insert_file(self): req(self.host + "/rxdp-file/create", { "enName": "excel_test", "cnName": "excel_test", "fileType": "XLSX", "collectionName": "excel_test", "fileId": "FID960305664629170176" }, self.head)