Exemplo n.º 1
0
def test_transformer_service_block_when(patch, tree):
    """
    Ensures service_block nodes with a when block are transformed correctly
    """
    tree.block.rules = None
    matches = ['service_block', tree]
    result = Transformer.service_block(matches)
    assert result == Tree('service_block', matches)
Exemplo n.º 2
0
def test_transformer_service_block_indented_args(tree, magic):
    """
    Ensures service_block with indented arguments are transformed correctly.
    """
    tree.find_data.return_value = ['argument']
    block = magic()
    matches = [block, tree]
    result = Transformer.service_block(matches)
    block.service_fragment.children.append.assert_called_with('argument')
    assert result == Tree('service_block', [block])
Exemplo n.º 3
0
def test_transformer_service_block_when(patch, tree):
    """
    Ensures service_block nodes with a when block are transformed correctly
    """
    patch.object(Transformer, 'implicit_output')
    tree.block.rules = None
    matches = ['service_block', tree]
    result = Transformer.service_block(matches)
    Transformer.implicit_output.assert_called_with('service_block')
    assert result == Tree('service_block', matches)
Exemplo n.º 4
0
def test_transformer_service_block_indented_args(tree, magic, patch):
    """
    Ensures service_block with indented arguments are transformed correctly.
    """
    patch.object(Transformer, "filter_nested_block", return_value=["argument"])
    block = magic()
    matches = [block, tree]
    result = Transformer.service_block(matches)
    block.service_fragment.children.append.assert_called_with("argument")
    assert result == Tree("service_block", [block])
Exemplo n.º 5
0
def test_transformer_service_block():
    """
    Ensures service_block nodes are transformed correctly
    """
    assert Transformer.service_block([]) == Tree('service_block', [])