summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ick2/__init__.py2
-rw-r--r--ick2/controllerapi.py35
-rw-r--r--ick2/versionapi.py49
-rw-r--r--without-tests1
4 files changed, 52 insertions, 35 deletions
diff --git a/ick2/__init__.py b/ick2/__init__.py
index 002ac3b..c48629b 100644
--- a/ick2/__init__.py
+++ b/ick2/__init__.py
@@ -29,10 +29,10 @@ from .responses import (
text_plain,
)
from .apibase import APIbase
+from .versionapi import VersionAPI
from .controllerapi import (
ControllerAPI,
ProjectAPI,
- VersionAPI,
WorkAPI,
WorkerAPI,
)
diff --git a/ick2/controllerapi.py b/ick2/controllerapi.py
index 1c482fe..7c54cad 100644
--- a/ick2/controllerapi.py
+++ b/ick2/controllerapi.py
@@ -29,7 +29,7 @@ class ControllerAPI:
def find_missing_route(self, missing_path): # pragma: no cover
apis = {
- '/version': VersionAPI,
+ '/version': ick2.VersionAPI,
'/builds': BuildsAPI,
'/logs': LogAPI,
'/projects': ProjectAPI,
@@ -46,39 +46,6 @@ class ControllerAPI:
return routes
-class VersionAPI(ick2.APIbase):
-
- def __init__(self, state):
- super().__init__(state)
-
- def get_routes(self, path): # pragma: no cover
- return [
- {
- 'method': 'GET',
- 'path': path,
- 'callback': self.GET(self.get_version),
- }
- ]
-
- def get_version(self):
- return {'version': ick2.__version__}
-
- def create(self, *args): # pragma: no cover
- pass
-
- def update(self, *args): # pragma: no cover
- pass
-
- def delete(self, *args): # pragma: no cover
- pass
-
- def list(self): # pragma: no cover
- pass
-
- def show(self, *args): # pragma: no cover
- pass
-
-
class ResourceApiBase(ick2.APIbase):
def __init__(self, type_name, state):
diff --git a/ick2/versionapi.py b/ick2/versionapi.py
new file mode 100644
index 0000000..f17c333
--- /dev/null
+++ b/ick2/versionapi.py
@@ -0,0 +1,49 @@
+# Copyright (C) 2017 Lars Wirzenius
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+import ick2
+
+
+class VersionAPI(ick2.APIbase):
+
+ def __init__(self, state):
+ super().__init__(state)
+
+ def get_routes(self, path): # pragma: no cover
+ return [
+ {
+ 'method': 'GET',
+ 'path': path,
+ 'callback': self.GET(self.get_version),
+ }
+ ]
+
+ def get_version(self):
+ return {'version': ick2.__version__}
+
+ def create(self, *args): # pragma: no cover
+ pass
+
+ def update(self, *args): # pragma: no cover
+ pass
+
+ def delete(self, *args): # pragma: no cover
+ pass
+
+ def list(self): # pragma: no cover
+ pass
+
+ def show(self, *args): # pragma: no cover
+ pass
diff --git a/without-tests b/without-tests
index cc60aae..099db74 100644
--- a/without-tests
+++ b/without-tests
@@ -4,5 +4,6 @@ ick2/exceptions.py
ick2/logging.py
ick2/responses.py
ick2/version.py
+ick2/versionapi.py