refactor: format code with black

This commit is contained in:
debugtalk
2022-04-30 15:06:31 +08:00
parent 737379b49f
commit be8c053ed8
52 changed files with 1809 additions and 2254 deletions

View File

@@ -19,18 +19,13 @@ def run_httpbin():
class ApiServerUnittest(unittest.TestCase):
""" Test case class that sets up an HTTP server which can be used within the tests
"""
"""Test case class that sets up an HTTP server which can be used within the tests"""
@classmethod
def setUpClass(cls):
cls.host = "http://127.0.0.1:5000"
cls.flask_process = multiprocessing.Process(
target=run_flask
)
cls.httpbin_process = multiprocessing.Process(
target=run_httpbin
)
cls.flask_process = multiprocessing.Process(target=run_flask)
cls.httpbin_process = multiprocessing.Process(target=run_httpbin)
cls.flask_process.start()
cls.httpbin_process.start()
time.sleep(1)
@@ -44,15 +39,13 @@ class ApiServerUnittest(unittest.TestCase):
def get_token(self, user_agent, device_sn, os_platform, app_version):
url = "%s/api/get-token" % self.host
headers = {
'Content-Type': 'application/json',
'User-Agent': user_agent,
'device_sn': device_sn,
'os_platform': os_platform,
'app_version': app_version
}
data = {
'sign': get_sign(device_sn, os_platform, app_version)
"Content-Type": "application/json",
"User-Agent": user_agent,
"device_sn": device_sn,
"os_platform": os_platform,
"app_version": app_version,
}
data = {"sign": get_sign(device_sn, os_platform, app_version)}
resp = self.api_client.post(url, json=data, headers=headers)
resp_json = resp.json()
@@ -62,14 +55,11 @@ class ApiServerUnittest(unittest.TestCase):
return resp_json["token"]
def get_authenticated_headers(self):
user_agent = 'iOS/10.3'
user_agent = "iOS/10.3"
device_sn = gen_random_string(15)
os_platform = 'ios'
app_version = '2.8.6'
os_platform = "ios"
app_version = "2.8.6"
token = self.get_token(user_agent, device_sn, os_platform, app_version)
headers = {
'device_sn': device_sn,
'token': token
}
headers = {"device_sn": device_sn, "token": token}
return headers