Пример #1
0
    def test_adding_arguments_to_method_registering(self):
        order_register = OrderedExecutionMock(self.class_to_test)
        order_register.register("methodC", "arg1", "arg2")

        self.class_to_test.methodC("arg1", "arg2")

        order_register.verify_order()
Пример #2
0
    def test_adding_arguments_to_method_registering(self):
        order_register = OrderedExecutionMock(self.class_to_test)
        order_register.register("methodC", "arg1", "arg2")

        self.class_to_test.methodC("arg1", "arg2")

        order_register.verify_order()
Пример #3
0
    def test_wrong_method_arguments_should_raise_an_exception(self):
        order_register = OrderedExecutionMock(self.class_to_test)
        order_register.register("methodC", "arg1", "arg2")

        try:
            self.class_to_test.methodC("bad_arg1", "bad_arg2")
        except BadArgumentException:
            pass  # Test success
Пример #4
0
    def test_wrong_method_arguments_should_raise_an_exception(self):
        order_register = OrderedExecutionMock(self.class_to_test)
        order_register.register("methodC", "arg1", "arg2")

        try:
            self.class_to_test.methodC("bad_arg1", "bad_arg2")
        except BadArgumentException:
            pass  # Test success
Пример #5
0
    def test_ordered_execution_should_not_raise_any_exception(self):
        order_register = OrderedExecutionMock(self.class_to_test)
        order_register.register("methodA")
        order_register.register("methodB")

        self.class_to_test.methodA()
        self.class_to_test.methodB()

        order_register.verify_order()
Пример #6
0
    def test_ordered_execution_should_not_raise_any_exception(self):
        order_register = OrderedExecutionMock(self.class_to_test)
        order_register.register("methodA")
        order_register.register("methodB")

        self.class_to_test.methodA()
        self.class_to_test.methodB()

        order_register.verify_order()
Пример #7
0
    def test_adding_method_arguments_to_multiple_calls_of_the_same_method(self):
        order_register = OrderedExecutionMock(self.class_to_test)
        order_register.register("methodC", "arg1", "arg2")
        order_register.register("methodC", "arg3", "arg4")

        self.class_to_test.methodC("arg1", "arg2")
        self.class_to_test.methodC("arg3", "arg4")

        order_register.verify_order()
Пример #8
0
    def test_adding_method_arguments_to_multiple_calls_of_the_same_method(
            self):
        order_register = OrderedExecutionMock(self.class_to_test)
        order_register.register("methodC", "arg1", "arg2")
        order_register.register("methodC", "arg3", "arg4")

        self.class_to_test.methodC("arg1", "arg2")
        self.class_to_test.methodC("arg3", "arg4")

        order_register.verify_order()
Пример #9
0
    def test_ordered_execution_with_too_many_executions(self):
        order_register = OrderedExecutionMock(self.class_to_test)
        order_register.register("methodA")
        order_register.register("methodB")

        try:
            self.class_to_test.methodA()
            self.class_to_test.methodA()
            self.fail("Exception expected!")
        except MissingRegisteredCalls:
            pass  # Test Success
Пример #10
0
    def test_ordered_execution_with_too_many_executions(self):
        order_register = OrderedExecutionMock(self.class_to_test)
        order_register.register("methodA")
        order_register.register("methodB")

        try:
            self.class_to_test.methodA()
            self.class_to_test.methodA()
            self.fail("Exception expected!")
        except MissingRegisteredCalls:
            pass  # Test Success
Пример #11
0
    def test_ordered_execution_with_missing_method_call(self):
        order_register = OrderedExecutionMock(self.class_to_test)
        order_register.register("methodA")
        order_register.register("methodB")

        self.class_to_test.methodA()

        try:
            order_register.verify_order()
            self.fail("Exception expected!")
        except MissingExecutionError:
            pass  # Test Success
Пример #12
0
    def test_ordered_execution_with_missing_method_call(self):
        order_register = OrderedExecutionMock(self.class_to_test)
        order_register.register("methodA")
        order_register.register("methodB")

        self.class_to_test.methodA()

        try:
            order_register.verify_order()
            self.fail("Exception expected!")
        except MissingExecutionError:
            pass  # Test Success
Пример #13
0
    def test_ordered_execution_repeating_method_calls(self):
        order_register = OrderedExecutionMock(self.class_to_test)
        order_register.register("methodA")
        order_register.register("methodB")
        order_register.register("methodA")
        order_register.register("methodB")

        self.class_to_test.methodA()
        self.class_to_test.methodB()
        self.class_to_test.methodA()
        self.class_to_test.methodB()

        order_register.verify_order()
Пример #14
0
    def test_ordered_execution_should_raise_an_exception(self):
        order_register = OrderedExecutionMock(self.class_to_test)
        order_register.register("methodA")
        order_register.register("methodB")

        self.class_to_test.methodB()
        self.class_to_test.methodA()

        try:
            order_register.verify_order()
            self.fail("Exception expected!")
        except ExecutionOrderError:
            pass  # Test Success
Пример #15
0
    def test_ordered_execution_repeating_method_calls(self):
        order_register = OrderedExecutionMock(self.class_to_test)
        order_register.register("methodA")
        order_register.register("methodB")
        order_register.register("methodA")
        order_register.register("methodB")

        self.class_to_test.methodA()
        self.class_to_test.methodB()
        self.class_to_test.methodA()
        self.class_to_test.methodB()

        order_register.verify_order()
Пример #16
0
    def test_ordered_execution_should_raise_an_exception(self):
        order_register = OrderedExecutionMock(self.class_to_test)
        order_register.register("methodA")
        order_register.register("methodB")

        self.class_to_test.methodB()
        self.class_to_test.methodA()

        try:
            order_register.verify_order()
            self.fail("Exception expected!")
        except ExecutionOrderError:
            pass  # Test Success