diff --git a/surveil/api/app.py b/surveil/api/app.py index 8d86f75..c936082 100644 --- a/surveil/api/app.py +++ b/surveil/api/app.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -from pecan import make_app +import pecan # from pecanrest import model @@ -21,7 +21,7 @@ def setup_app(config): # model.init_model() app_conf = dict(config.app) - return make_app( + return pecan.make_app( app_conf.pop('root'), logging=getattr(config, 'logging', {}), **app_conf diff --git a/surveil/api/controllers/v1/hosts.py b/surveil/api/controllers/v1/hosts.py index 7d41129..be70ad2 100644 --- a/surveil/api/controllers/v1/hosts.py +++ b/surveil/api/controllers/v1/hosts.py @@ -24,7 +24,7 @@ class HostController(rest.RestController): @pecan.expose() def get(self): - """Returns a specific host """ + """Returns a specific host.""" return "Returns a specific host: " + self._id @@ -36,5 +36,5 @@ class HostsController(rest.RestController): @pecan.expose() def get_all(self): - """ Returns all host """ + """Returns all host.""" return "Returns all hosts" diff --git a/surveil/api/controllers/v1/v1.py b/surveil/api/controllers/v1/v1.py index 7d049ed..17be0a2 100644 --- a/surveil/api/controllers/v1/v1.py +++ b/surveil/api/controllers/v1/v1.py @@ -17,6 +17,6 @@ from surveil.api.controllers.v1 import hosts class V1Controller(object): - """ Version 1 API controller root.""" + """Version 1 API controller root.""" hello = hello.HelloController() hosts = hosts.HostsController() diff --git a/surveil/tests/api/controllers/v1/test_hello.py b/surveil/tests/api/controllers/v1/test_hello.py index 9507b17..1a3a427 100644 --- a/surveil/tests/api/controllers/v1/test_hello.py +++ b/surveil/tests/api/controllers/v1/test_hello.py @@ -12,10 +12,10 @@ # License for the specific language governing permissions and limitations # under the License. -from surveil.tests.api.functionalTest import FunctionalTest +import surveil.tests.api.functionalTest -class TestRootController(FunctionalTest): +class TestRootController(surveil.tests.api.functionalTest.FunctionalTest): def test_get(self): response = self.app.get('/v1/hello') diff --git a/surveil/tests/api/functionalTest.py b/surveil/tests/api/functionalTest.py index 497d35b..500e3d5 100644 --- a/surveil/tests/api/functionalTest.py +++ b/surveil/tests/api/functionalTest.py @@ -12,21 +12,23 @@ # License for the specific language governing permissions and limitations # under the License. -from unittest import TestCase -from pecan import set_config -from pecan.testing import load_test_app +import pecan +import pecan.testing + +import unittest __all__ = ['FunctionalTest'] -class FunctionalTest(TestCase): - """ - Used for functional tests where you need to test your - literal application and its integration with the framework. +class FunctionalTest(unittest.TestCase): + """Used for functional tests. + + Used where you need to test your literal + application and its integration with the framework. """ def setUp(self): - self.app = load_test_app({ + self.app = pecan.testing.load_test_app({ 'app': { 'root': 'surveil.api.controllers.root.RootController', 'modules': ['surveil.api'], @@ -35,4 +37,4 @@ class FunctionalTest(TestCase): }) def tearDown(self): - set_config({}, overwrite=True) + pecan.set_config({}, overwrite=True)