def _save_file(self, parsed, **kwargs): if not is_parsed_result_successful(parsed): return method = self._method.value outfile = self._outfile.value if method in parsed['VirtualMFADevice']: body = parsed['VirtualMFADevice'][method] with open(outfile, 'wb') as fp: fp.write(base64.b64decode(body)) for choice in CHOICES: if choice in parsed['VirtualMFADevice']: del parsed['VirtualMFADevice'][choice]
def test_checks_if_invalid_result(self): result = {'ResponseMetadata': {'HTTPStatusCode': 300}} self.assertFalse(is_parsed_result_successful(result))
def test_checks_if_invalid_result(self): result = {"ResponseMetadata": {"HTTPStatusCode": 300}} self.assertFalse(is_parsed_result_successful(result))
def test_checks_if_valid_result(self): result = {'ResponseMetadata': {'HTTPStatusCode': 200}} self.assertTrue(is_parsed_result_successful(result))