def test_mark_host_installed(self): with self.app.test_request_context('/'): result = hosts.mark_host_installed(self.host_id) params = copy.deepcopy(self.host_params) params["groups"].append("installed") result = hosts.get_host(self.host_id) self.assertEqual(result, params) result = hosts.unmark_host_installed(self.host_id) result = hosts.get_host(self.host_id) self.assertEqual(result, self.host_params)
def test_update_host(self): with self.app.test_request_context('/'): result = hosts.update_host(self.host_id, copy.copy(self.host_params2)) self.assertEqual(result, None) result = hosts.get_host(self.host_id) self.assertEqual(result, self.host_params2)
def _get(uuid): if request.args.get('installed') == 'mark': mark_host_installed(uuid) return make_response("", 200, []) if request.args.get('installed') == 'unmark': unmark_host_installed(uuid) return make_response("", 200, []) if request.args.get('params') == 'all': return jsonify(get_host_params(uuid)) return jsonify(get_host(uuid))
def test_get_host(self): with self.app.test_request_context('/'): result = hosts.get_host(self.host_id) self.assertEqual(result, self.host_params)