def test_inject_file_with_old_agent(self):
tmp_arg_dict = FAKE_ARG_DICT
request_id = tmp_arg_dict["id"]
b64_path = tmp_arg_dict["b64_path"]
b64_file = tmp_arg_dict["b64_contents"]
raw_path = base64.b64decode(b64_path)
raw_file = base64.b64decode(b64_file)
new_b64 = base64.b64encode("%s,%s" % (raw_path, raw_file))
self.mock_patch_object(self.agent,
'_get_agent_features',
'injectfile')
tmp_arg_dict["value"] = json.dumps({"name": "injectfile",
"value": new_b64})
tmp_arg_dict["path"] = "data/host/%s" % request_id
self.agent.inject_file(self.agent, FAKE_ARG_DICT)
self.agent._wait_for_agent.assert_called_once()
self.agent.xenstore.write_record.assert_called_with(self.agent,
tmp_arg_dict)
self.agent._get_agent_features.assert_called_once()
评论列表
文章目录