예제 #1
0
    def test_should_pop_verified_execution(self):
        stub_execution = Execution(
            'command', ['-arg1', '-arg2'], 'stdin', expected=True)
        verifier = Verifier([stub_execution])

        verifier.called('command')

        self.assertEqual(0, len(verifier.executions))
예제 #2
0
    def test_should_raise_exception_when_one_more_recorded_calls_available_than_verified(self):
        execution1 = Execution(
            'command', ['-arg1', '-arg2'], 'stdin', expected=True)
        execution2 = Execution(
            'command', ['-arg1', '-arg2'], 'stdin', expected=True)
        verifier = Verifier([execution1, execution2])

        verifier.called('command')

        self.assertRaises(
            VerificationException, verifier.__exit__, None, None, None)
예제 #3
0
    def test_should_return_false_when_an_exception_occured_in_the_with_statement(self):
        execution1 = Execution(
            'command', ['-arg1', '-arg2'], 'stdin', expected=True)
        execution2 = Execution(
            'command', ['-arg1', '-arg2'], 'stdin', expected=True)
        verifier = Verifier([execution1, execution2])

        verifier.called('command')
        actual_result = verifier.__exit__(
            'exception_type', 'exception_value', 'traceback')

        self.assertFalse(actual_result)