def generate_report(pretty, json_file):
'''
Generates a report from a static JSON result file
'''
# setup workspace
ws = Workspace('test-files-marionette')
ws_json_file = os.path.join(ws.make_tempdir(), json_file)
# copy static json result file to workspace
shutil.copyfile(os.path.join(TEST_DATA_PATH, json_file), ws_json_file)
# create a random test name for decibel
buff = []
for i in range(10):
buff.append(random.randint(0,9))
name = ''.join(['%d' % i for i in buff])
# create time stamp for report
time = datetime.now()
start_time = time.strftime("%Y-%m-%d %H:%M:%S")
end_time = (time + timedelta(seconds=1)).strftime("%Y-%m-%d %H:%M:%S")
# try to generate report.
# delete workspace.
ws.delete()
# check if decibel reported 200 (ok) in response.
return name, start_time, end_time
评论列表
文章目录