That way we can properly update the UI when federation is enabled or not
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
docs/API.md | 1 +
src/kimchi/mockmodel.py | 3 ++-
src/kimchi/model/config.py | 3 ++-
tests/test_rest.py | 12 +++++-------
4 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/docs/API.md b/docs/API.md
index cb761e5..42eabd2 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -627,6 +627,7 @@ creation.
system; False, otherwise
* repo_mngt_tool: 'deb', 'yum' or None - when the repository
management
tool is not identified
+ * federation: 'on' if federation feature is enabled, 'off'
otherwise.
* **POST**: *See Configuration Actions*
**Actions (POST):**
diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
index 107aef4..ae87541 100644
--- a/src/kimchi/mockmodel.py
+++ b/src/kimchi/mockmodel.py
@@ -74,7 +74,8 @@ class MockModel(object):
'screenshot': True,
'system_report_tool': True,
'update_tool': True,
- 'repo_mngt_tool': 'yum'}
+ 'repo_mngt_tool': 'yum',
+ 'federation': 'off'}
def reset(self):
self._mock_vms = {}
diff --git a/src/kimchi/model/config.py b/src/kimchi/model/config.py
index 90bb923..1c00cfe 100644
--- a/src/kimchi/model/config.py
+++ b/src/kimchi/model/config.py
@@ -109,7 +109,8 @@ class CapabilitiesModel(object):
'screenshot': VMScreenshot.get_stream_test_result(),
'system_report_tool': bool(report_tool),
'update_tool': update_tool,
- 'repo_mngt_tool': repo_mngt_tool}
+ 'repo_mngt_tool': repo_mngt_tool,
+ 'federation': kconfig.get("server",
"federation")}
class DistrosModel(object):
diff --git a/tests/test_rest.py b/tests/test_rest.py
index a070f14..e97eabb 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -1531,13 +1531,11 @@ class RestTests(unittest.TestCase):
def test_capabilities(self):
resp = self.request('/config/capabilities').read()
conf = json.loads(resp)
- self.assertIn('libvirt_stream_protocols', conf)
- self.assertIn('qemu_stream', conf)
- self.assertIn('qemu_spice', conf)
- self.assertIn('screenshot', conf)
- self.assertIn('system_report_tool', conf)
- self.assertIn('update_tool', conf)
- self.assertIn('repo_mngt_tool', conf)
+
+ keys = ['libvirt_stream_protocols', 'qemu_stream',
'qemu_spice',
+ 'screenshot', 'system_report_tool',
'update_tool',
+ 'repo_mngt_tool', 'federation']
+ self.assertEquals(sorted(keys), sorted(conf.keys()))
def test_peers(self):
resp = self.request('/peers').read()
--
1.9.3