
That way we can properly update the UI when federation is enabled or not Signed-off-by: Aline Manera <alinefm@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 4a7e9e1..40a0c0b 100644 --- a/docs/API.md +++ b/docs/API.md @@ -629,6 +629,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 6c07a38..e23c21a 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 b22a3d8..1bbdc47 100644 --- a/tests/test_rest.py +++ b/tests/test_rest.py @@ -1532,13 +1532,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