Example #1
0
 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]
Example #2
0
 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]
Example #3
0
 def test_checks_if_invalid_result(self):
     result = {'ResponseMetadata': {'HTTPStatusCode': 300}}
     self.assertFalse(is_parsed_result_successful(result))
Example #4
0
 def test_checks_if_invalid_result(self):
     result = {"ResponseMetadata": {"HTTPStatusCode": 300}}
     self.assertFalse(is_parsed_result_successful(result))
Example #5
0
 def test_checks_if_valid_result(self):
     result = {'ResponseMetadata': {'HTTPStatusCode': 200}}
     self.assertTrue(is_parsed_result_successful(result))