def test_get_variables_bad_variables_in_content(capsys):
    content = ('#<variables>\n'
               '#  <variable>\n'
               '#    <name>VAR_ONE</name>\n'
               '#    <value>Value One</value>\n'
               '#  </variable>\n'
               '#</variables>')
    with pytest.raises(SystemExit) as pytest_wrapped_e:
        get_variables(content)
    assert pytest_wrapped_e.type == SystemExit
    (out, err) = capsys.readouterr()
    assert 'ERROR: Invalid variable' in err
Beispiel #2
0
def test_get_variables_bad_variables_in_content(capsys):
    content = ('#<variables>\n'
               '#  <variable>\n'
               '#    <name>VAR_ONE</name>\n'
               '#    <value>Value One</value>\n'
               '#  </variable>\n'
               '#</variables>')
    with pytest.raises(SystemExit) as pytest_wrapped_e:
        get_variables(content)
    assert pytest_wrapped_e.type == SystemExit
    (out, err) = capsys.readouterr()
    assert 'ERROR: Invalid variable' in err
def test_get_variables_single_variable():
    content = ('#<variables>\n'
               '#  <variable>\n'
               '#    <name>VAR_ONE</name>\n'
               '#    <default>Value One</default>\n'
               '#  </variable>\n'
               '#</variables>')
    assert get_variables(content) == { 'VAR_ONE': 'Value One' }
Beispiel #4
0
def test_get_variables_single_variable():
    content = ('#<variables>\n'
               '#  <variable>\n'
               '#    <name>VAR_ONE</name>\n'
               '#    <default>Value One</default>\n'
               '#  </variable>\n'
               '#</variables>')
    assert get_variables(content) == {'VAR_ONE': 'Value One'}
def test_get_variables_multiple_variables():
    content = ('#<variables>\n'
               '#  <variable>\n'
               '#    <name>VAR_ONE</name>\n'
               '#    <default>Value One</default>\n'
               '#  </variable>\n'
               '#  <variable>\n'
               '#    <name>VAR_TWO</name>\n'
               '#    <default>Value Two</default>\n'
               '#  </variable>\n'
               '#  <variable>\n'
               '#    <name>VAR_THREE</name>\n'
               '#    <default>Value Three</default>\n'
               '#  </variable>\n'
               '#</variables>')
    assert get_variables(content) == {
        'VAR_ONE': 'Value One',
        'VAR_TWO': 'Value Two',
        'VAR_THREE': 'Value Three'
    }
Beispiel #6
0
def test_get_variables_multiple_variables():
    content = ('#<variables>\n'
               '#  <variable>\n'
               '#    <name>VAR_ONE</name>\n'
               '#    <default>Value One</default>\n'
               '#  </variable>\n'
               '#  <variable>\n'
               '#    <name>VAR_TWO</name>\n'
               '#    <default>Value Two</default>\n'
               '#  </variable>\n'
               '#  <variable>\n'
               '#    <name>VAR_THREE</name>\n'
               '#    <default>Value Three</default>\n'
               '#  </variable>\n'
               '#</variables>')
    assert get_variables(content) == {
        'VAR_ONE': 'Value One',
        'VAR_TWO': 'Value Two',
        'VAR_THREE': 'Value Three'
    }
def test_get_variables_no_variables_in_content():
    content = ('#<variables>\n'
               '#</variables>')
    assert get_variables(content) == {}
def test_get_variables_no_content():
    assert get_variables('') == {}
def test_get_variables_no_parameters():
    assert get_variables() == {}
Beispiel #10
0
def test_get_variables_no_variables_in_content():
    content = ('#<variables>\n' '#</variables>')
    assert get_variables(content) == {}
Beispiel #11
0
def test_get_variables_no_content():
    assert get_variables('') == {}
Beispiel #12
0
def test_get_variables_no_parameters():
    assert get_variables() == {}