作者 bianxinhua

add README

@@ -30,7 +30,7 @@ request: @@ -30,7 +30,7 @@ request:
30 serial: ${get_serialNo()} 30 serial: ${get_serialNo()}
31 customerValue: 31 customerValue:
32 - 31 32 - 31
33 - taskCharacter: 12 33 + taskCharactor: 12
34 reward: 2000 34 reward: 2000
35 acceptanceCriteria: $acceptanceCriteria 35 acceptanceCriteria: $acceptanceCriteria
36 description: $description 36 description: $description
  1 +name: 关闭任务
  2 +base_url: ${ENV(base_worth_url)}
  3 +verify: False
  4 +variables:
  5 + id: ${get_loot_task_id()}
  6 + reason: 测试关闭任务${get_nowtime()}
  7 + msg: ok
  8 +request:
  9 + headers:
  10 + Content-Type: application/json; charset=UTF-8
  11 + Authorization: Bearer ${get_task_Authorization()}
  12 + Origin: https://value-test.fjmaimaimai.com
  13 + Referer: https://value-test.fjmaimaimai.com/
  14 + User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36
  15 + X-Requested-With: XMLHttpRequest
  16 + json:
  17 + id: $id
  18 + reason: $reason
  19 + method: POST
  20 + url: task/close
  21 +validate:
  22 + - eq:
  23 + - content.code
  24 + - 0
  25 + - eq:
  26 + - content.msg
  27 + - $msg
1 -eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9zdXBsdXMtYnVzaW5lc3MtYWRtaW4tZ2F0ZXdheS10ZXN0LmZqbWFpbWFpbWFpLmNvbVwvYXV0aFwvcHdkTG9naW4iLCJpYXQiOjE1OTkwMzQ4OTMsImV4cCI6MTU5OTA0NTY5MywibmJmIjoxNTk5MDM0ODkzLCJqdGkiOiJVa3RuY0U2T3k1RDk0c250Iiwic3ViIjozMjQ4ODE3NjEzNjgxNjY0LCJwcnYiOiI4N2UwYWYxZWY5ZmQxNTgxMmZkZWM5NzE1M2ExNGUwYjA0NzU0NmFhIiwiY29tcGFueUlkIjozNjYsIm5pY2tu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3NjEzNjgxNjY0LCJwcnYiOiI4N2UwYWYxZWY5ZmQxNTgxMmZkZWM5NzE1M2ExNGUwYjA0NzU0NmFhIiwiY29tcGFueUlkIjozNjYsIm5pY2tuYW1lIjoiXHU4Yzc5XHU1YjUwXHU1OTM0IiwicGhvbmUiOiIxOTk5MDAwMDAwOCIsImlkIjozMjQ4ODE3NjEzNjgxNjY0LCJhZG1pblR5cGUiOjF9.tkoNNuALbJhZy7By1GohDSW4pb3LVIx0V1NVSakAdwU  
  1 +eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9zdXBsdXMtYnVzaW5lc3MtYWRtaW4tZ2F0ZXdheS10ZXN0LmZqbWFpbWFpbWFpLmNvbVwvYXV0aFwvYW5vbnltb3VzTG9naW4iLCJpYXQiOjE1OTkxMTc5ODAsImV4cCI6MTU5OTEyODc4MCwibmJmIjoxNTk5MTE3OTgwLCJqdGkiOiJhRXlHZWNVaEkzZ3l2Z0V3Iiwic3ViIjozMjQ4ODE3NjEzNjgxNjY0LCJwcnYiOiI4N2UwYWYxZWY5ZmQxNTgxMmZkZWM5NzE1M2ExNGUwYjA0NzU0NmFhIiwiY29tcGFueUlkIjozNjYsIm5pY2tuYW1lIjoiXHU4Yzc5XHU1YjUwXHU1OTM0IiwicGhvbmUiOiIxOTk5MDAwMDAwOCIsImlkIjozMjQ4ODE3NjEzNjgxNjY0LCJhZG1pblR5cGUiOjF9.rt3wdIr2YFcYjZjpXuBCqqYSfL8ia_ofS29CtzZl5Fg
1 -jwbedlg4b0n  
  1 +ysbfuexqbrb
  1 +3039444006263587840
