summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/testing/user/configguide/configuration.rst2
-rw-r--r--docs/testing/user/userguide/api.rst3
-rw-r--r--qtip/reporter/filters.py14
-rw-r--r--test-requirements.txt1
-rw-r--r--tests/unit/reporter/filters_test.py19
5 files changed, 35 insertions, 4 deletions
diff --git a/docs/testing/user/configguide/configuration.rst b/docs/testing/user/configguide/configuration.rst
index 0ca7ae8c..f048558e 100644
--- a/docs/testing/user/configguide/configuration.rst
+++ b/docs/testing/user/configguide/configuration.rst
@@ -41,7 +41,7 @@ Run and enter the docker instance
::
envs="INSTALLER_TYPE={INSTALLER_TYPE} -e INSTALLER_IP={INSTALLER_IP}"
- docker run --name qtip -id -e $envs opnfv/qtip
+ docker run -p [HOST_IP:]<HOST_PORT>:5000 --name qtip -id -e $envs opnfv/qtip
docker exec -i -t qtip /bin/bash
``INSTALLER_TYPE`` should be one of OPNFV installer, e.g. apex, compass, daisy, fuel
diff --git a/docs/testing/user/userguide/api.rst b/docs/testing/user/userguide/api.rst
index 7e1d7b1c..05b0e8f2 100644
--- a/docs/testing/user/userguide/api.rst
+++ b/docs/testing/user/userguide/api.rst
@@ -19,8 +19,7 @@ Running
After installing QTIP. API server can be run using command ``qtip-api`` on the local machine.
-All the resources and their corresponding operation details can be seen at ``/v1.0/ui``,
-on hosting server(``0.0.0.0:5000`` for the local machine).
+All the resources and their corresponding operation details can be seen at ``/v1.0/ui``.
The whole API specification in json format can be seen at ``/v1.0/swagger.json``.
diff --git a/qtip/reporter/filters.py b/qtip/reporter/filters.py
new file mode 100644
index 00000000..dc46e195
--- /dev/null
+++ b/qtip/reporter/filters.py
@@ -0,0 +1,14 @@
+###############################################################
+# Copyright (c) 2017 ZTE Corporation
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+
+def justify(pair, width=100, padding_with='.'):
+ """align first element along the left margin, second along the right, padding spaces"""
+ n = width - len(pair[0])
+ return '{key}{value:{c}>{n}}'.format(key=pair[0], value=pair[1], c=padding_with, n=n)
diff --git a/test-requirements.txt b/test-requirements.txt
index 5b770010..24405245 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -2,7 +2,6 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
-coverage
mock
pip_check_reqs
pykwalify
diff --git a/tests/unit/reporter/filters_test.py b/tests/unit/reporter/filters_test.py
new file mode 100644
index 00000000..2ced9304
--- /dev/null
+++ b/tests/unit/reporter/filters_test.py
@@ -0,0 +1,19 @@
+##############################################################################
+# Copyright (c) 2017 ZTE Corporation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+
+from qtip.reporter import filters
+from jinja2 import Environment
+
+
+def test_justify():
+ env = Environment()
+ env.filters['justify'] = filters.justify
+ template = env.from_string('{{ kvpair|justify(width=10) }}')
+ assert template.render(kvpair=('key', 'value')) == 'key..value'