Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: tests/xtm_mock_api.py

Issue 29908581: Issue #7036 - [XTM Integration] Add support for providing workflow name (Closed)
Patch Set: Created Oct. 12, 2018, 2:03 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« tests/utils.py ('K') | « tests/utils.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/xtm_mock_api.py
diff --git a/tests/xtm_mock_api.py b/tests/xtm_mock_api.py
index 20d2fccbf3af60548893f4fdf290d437163cfd25..5c18b3e3db2289ac231f529cf821a44b7639a6f6 100644
--- a/tests/xtm_mock_api.py
+++ b/tests/xtm_mock_api.py
@@ -52,6 +52,10 @@ def get_configured_app(**kwargs):
xtm_mock.config['target_languages'] = kwargs.pop('target_langs', ['de_DE'])
xtm_mock.config['files'] = kwargs.pop('files', [])
xtm_mock.config['source_language'] = kwargs.pop('source_lang', 'en_US')
+ xtm_mock.config['workflows'] = [
+ {'name': 'workflow1', 'id': 2222},
+ {'name': 'workflow2', 'id': 3333},
+ ]
return xtm_mock.wsgi_app
@@ -269,5 +273,23 @@ def download(project_id):
)
+@xtm_mock.route('/rest-api/workflows', methods=['GET'])
+def get_workflows():
+ if not _check_auth():
+ return Response(
+ status=401,
+ response=json.dumps({'reason': 'Authentication failed.'}),
+ )
+
+ name = request.args.get('name')
+ result = []
+
+ for workflow in xtm_mock.config['workflows']:
+ if name in workflow['name']:
+ result.append(workflow)
+
+ return jsonify(result)
+
+
if __name__ == '__main__':
xtm_mock.run(debug=True)
« tests/utils.py ('K') | « tests/utils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld