Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
echoyang7 committed Oct 25, 2024
1 parent 5f7c39a commit 2255b4d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
5 changes: 3 additions & 2 deletions lyrebird/mock/blueprints/apis/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def get_flow_list_by_filter(filter_obj, for_display):
target_items = Filter.get_items_after_filtration(all_items, filter_obj)
for item in target_items:
# If the response is not fully processed, do not return.
if not for_display and item['duration'] == 0:
if for_display == False and item['duration'] == 0:
continue

info = dict(
Expand Down Expand Up @@ -95,7 +95,8 @@ class FlowList(Resource):
当前请求列表
"""

def get(self, for_display=False):
def get(self):
for_display = request.args.get('for_display', False)
default_filter = context.application.selected_filter
req_list = get_flow_list_by_filter(default_filter, for_display)
return Response(json.dumps(req_list, ensure_ascii=False), mimetype='application/json', status=200)
Expand Down
28 changes: 14 additions & 14 deletions tests/test_flow_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def test_flow_with_id(client):

def test_flow_with_id_and_decode_input_encode(client):
flow_id = None
flows = client.get('/api/flow').json
flows = client.get('/api/flow?for_display=true').json
for flow in flows:
if flow['request']['host'] == 'm.meituan.com':
flow_id = flow['id']
Expand All @@ -185,7 +185,7 @@ def test_flow_with_id_and_decode_input_encode(client):

def test_flow_with_id_and_decode_input_decode(client):
flow_id = None
flows = client.get('/api/flow').json
flows = client.get('/api/flow?for_display=true').json
for flow in flows:
if flow['request']['host'] == 'i.meituan.com':
flow_id = flow['id']
Expand All @@ -196,7 +196,7 @@ def test_flow_with_id_and_decode_input_decode(client):

def test_flow_with_id_and_not_decode_input_encode(client):
flow_id = None
flows = client.get('/api/flow').json
flows = client.get('/api/flow?for_display=true').json
for flow in flows:
if flow['request']['host'] == 'm.meituan.com':
flow_id = flow['id']
Expand All @@ -207,7 +207,7 @@ def test_flow_with_id_and_not_decode_input_encode(client):

def test_flow_with_id_and_not_decode_input_decode(client):
flow_id = None
flows = client.get('/api/flow').json
flows = client.get('/api/flow?for_display=true').json
for flow in flows:
if flow['request']['host'] == 'i.meituan.com':
flow_id = flow['id']
Expand All @@ -218,7 +218,7 @@ def test_flow_with_id_and_not_decode_input_decode(client):

def test_flow_with_id_and_default_input_encode(client):
flow_id = None
flows = client.get('/api/flow').json
flows = client.get('/api/flow?for_display=true').json
for flow in flows:
if flow['request']['host'] == 'm.meituan.com':
flow_id = flow['id']
Expand All @@ -229,7 +229,7 @@ def test_flow_with_id_and_default_input_encode(client):

def test_flow_with_id_and_default_input_decode(client):
flow_id = None
flows = client.get('/api/flow').json
flows = client.get('/api/flow?for_display=true').json
for flow in flows:
if flow['request']['host'] == 'i.meituan.com':
flow_id = flow['id']
Expand All @@ -240,7 +240,7 @@ def test_flow_with_id_and_default_input_decode(client):

def test_flow_with_id_and_origin(client):
flow_id = None
flows = client.get('/api/flow').json
flows = client.get('/api/flow?for_display=true').json
for flow in flows:
if flow['request']['host'] == 'm.meituan.com':
flow_id = flow['id']
Expand All @@ -252,7 +252,7 @@ def test_flow_with_id_and_origin(client):

def test_flow_with_id_and_not_origin(client):
flow_id = None
flows = client.get('/api/flow').json
flows = client.get('/api/flow?for_display=true').json
for flow in flows:
if flow['request']['host'] == 'm.meituan.com':
flow_id = flow['id']
Expand All @@ -265,7 +265,7 @@ def test_flow_with_id_and_not_origin(client):

def test_flow_with_id_and_origin_capital(client):
flow_id = None
flows = client.get('/api/flow').json
flows = client.get('/api/flow?for_display=true').json
for flow in flows:
if flow['request']['host'] == 'm.meituan.com':
flow_id = flow['id']
Expand All @@ -277,7 +277,7 @@ def test_flow_with_id_and_origin_capital(client):

def test_flow_with_id_and_not_origin_capital(client):
flow_id = None
flows = client.get('/api/flow').json
flows = client.get('/api/flow?for_display=true').json
for flow in flows:
if flow['request']['host'] == 'm.meituan.com':
flow_id = flow['id']
Expand All @@ -289,7 +289,7 @@ def test_flow_with_id_and_not_origin_capital(client):

def test_flow_with_id_and_origin_and_decode(client):
flow_id = None
flows = client.get('/api/flow').json
flows = client.get('/api/flow?for_display=true').json
for flow in flows:
if flow['request']['host'] == 'm.meituan.com':
flow_id = flow['id']
Expand All @@ -302,7 +302,7 @@ def test_flow_with_id_and_origin_and_decode(client):

def test_flow_with_id_and_not_origin_and_decode(client):
flow_id = None
flows = client.get('/api/flow').json
flows = client.get('/api/flow?for_display=true').json
for flow in flows:
if flow['request']['host'] == 'm.meituan.com':
flow_id = flow['id']
Expand All @@ -315,7 +315,7 @@ def test_flow_with_id_and_not_origin_and_decode(client):

def test_flow_with_id_and_origin_and_not_decode(client):
flow_id = None
flows = client.get('/api/flow').json
flows = client.get('/api/flow?for_display=true').json
for flow in flows:
if flow['request']['host'] == 'm.meituan.com':
flow_id = flow['id']
Expand All @@ -328,7 +328,7 @@ def test_flow_with_id_and_origin_and_not_decode(client):

def test_flow_with_id_and_not_origin_and_not_decode(client):
flow_id = None
flows = client.get('/api/flow').json
flows = client.get('/api/flow?for_display=true').json
for flow in flows:
if flow['request']['host'] == 'm.meituan.com':
flow_id = flow['id']
Expand Down

0 comments on commit 2255b4d

Please sign in to comment.