1 -57276bc0f85217d57aac66c76c540ecf693b5eaa4d972e421f53bea3b526c63b7db79386  
  1 +1ad12e2680e7833bf77feaa9bb1f02e66b1b6aa17b13c019420f864cf34b520fac9956e0
1 -3679205383782400  
  1 +3679205371953152
1 -KdQYph4cXCd0ZIUPvpnlFnFX3bXM1BbbYDK7ggdolQF/W4pdas9QauY54nYH6tqiSmUpHXvIo7Le65l3zfGhrFk07OW9H3IrqCSrCwSssV68XNsiPLauiZ+Uvv+K5rMkuf8NpKEdT2BuoSTPlRElFCxaclAQJOf/hStJSAlQHO8=  
  1 +GS3oekoZEnYJMuCekvInSC5XvZXVD+ipuFpWJytJLrepJXECA4YaT8a+2AalGBlKLVSP70Ss70w73d28v95g4/7aM2Lzejo8aYb8Jrmvjs20rDMwqY9r/awiw8gZuID52/7f2Tl6nq+VVzJTc5KTvI8NZ9qsovGdoXXORaRNtnA=
1 -3038263396358685696  
  1 +3039395831662248960
1 -3248817613892608  
  1 +3248817613779968
1 -3274823457706240  
  1 +3274993621020928
1 -eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9zdXBsdXMtd29ydGgtd2ViLWdhdGV3YXktdGVzdC5mam1haW1haW1haS5jb21cL2F1dGhcL2xvZ2luIiwiaWF0IjoxNTk5MDM0ODkzLCJleHAiOjE1OTkwNDU2OTMsIm5iZiI6MTU5OTAzNDg5MywianRpIjoiMEZOd3JOOEd0NTJVUWFjQyIsInN1YiI6MzI0ODgxNzYxMzY4MTY2NCwicHJ2IjoiODdlMGFmMWVmOWZkMTU4MTJmZGVjOTcxNTNhMTRlMGIwNDc1NDZhYSIsImNvbXBhbnlJZCI6MzY2LCJuaWNrbmFtZSI6Ilx1OGM3OVx1NWI1MFx1NTkzNCIsInBob25lIjoiMTk5OTAwMDAwMDgiLCJ1aWQiOjMyNDg4MTc2MTM2ODE2NjQsImFkbWluVHlwZSI6Mn0.5mhMghMPFP8ZZcAeH2EkWsooDol1K6df8a5Oe0C_rlI  
  1 +eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9zdXBsdXMtd29ydGgtd2ViLWdhdGV3YXktdGVzdC5mam1haW1haW1haS5jb21cL2F1dGhcL2xvZ2luIiwiaWF0IjoxNTk5MTE3OTgxLCJleHAiOjE1OTkxMjg3ODEsIm5iZiI6MTU5OTExNzk4MSwianRpIjoiUlU0RzVSRkFRenYyWlYyaSIsInN1YiI6MzI0ODgxNzYxMzY4MTY2NCwicHJ2IjoiODdlMGFmMWVmOWZkMTU4MTJmZGVjOTcxNTNhMTRlMGIwNDc1NDZhYSIsImNvbXBhbnlJZCI6MzY2LCJuaWNrbmFtZSI6Ilx1OGM3OVx1NWI1MFx1NTkzNCIsInBob25lIjoiMTk5OTAwMDAwMDgiLCJ1aWQiOjMyNDg4MTc2MTM2ODE2NjQsImFkbWluVHlwZSI6Mn0.5eXGpnIHhI71V2ek9QIhIyI-gxktFeh26YQMTJcHSv8
@@ -5,6 +5,7 @@ from helpfunc.header_func import * @@ -5,6 +5,7 @@ from helpfunc.header_func import *
5 from helpfunc.login_func import * 5 from helpfunc.login_func import *
6 from helpfunc.m_func import * 6 from helpfunc.m_func import *
7 from helpfunc.pg_db_loot_func import * 7 from helpfunc.pg_db_loot_func import *
  8 +from helpfunc.pg_db_bid_func import *
