summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ick2/controllerapi.py13
-rw-r--r--ick2/controllerapi_tests.py4
2 files changed, 17 insertions, 0 deletions
diff --git a/ick2/controllerapi.py b/ick2/controllerapi.py
index 63daa94..4f2872b 100644
--- a/ick2/controllerapi.py
+++ b/ick2/controllerapi.py
@@ -231,12 +231,18 @@ class ProjectAPI(ResourceApiBase):
def get_pipeline_routes(self, path): # pragma: no cover
pipeline_path = '{}/<project>/pipelines/<pipeline>'.format(path)
+ builds_path = '{}/<project>/builds'.format(path)
return [
{
'method': 'GET',
'path': pipeline_path,
'callback': self.GET(self.get_pipeline),
},
+ {
+ 'method': 'GET',
+ 'path': builds_path,
+ 'callback': self.GET(self.get_builds),
+ },
]
def get_pipeline(self, project, pipeline):
@@ -248,6 +254,13 @@ class ProjectAPI(ResourceApiBase):
}
raise ick2.NotFound()
+ def get_builds(self, project):
+ p = self._state.get_resource(self._type_name, project)
+ return {
+ 'project': project,
+ 'builds': p.get('builds', []),
+ }
+
def response(status_code, body, headers): # pragma: no cover
obj = {
diff --git a/ick2/controllerapi_tests.py b/ick2/controllerapi_tests.py
index ec5f1a2..e46137c 100644
--- a/ick2/controllerapi_tests.py
+++ b/ick2/controllerapi_tests.py
@@ -101,6 +101,10 @@ class ProjectAPITests(unittest.TestCase):
self.assertEqual(api.create(project), project)
self.assertEqual(api.list(), {'projects': [project]})
self.assertEqual(api.get_pipeline('foo', 'build'), {'status': 'idle'})
+ self.assertEqual(
+ api.get_builds('foo'),
+ {'project': 'foo', 'builds': []}
+ )
def test_raises_error_when_getting_missing_pipeline(self):
project = {