[Kimchi-devel] [PATCH 1/2] WoK: making /tests/utils.py available to all WoK plug-ins

dhbarboza82 at gmail.com dhbarboza82 at gmail.com
Wed Nov 18 20:32:20 UTC 2015


From: Daniel Henrique Barboza <dhbarboza82 at gmail.com>

There are several common functions such as run_tests,
get_free_port and running_as_root that should be available
to all plug-ins. This patch enables the module /tests/utils.py
of WoK to be used by any unit test of any WoK plug-in. There's
also a small tweak in utils.py that allows the retrieval of
its 'fake_user' attribute.

This patch is part of the solution of Kimchi Github #760.

Signed-off-by: Daniel Henrique Barboza <dhbarboza82 at gmail.com>
---
 tests/__init__.py | 18 ++++++++++++++++++
 tests/utils.py    |  6 +++++-
 2 files changed, 23 insertions(+), 1 deletion(-)
 create mode 100644 tests/__init__.py

diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 0000000..784a988
--- /dev/null
+++ b/tests/__init__.py
@@ -0,0 +1,18 @@
+#
+# Project Wok
+#
+# Copyright IBM, Corp. 2015
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
diff --git a/tests/utils.py b/tests/utils.py
index dcea7d9..50d423f 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -44,7 +44,11 @@ from wok.utils import wok_log
 
 
 _ports = {}
-fake_user = {'test': 'passw0rd'}
+fake_user = {'root': 'letmein!'}
+
+
+def get_fake_user():
+    return fake_user
 
 # provide missing unittest decorators and API for python 2.6; these decorators
 # do not actually work, just avoid the syntax failure
-- 
2.4.3




More information about the Kimchi-devel mailing list