8 # from helpfunc.time_func import * 9 # from helpfunc.time_func import *
9 10
10 import time,datetime,re 11 import time,datetime,re
@@ -44,4 +45,4 @@ def get_second(): @@ -44,4 +45,4 @@ def get_second():
44 def get_tomorrow(): 45 def get_tomorrow():
45 td = datetime.timedelta(days=1) 46 td = datetime.timedelta(days=1)
46 tomorrow = (datetime.datetime.utcnow() + td).isoformat() 47 tomorrow = (datetime.datetime.utcnow() + td).isoformat()
47 - print(tomorrow) 48 + return tomorrow
@@ -261,11 +261,12 @@ def teardown_hook_get_cid(response): @@ -261,11 +261,12 @@ def teardown_hook_get_cid(response):
261 #———————————————————————————————————————————————————————————————————————————————————————————————————————————— 261 #————————————————————————————————————————————————————————————————————————————————————————————————————————————
262 #引用资源模块 262 #引用资源模块
263 def teardown_hook_get_resource_id(response): 263 def teardown_hook_get_resource_id(response):
  264 + global resource_id
  265 + resource_id = ''
264 if response.status_code ==200: 266 if response.status_code ==200:
265 jsondata = json.loads(response.text) 267 jsondata = json.loads(response.text)
266 resource_id = str(jsondata['data']['list'][0]['id']) 268 resource_id = str(jsondata['data']['list'][0]['id'])
267 try: 269 try:
268 -  
269 with open(path + "config/resource_id.txt", 'w+') as f: 270 with open(path + "config/resource_id.txt", 'w+') as f:
270 f.write(resource_id) 271 f.write(resource_id)
271 print('写入成功,resource_id:{}'.format(resource_id)) 272 print('写入成功,resource_id:{}'.format(resource_id))
@@ -289,6 +290,8 @@ def get_resource_id_to_int(): @@ -289,6 +290,8 @@ def get_resource_id_to_int():
289 return int(get_resource_id()) 290 return int(get_resource_id())
290 291
291 def teardown_hook_get_resource_title(response): 292 def teardown_hook_get_resource_title(response):
  293 + global resource_title
  294 + resource_title = ''
292 if response.status_code ==200: 295 if response.status_code ==200:
293 jsondata = json.loads(response.text) 296 jsondata = json.loads(response.text)
294 resource_title = jsondata['data']['list'][0]['title'] 297 resource_title = jsondata['data']['list'][0]['title']
@@ -314,6 +317,8 @@ def get_resource_title(): @@ -314,6 +317,8 @@ def get_resource_title():
314 return resource_title 317 return resource_title
315 318
316 def teardown_hook_get_resource_content(response): 319 def teardown_hook_get_resource_content(response):
  320 + global resource_content
  321 + resource_content = ''
