def test_variable_resolving(self):
     vars = _VariableStash()
     var_table = VariableTable(ParentMock())
     var_table.add('${var1}', 'foo')
     var_table.add('${var2}', 'bar')
     vars.set_from_variable_table(var_table)
     result = vars.replace_variables('hoo${var1}hii${var2}huu')
     assert_equals('hoofoohiibarhuu', result)
示例#2
0
 def test_variable_resolving_with_unresolvable_value(self):
     vars = _VariableStash()
     var_table = VariableTable(ParentMock())
     var_table.add('${var1}', '${unresolvable variable}')
     var_table.add('${var2}', 'bar')
     vars.set_from_variable_table(var_table)
     self._variable_stash_contains('var1', vars)
     self._variable_stash_contains('var2', vars)
示例#3
0
 def test_variable_resolving(self):
     vars = _VariableStash()
     var_table = VariableTable(ParentMock())
     var_table.add('${var1}', 'foo')
     var_table.add('${var2}', 'bar')
     vars.set_from_variable_table(var_table)
     result = vars.replace_variables('hoo${var1}hii${var2}huu')
     assert_equals('hoofoohiibarhuu', result)
 def test_variable_resolving_with_unresolvable_value(self):
     vars = _VariableStash()
     var_table = VariableTable(ParentMock())
     var_table.add('${var1}', '${unresolvable variable}')
     var_table.add('${var2}', 'bar')
     vars.set_from_variable_table(var_table)
     self._variable_stash_contains('var1', vars)
     self._variable_stash_contains('var2', vars)
 def test_dict_variable_key_resolving(self):
     vars = _VariableStash()
     var_table = VariableTable(ParentMock())
     var_table.add('&{var}', ['foo=bar'])
     vars.set_from_variable_table(var_table)
     assert_equals('Hi, bar!', vars.replace_variables('Hi, &{var}[foo]!'))
 def test_list_variable_index_resolving(self):
     vars = _VariableStash()
     var_table = VariableTable(ParentMock())
     var_table.add('@{var}', ['foo', 'bar'])
     vars.set_from_variable_table(var_table)
     assert_equals('Hi, foo!', vars.replace_variables('Hi, @{var}[0]!'))
示例#7
0
 def test_dict_variable_key_resolving(self):
     vars = _VariableStash()
     var_table = VariableTable(ParentMock())
     var_table.add('&{var}', ['foo=bar'])
     vars.set_from_variable_table(var_table)
     assert_equals('Hi, bar!', vars.replace_variables('Hi, &{var}[foo]!'))
示例#8
0
 def test_list_variable_index_resolving(self):
     vars = _VariableStash()
     var_table = VariableTable(ParentMock())
     var_table.add('@{var}', ['foo', 'bar'])
     vars.set_from_variable_table(var_table)
     assert_equals('Hi, foo!', vars.replace_variables('Hi, @{var}[0]!'))
 def setUp(self):
     self._variable_table_ctrl = VariableTableController(
         self, VariableTable(self))
     self.mock_ctrl()