Ejemplo n.º 1
0
def test_get_value_orig():
    arm = ArmFile('tests/test_template.json')
    arm.set_value('parameters.storageAccountType.defaultValue', 'changed')
    assert 'changed' == arm.get_value(
        'parameters.storageAccountType.defaultValue')
    assert 'Standard_LRS' == arm.get_original_value(
        'parameters.storageAccountType.defaultValue')
Ejemplo n.º 2
0
def test_set_value_list():
    arm = ArmFile('tests/test_template.json')
    key = 'resources'
    my_list = ['a', 'b', 'c']
    arm.set_value(key, my_list)
    changes = arm.get_change_log()
    old = 'old_value'
    new = 'new_value'
    assert changes[key][old] != changes[key][new]
    assert changes[key][new] == my_list
    assert arm.get_value(key) == my_list
Ejemplo n.º 3
0
def test_set_value_list_index():
    arm = ArmFile('tests/test_template.json')
    key = 'resources'
    my_dict = {"a": 1, "b": "string", "c": True}
    arm.set_value(key, my_dict, 0)
    changes = arm.get_change_log()
    old = 'old_value'
    new = 'new_value'
    assert changes[key][old] != changes[key][new]
    assert changes[key][new][0] == my_dict
    assert arm.get_value(key, 0) == my_dict
Ejemplo n.º 4
0
def test_set_value():
    arm = ArmFile('tests/test_template.json')
    arm.set_value('parameters.storageAccountType.defaultValue', 'changed')
    assert 'changed' == arm.get_value(
        'parameters.storageAccountType.defaultValue')
Ejemplo n.º 5
0
def test_get_value_list_index():
    arm = ArmFile('tests/test_template.json')
    key = 'resources'
    assert arm.get_value(key, 0) == arm._ArmFile__data[key][0]
Ejemplo n.º 6
0
def test_get_value_no_key():
    arm = ArmFile('tests/test_template.json')
    assert arm.get_value('') == arm._ArmFile__data
Ejemplo n.º 7
0
def test_get_value_error_2():
    arm = ArmFile('tests/test_template.json')
    key = 'parameters.storageAccountType.defaultValue.bad'
    with pytest.raises(KeyError, match=ArmFile.Errors.MISSING_KEY.format(key)):
        arm.get_value('parameters.storageAccountType.defaultValue.bad')
Ejemplo n.º 8
0
def test_get_value_changed_outside_of_class():
    arm = ArmFile('tests/test_template.json')
    v = arm.get_value('parameters.storageAccountType')
    v['type'] = 'changed'
    assert v != arm.get_value('parameters.storageAccountType')
Ejemplo n.º 9
0
def test_get_value_valid():
    arm = ArmFile('tests/test_template.json')
    assert arm.get_value(
        'parameters.storageAccountType.defaultValue') == 'Standard_LRS'