317 if response.status_code ==200: 322 if response.status_code ==200:
318 jsondata = json.loads(response.text) 323 jsondata = json.loads(response.text)
319 resource_content = jsondata['data']['list'][0]['content'] 324 resource_content = jsondata['data']['list'][0]['content']
  1 +#! /usr/bin/env python
  2 +# -*- coding: utf-8 -*-
  3 +# Date: 2020/7/12 16:27
  4 +# @Author:bxh
  5 +# @file: pg_db_func.py
  6 +from helpfunc.m_func import *
  7 +import psycopg2
  8 +from datetime import *
  9 +
  10 +# 获得连接
  11 +def GetConnect():
  12 + conn = False
  13 + try:
  14 + conn = psycopg2.connect(database="mmmworthtest",
  15 + user="bianxinhua",
  16 + password="bianxinhua_123",
  17 + host="114.55.200.59",
  18 + port="31543")
  19 + except Exception as err:
  20 + print("连接数据库失败,%s" % err)
  21 + return conn
  22 +
  23 +#获取抢单任务单的状态:待发布
  24 +def get_bid_task_status_1_from_database():
  25 + db = GetConnect()
  26 + cursor = db.cursor()
  27 + # sql= "select id from " + '''"''' + tbl + '''"'''+ ' ' + 'order by id desc '
  28 + sql = '''select task_status from tasks where company_id = 366 and task_type = 2 and task_status = 1 and id = {} '''.format(get_bid_task_id())
  29 + # print(sql)
  30 + try:
  31 + cursor.execute(sql)
  32 + result = cursor.fetchone()
  33 + return result[0]
  34 + except Exception as err:
  35 + # 发生错误时回滚
  36 + print(err)
  37 + db.rollback()
  38 + db.close()
  39 +
  40 +#获取抢单任务单的状态:待领取
  41 +def get_task_status_2_from_database():
  42 + db = GetConnect()
  43 + cursor = db.cursor()
  44 + # sql= "select id from " + '''"''' + tbl + '''"'''+ ' ' + 'order by id desc '
  45 + sql = '''select task_status from tasks where company_id = 366 and task_type = 2 and task_status = 2 and id = {} '''.format(get_bid_task_id())
  46 + print(sql)
  47 + try:
  48 + cursor.execute(sql)
  49 + result = cursor.fetchone()
  50 + return result[0]
  51 + except Exception as err:
  52 + # 发生错误时回滚
  53 + print(err)
  54 + db.rollback()
  55 + db.close()
  56 +#获取抢单任务单的状态:进行中
  57 +def get_task_status_3_from_database():
  58 + db = GetConnect()
  59 + cursor = db.cursor()
  60 + # sql= "select id from " + '''"''' + tbl + '''"'''+ ' ' + 'order by id desc '
  61 + sql = '''select task_status from tasks where company_id = 366 and task_type = 2 and task_status = 3 and id = {} '''.format(get_bid_task_id())
  62 + # print(sql)
  63 + try:
  64 + cursor.execute(sql)
  65 + result = cursor.fetchone()
  66 + return result[0]
  67 + except Exception as err:
  68 + # 发生错误时回滚
  69 + print(err)
  70 + db.rollback()
  71 + db.close()
  72 +# #获取抢单任务单的状态:待确认
  73 +def get_task_status_7_from_database():
  74 + db = GetConnect()
  75 + cursor = db.cursor()
  76 + # sql= "select id from " + '''"''' + tbl + '''"'''+ ' ' + 'order by id desc '
  77 + sql = '''select task_status from tasks where company_id = 366 and task_status = 7 and id = {}'''.format(get_bid_task_id())
  78 + print(sql)
  79 + try:
  80 + cursor.execute(sql)
  81 + result = cursor.fetchone()
  82 + return result[0]
  83 + except Exception as err:
  84 + # 发生错误时回滚
  85 + print(err)
  86 + db.rollback()
  87 + db.close()
  88 +
  89 +#获取任务单的状态:待验收
  90 +def get_task_status_4_from_database():
  91 + db = GetConnect()
  92 + cursor = db.cursor()
  93 + # sql= "select id from " + '''"''' + tbl + '''"'''+ ' ' + 'order by id desc '
  94 + sql = '''select task_status from tasks t where t.company_id = 366 and t.task_status = 4 and t.receiver_uid = '3248817613892608' and id = {}'''.format(get_bid_task_id())
  95 + # print(sql)
  96 + try:
  97 + cursor.execute(sql)
  98 + result = cursor.fetchone()
  99 + return result[0]
  100 + except Exception as err:
  101 + # 发生错误时回滚
  102 + print(err)
  103 + db.rollback()
  104 + db.close()
  105 +
  106 +#获取任务单的状态:已完成
  107 +def get_task_status_5_from_database():
  108 + db = GetConnect()
  109 + cursor = db.cursor()
  110 + # sql= "select id from " + '''"''' + tbl + '''"'''+ ' ' + 'order by id desc '
  111 + sql = '''select task_status from tasks t where t.company_id = 366 and t.task_status = 5 and id = {}'''.format(get_bid_task_id())
  112 + # print(sql)
  113 + try:
  114 + cursor.execute(sql)
  115 + result = cursor.fetchone()
  116 + return result[0]
  117 + except Exception as err:
  118 + # 发生错误时回滚
  119 + print(err)
  120 + db.rollback()
  121 + db.close()
  122 +
  123 +#获取任务单的状态:已关闭
  124 +def get_task_status_6_from_database():
  125 + db = GetConnect()
  126 + cursor = db.cursor()
  127 + # sql= "select id from " + '''"''' + tbl + '''"'''+ ' ' + 'order by id desc '
  128 + sql = '''select task_status from tasks t where t.company_id = 366 and t.task_status = 6 and id = {}'''.format(get_bid_task_id())
  129 + # print(sql)
  130 + try:
  131 + cursor.execute(sql)
  132 + result = cursor.fetchone()
  133 + return result[0]
  134 + except Exception as err:
  135 + # 发生错误时回滚
  136 + print(err)
  137 + db.rollback()
  138 + db.close()
