Esempio n. 1
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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 4
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)
Esempio n. 5
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]!'))
Esempio n. 6
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]!'))
Esempio n. 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]!'))
Esempio n. 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()