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

Side by Side Diff: tests/crowdin_mock_api.py

Issue 29647615: Noissue - Refactor translation tests to validate sync (Closed)
Patch Set: Created Dec. 22, 2017, 3:43 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests/test_translations.py » ('j') | tests/test_translations.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 from flask import Flask, send_from_directory, jsonify, request 1 from flask import Flask, send_from_directory, jsonify, request
2 2
3 app = Flask(__name__) 3 app = Flask(__name__)
4 app.request_log = [] 4 app.request_log = []
5 5
6 6
7 @app.before_request
8 def log_request_info():
9 log = (request.url, str(request.get_data()))
10 app.request_log.append(log)
11
12
13 @app.route('/api/project/test/info', methods=['GET']) 7 @app.route('/api/project/test/info', methods=['GET'])
14 def info(): 8 def info():
15 return jsonify( 9 return jsonify(
16 { 10 {
17 'languages': [ 11 'languages': [
18 { 12 {
19 'name': 'German', 13 'name': 'German',
20 'code': 'de', 14 'code': 'de',
21 'can_translate': 1, 15 'can_translate': 1,
22 'can_approve': 1, 16 'can_approve': 1,
23 17
24 }, 18 },
25 { 19 {
26 'name': 'English', 20 'name': 'English',
27 'code': 'en', 21 'code': 'en',
28 'can_translate': 1, 22 'can_translate': 1,
29 'can_approve': 1, 23 'can_approve': 1,
30 24
31 }, 25 },
32
33 ], 26 ],
34 'files': [ 27 'files': [
35 { 28 {
36 'node_type': 'directory', 29 'node_type': 'directory',
37 'name': 'en', 30 'name': 'en',
38 'files': [ 31 'files': [
39 { 32 {
40 'node_type': 'file', 33 'node_type': 'file',
41 'name': 'translate.json', 34 'name': 'global.json',
42 'created': '2016-09-26 08:30:07', 35 'created': '2016-09-26 08:30:07',
43 'last_updated': '2016-09-26 08:30:08', 36 'last_updated': '2016-09-26 08:30:08',
44 'last_accessed': None, 37 'last_accessed': None,
45 'last_revision': '1' 38 'last_revision': '1'
46 }, 39 },
47 ] 40 ]
48 }, 41 },
49 { 42 {
50 'node_type': 'directory', 43 'node_type': 'directory',
51 'name': 'de', 44 'name': 'de',
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 104
112 105
113 @app.route('/api/project/test/export', methods=['GET']) 106 @app.route('/api/project/test/export', methods=['GET'])
114 def export(): 107 def export():
115 return jsonify({'success': {'status': 'skipped'}}) 108 return jsonify({'success': {'status': 'skipped'}})
116 109
117 110
118 @app.route('/api/project/test/download/all.zip', methods=['GET']) 111 @app.route('/api/project/test/download/all.zip', methods=['GET'])
119 def get_zip(): 112 def get_zip():
120 return send_from_directory('', 'all.zip') 113 return send_from_directory('', 'all.zip')
OLDNEW
« no previous file with comments | « no previous file | tests/test_translations.py » ('j') | tests/test_translations.py » ('J')

Powered by Google App Engine
This is Rietveld