Пример #1
0
 def testOperationResultMixedOutput(self):
     operation = BasicBinaryOperation(self.basic_binary)
     result = operation(string_val='MIXED_OUTPUT', int_val=10)
     with self.assertRaisesRegex(
             binary_operations.StructuredOutputError,
             r'Error processing message '
             r'\[Raw Status Message.\]'):
         binary_operations.ProcessStructuredErr(result)
Пример #2
0
 def testOperationResultSuccess_WithWarning(self):
     operation = BasicBinaryOperation(self.basic_binary)
     expected_err_messages = ['A status message: 10.']
     expected_errors = []
     result = operation(string_val='SIMPLE_STATUS_TO_STDERR',
                        int_val=10,
                        env={'FOO': 'bar'},
                        stdin='input',
                        execution_dir='.')
     actual_out_messages, actual_resources = (
         binary_operations.ProcessStructuredOut(result))
     actual_err_messages, actual_errors = (
         binary_operations.ProcessStructuredErr(result))
     self.assertFalse(result.failed)
     self.assertIsNone(actual_out_messages)
     self.assertIsNone(actual_resources)
     self.assertEqual(expected_err_messages, actual_err_messages)
     self.assertEqual(expected_errors, actual_errors)
Пример #3
0
 def testOperationResultSuccess_WithResources(self):
     operation = BasicBinaryOperation(self.basic_binary)
     expected_messages = ['A status message.']
     expected_resource_match = r"\'name\': \'Resource1\'"
     result = operation(string_val='SIMPLE_RESOURCE_OUTPUT',
                        int_val=10,
                        env={'FOO': 'bar'},
                        stdin='input',
                        execution_dir='.')
     actual_out_messages, actual_resources = (
         binary_operations.ProcessStructuredOut(result))
     actual_err_messages, actual_errors = (
         binary_operations.ProcessStructuredErr(result))
     self.assertFalse(result.failed)
     self.assertEqual(expected_messages, actual_out_messages)
     self.assertRegex(six.text_type(actual_resources[0]),
                      expected_resource_match)
     self.assertIsNone(actual_err_messages)
     self.assertIsNone(actual_errors)
Пример #4
0
 def testOperationResultError_WithWarning(self):
     operation = BasicBinaryOperation(self.basic_binary)
     expected_errors = [
         'Error: [Error]. Additional details: [Exiting with error 10.]'
     ]
     expected_err_messages = ['A status message.']
     result = operation(string_val='EXIT_WITH_WARNING_AND_ERROR',
                        int_val=10,
                        env={'FOO': 'bar'},
                        stdin='input',
                        execution_dir='.')
     actual_out_messages, actual_resources = (
         binary_operations.ProcessStructuredOut(result))
     actual_err_messages, actual_errors = (
         binary_operations.ProcessStructuredErr(result))
     self.assertTrue(result.failed)
     self.assertIsNone(actual_out_messages)
     self.assertIsNone(actual_resources)
     self.assertEqual(expected_errors, actual_errors)
     self.assertEqual(expected_err_messages, actual_err_messages)