示例#1
0
    def test_should_return_answer_from_dictionary(self):
        answer_dictionary = {'stdout': 'Hello world.',
                             'stderr': 'Hello error!',
                             'return_code': 82,
                             'milliseconds_to_wait': 2}

        actual_answer = Answer.from_dictionary(answer_dictionary)

        self.assertEqual('Hello world.', actual_answer.stdout)
        self.assertEqual('Hello error!', actual_answer.stderr)
        self.assertEqual(82, actual_answer.return_code)
        self.assertEqual(2, actual_answer.milliseconds_to_wait)
示例#2
0
    def test_should_return_answer_from_dictionary(self):
        answer_dictionary = {
            'stdout': 'Hello world.',
            'stderr': 'Hello error!',
            'return_code': 82,
            'milliseconds_to_wait': 2
        }

        actual_answer = Answer.from_dictionary(answer_dictionary)

        self.assertEqual('Hello world.', actual_answer.stdout)
        self.assertEqual('Hello error!', actual_answer.stderr)
        self.assertEqual(82, actual_answer.return_code)
        self.assertEqual(2, actual_answer.milliseconds_to_wait)
示例#3
0
    def from_dictionary(dictionary):
        """
            returns a new stub configuration object with the properties from the given dictionary
        """
        answers = []

        for answer_dictionary in dictionary['answers']:
            answer = Answer.from_dictionary(answer_dictionary)
            answers.append(answer)

        command_input_dictionary = dictionary['command_input']
        stub_configuration = StubConfiguration(
            command_input_dictionary['command'],
            command_input_dictionary['arguments'],
            command_input_dictionary['stdin'], answers,
            dictionary['current_answer'])

        return stub_configuration
示例#4
0
    def from_dictionary(dictionary):
        """
            returns a new stub configuration object with the properties from the given dictionary
        """
        answers = []

        for answer_dictionary in dictionary['answers']:
            answer = Answer.from_dictionary(answer_dictionary)
            answers.append(answer)

        command_input_dictionary = dictionary['command_input']
        stub_configuration = StubConfiguration(
            command_input_dictionary['command'],
            command_input_dictionary[
                'arguments'],
            command_input_dictionary[
                'stdin'],
            answers,
            dictionary['current_answer'])

        return stub_configuration