Merge "Handle '/' in build_name for getting test_runs"
This commit is contained in:
commit
f7143734f8
|
@ -273,7 +273,7 @@ def _group_runs_by_key(runs_by_time, groupby_key):
|
||||||
return grouped_runs_by
|
return grouped_runs_by
|
||||||
|
|
||||||
|
|
||||||
@app.route('/build_name/<string:build_name>/test_runs', methods=['GET'])
|
@app.route('/build_name/<path:build_name>/test_runs', methods=['GET'])
|
||||||
def get_test_runs_by_build_name(build_name):
|
def get_test_runs_by_build_name(build_name):
|
||||||
value = parse.unquote(build_name)
|
value = parse.unquote(build_name)
|
||||||
if not value:
|
if not value:
|
||||||
|
|
|
@ -87,13 +87,13 @@ class TestRestAPI(base.TestCase):
|
||||||
'start_time': timestamp_a,
|
'start_time': timestamp_a,
|
||||||
'stop_time': timestamp_b}
|
'stop_time': timestamp_b}
|
||||||
])
|
])
|
||||||
def test_get_test_runs_by_build_name(self, api_mock):
|
def _test_get_test_runs_by_build_name(self, build_name, api_mock):
|
||||||
api.region = mock.MagicMock()
|
api.region = mock.MagicMock()
|
||||||
api.region.cache_on_arguments = mock.MagicMock()
|
api.region.cache_on_arguments = mock.MagicMock()
|
||||||
api.region.cache_on_arguments.return_value = lambda x: x
|
api.region.cache_on_arguments.return_value = lambda x: x
|
||||||
res = self.app.get('/build_name/fake_tests/test_runs')
|
res = self.app.get('/build_name/%s/test_runs' % build_name)
|
||||||
self.assertEqual(200, res.status_code)
|
self.assertEqual(200, res.status_code)
|
||||||
api_mock.assert_called_once_with('build_name', 'fake_tests', None,
|
api_mock.assert_called_once_with('build_name', build_name, None,
|
||||||
None, api.Session())
|
None, api.Session())
|
||||||
expected_response = {
|
expected_response = {
|
||||||
six.text_type(timestamp_a.isoformat()): {
|
six.text_type(timestamp_a.isoformat()): {
|
||||||
|
@ -112,6 +112,12 @@ class TestRestAPI(base.TestCase):
|
||||||
self.assertEqual({u'tests': expected_response},
|
self.assertEqual({u'tests': expected_response},
|
||||||
json.loads(res.data.decode('utf-8')))
|
json.loads(res.data.decode('utf-8')))
|
||||||
|
|
||||||
|
def test_get_test_runs_by_build_name(self):
|
||||||
|
self._test_get_test_runs_by_build_name('fake_tests')
|
||||||
|
|
||||||
|
def test_get_test_runs_by_build_name_with_forward_slash(self):
|
||||||
|
self._test_get_test_runs_by_build_name('fake/tests')
|
||||||
|
|
||||||
def test_list_routes(self):
|
def test_list_routes(self):
|
||||||
res = self.app.get('/')
|
res = self.app.get('/')
|
||||||
res_dict = json.loads(res.data.decode('utf-8'))
|
res_dict = json.loads(res.data.decode('utf-8'))
|
||||||
|
|
Loading…
Reference in New Issue