From 5eda0e167038edcf63e00a102311ef7a12d02c03 Mon Sep 17 00:00:00 2001 From: Ricardo Dias Date: Tue, 27 Feb 2018 11:45:56 +0000 Subject: [PATCH] mgr/dashboard_v2: added first unit test example Signed-off-by: Ricardo Dias --- src/pybind/mgr/dashboard_v2/.coveragerc | 6 ++++++ src/pybind/mgr/dashboard_v2/tests/__init__.py | 0 .../mgr/dashboard_v2/tests/test_ping.py | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 src/pybind/mgr/dashboard_v2/.coveragerc create mode 100644 src/pybind/mgr/dashboard_v2/tests/__init__.py create mode 100644 src/pybind/mgr/dashboard_v2/tests/test_ping.py diff --git a/src/pybind/mgr/dashboard_v2/.coveragerc b/src/pybind/mgr/dashboard_v2/.coveragerc new file mode 100644 index 0000000000000..3832b81dbe00b --- /dev/null +++ b/src/pybind/mgr/dashboard_v2/.coveragerc @@ -0,0 +1,6 @@ +[run] +omit = tests/* + */python*/* + ceph_module_mock.py + __init__.py + diff --git a/src/pybind/mgr/dashboard_v2/tests/__init__.py b/src/pybind/mgr/dashboard_v2/tests/__init__.py new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/src/pybind/mgr/dashboard_v2/tests/test_ping.py b/src/pybind/mgr/dashboard_v2/tests/test_ping.py new file mode 100644 index 0000000000000..385e9f9b99b86 --- /dev/null +++ b/src/pybind/mgr/dashboard_v2/tests/test_ping.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +from __future__ import absolute_import + +from cherrypy.test import helper + +from ..module import Module, cherrypy + +class SimpleCPTest(helper.CPWebCase): + @staticmethod + def setup_server(): + module = Module('attic', None, None) + cherrypy.tree.mount(Module.HelloWorld(module)) + + def test_ping(self): + self.getPage("/ping") + self.assertStatus('200 OK') + self.assertBody('"pong"') + -- 2.39.5