示例#1
0
    def check(factory):
        first_instance = factory.create()
        instance = factory.create(
            update_type=update_type,
            version_group=first_instance.version_group,
        )

        with raises_if(UpdateValidity.Violation, expected_error):
            UpdateValidity(instance.transaction).validate(instance)

        return True
示例#2
0
    def check(factory):
        transaction = factories.TransactionFactory.create()
        first_instance = factory.create(update_type=UpdateType.DELETE)
        second_instance = factory.create(
            transaction=transaction,
            update_type=UpdateType.UPDATE,
            version_group=first_instance.version_group,
        )

        with pytest.raises(UpdateValidity.Violation, ):
            UpdateValidity(second_instance.transaction).validate(
                second_instance, )

        return True
示例#3
0
    def check(factory):
        instance = factory.create(update_type=update_type)

        # Create a future instance – the business rule should ignore this
        # but the test for CREATE will fail if it does not.
        factory.create(
            update_type=UpdateType.UPDATE,
            transaction__workbasket=instance.transaction.workbasket,
            transaction__order=instance.transaction.order + 1,
        )

        with raises_if(UpdateValidity.Violation, expected_error):
            UpdateValidity(instance.transaction).validate(instance)

        return True