Ejemplo n.º 1
0
 def testOperationResultSuccess(self):
     operation = BasicBinaryOperation(self.basic_binary)
     expected_messages = ['An output message: 1.']
     expected_resources = []
     result = operation(string_val='SIMPLE_OUTPUT',
                        int_val=1,
                        env={'FOO': 'bar'},
                        stdin='input',
                        execution_dir='.')
     actual_messages, actual_resources = (
         binary_operations.ProcessStructuredOut(result))
     self.assertFalse(result.failed)
     self.assertEqual(expected_messages, actual_messages)
     self.assertEqual(expected_resources, actual_resources)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)