def test_require_batch_id_not_advanced_if_same_node(message): batch_identifier = get_operation(message).batch_identifier require_batch_id_not_advanced_if_same_node( RolledBack( message.header.publisher, batch_identifier, ), message, ) require_batch_id_not_advanced_if_same_node( RolledBack( message.header.publisher, copy(batch_identifier, node=uuid.uuid1().bytes), ), message, ) with pytest.raises(InvalidBatch): require_batch_id_not_advanced_if_same_node( RolledBack( message.header.publisher, copy(batch_identifier, id=batch_identifier.id + 1), ), message, )
def test_require_same_batch(message): batch_identifier = get_operation(message).batch_identifier require_same_batch( InTransaction( message.header.publisher, batch_identifier, ), message, ) with pytest.raises(InvalidBatch): require_same_batch( InTransaction( message.header.publisher, copy(batch_identifier, id=batch_identifier.id + 1), ), message, )
def test_require_different_publisher(message): batch_identifier = get_operation(message).batch_identifier require_different_publisher( Committed( uuid.uuid1().bytes, # change the publisher batch_identifier, ), message, ) with pytest.raises(InvalidPublisher): require_different_publisher( Committed( message.header.publisher, batch_identifier, ), message, )