]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard_v2: added first unit test example
authorRicardo Dias <rdias@suse.com>
Tue, 27 Feb 2018 11:45:56 +0000 (11:45 +0000)
committerRicardo Dias <rdias@suse.com>
Mon, 5 Mar 2018 13:06:57 +0000 (13:06 +0000)
Signed-off-by: Ricardo Dias <rdias@suse.com>
src/pybind/mgr/dashboard_v2/.coveragerc [new file with mode: 0644]
src/pybind/mgr/dashboard_v2/tests/__init__.py [new file with mode: 0644]
src/pybind/mgr/dashboard_v2/tests/test_ping.py [new file with mode: 0644]

diff --git a/src/pybind/mgr/dashboard_v2/.coveragerc b/src/pybind/mgr/dashboard_v2/.coveragerc
new file mode 100644 (file)
index 0000000..3832b81
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
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 (file)
index 0000000..385e9f9
--- /dev/null
@@ -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"')
+