def test_get_password_data(self, query, get_provider, get_location, _get_node): query.return_value = [{"passwordData": PASS_DATA}] _get_node.return_value = {"instanceId": "i-abcdef"} get_location.return_value = "us-west2" get_provider.return_value = "ec2" with salt.utils.files.fopen(self.key_file, "w") as fp: fp.write(PRIVKEY_DATA) ret = ec2.get_password_data( name="i-abcddef", kwargs={"key_file": self.key_file}, call="action" ) assert ret["passwordData"] == PASS_DATA assert ret["password"] == "testp4ss!"
def test_get_password_data(self, query, get_provider, get_location, _get_node): query.return_value = [{'passwordData': PASS_DATA}] _get_node.return_value = {'instanceId': 'i-abcdef'} get_location.return_value = 'us-west2' get_provider.return_value = 'ec2' with salt.utils.files.fopen(self.key_file, 'w') as fp: fp.write(PRIVKEY_DATA) ret = ec2.get_password_data(name='i-abcddef', kwargs={'key_file': self.key_file}, call='action') assert ret['passwordData'] == PASS_DATA assert ret['password'] == b'testp4ss!'