@@ -22,7 +22,7 @@ teststeps: @@ -22,7 +22,7 @@ teststeps:
22 - eq: 22 - eq:
23 - content.msg 23 - content.msg
24 - ok 24 - ok
25 - 25 +#
26 - name: 保存任务 26 - name: 保存任务
27 api: api/m_api/loot/loot_update_false_api.yml 27 api: api/m_api/loot/loot_update_false_api.yml
28 teardown_hooks: 28 teardown_hooks:
@@ -7,8 +7,8 @@ teststeps: @@ -7,8 +7,8 @@ teststeps:
7 testcase: testcases/common/COM008_loot_open_status_2_testcase.yml 7 testcase: testcases/common/COM008_loot_open_status_2_testcase.yml
8 8
9 9
10 -- name: 抢单任务验收  
11 - api: api/m_api/loot/loot_task_accept_api.yml 10 +- name: 关闭任务
  11 + api: api/m_api/loot/loot_task_close_api.yml
12 validate: 12 validate:
13 - eq: 13 - eq:
14 - content.code 14 - content.code
@@ -20,7 +20,7 @@ teststeps: @@ -20,7 +20,7 @@ teststeps:
20 - name: 查看详情中的状态 20 - name: 查看详情中的状态
21 api: api/m_api/loot/loot_detail_api.yml 21 api: api/m_api/loot/loot_detail_api.yml
22 variables: 22 variables:
23 - status: ${get_task_status_5_from_database()} 23 + status: ${get_task_status_6_from_database()}
24 msg: ok 24 msg: ok
25 varidate: 25 varidate:
26 validate: 26 validate:
  1 +config:
  2 + name: 竞标任务状态验证-待发布
  3 +
  4 +teststeps:
  5 +
  6 +- name: 提问问题-审核问题-获取资源
  7 + testcase: testcases/permission/ques_pf_permission/QX001_pf_permission.yml
  8 +
  9 +- name: 登录系统
  10 + variables:
  11 + phone: ${ENV(wpftwphone)}
  12 + testcase: testcases/common/COM002_m_login_testcases.yml
  13 +
  14 +- name: 引用资源
  15 + api: api/m_api/task_resource_api.yml
  16 + teardown_hooks:
  17 + - ${teardown_hook_get_resource_id($response)}
  18 + - ${teardown_hook_get_resource_title($response)}
  19 + - ${teardown_hook_get_resource_content($response)}
  20 + varidate:
  21 + validate:
  22 + - eq:
  23 + - content.msg
  24 + - ok
  25 +
  26 +- name: 保存任务
  27 + api: api/m_api/bid/bid_update_api.yml
  28 + teardown_hooks:
  29 + - ${teardown_hook_get_bid_task_id($response)}
  30 + varidate:
  31 + validate:
  32 + - eq:
  33 + - content.msg
  34 + - ok
  35 +
  36 +#- name: 查看详情
  37 +# api: api/m_api/loot/loot_detail_api.yml
  38 +# variables:
  39 +# status: ${get_bid_task_status_1_from_database()}
  40 +# msg: ok
  41 +# varidate:
  42 +# validate:
  43 +# - eq:
  44 +# - content.msg
  45 +# - $msg
  46 +# - eq:
  47 +# - content.data.status
  48 +# - $status
@@ -13,5 +13,5 @@ testcases: @@ -13,5 +13,5 @@ testcases:
13 #- name: member_set_permission 成员管理设置权限 13 #- name: member_set_permission 成员管理设置权限
14 # testcase: testcases/task/member/member_set_permission_testcases.yml 14 # testcase: testcases/task/member/member_set_permission_testcases.yml
15 15
16 -- name: 任务状态验证-已验收,已完成  
17 - testcase: testcases/common/COM012_loot_open_status_5_testcase.yml  
  16 +- name: 任务状态验证-已关闭
  17 + testcase: testcases/common/COM014_bid_update_status_1_testcase.yml