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) |