Revision 534e7bbb kamaki/cli/config/test.py
b/kamaki/cli/config/test.py | ||
---|---|---|
300 | 300 |
with patch('kamaki.cli.config.Config.get', return_value=0) as get: |
301 | 301 |
self.assertRaises(KeyError, _cnf.get_cloud, 'mycloud', 'opt1') |
302 | 302 |
|
303 |
def test_get_global(self): |
|
304 |
from kamaki.cli.config import Config |
|
305 |
|
|
306 |
_cnf = Config(path=self.f.name) |
|
307 |
with patch('kamaki.cli.config.Config.get', return_value='val') as get: |
|
308 |
self.assertEqual('val', _cnf.get_global('opt')) |
|
309 |
get.assert_called_once_with('global', 'opt') |
|
310 |
|
|
311 | 303 |
@patch('kamaki.cli.config.Config.set') |
312 | 304 |
def test_set_cloud(self, c_set): |
313 | 305 |
from kamaki.cli.config import Config, CLOUD_PREFIX |
... | ... | |
336 | 328 |
self.assertEqual( |
337 | 329 |
c_set.mock_calls[-1], call(CLOUD_PREFIX, 'mycloud', d)) |
338 | 330 |
|
339 |
def test_set_global(self): |
|
340 |
from kamaki.cli.config import Config |
|
341 |
_cnf = Config(path=self.f.name) |
|
342 |
|
|
343 |
with patch('kamaki.cli.config.Config.set') as c_set: |
|
344 |
_cnf.set_global('opt', 'val') |
|
345 |
c_set.assert_called_once_with('global', 'opt', 'val') |
|
346 |
|
|
347 | 331 |
def test__load_defaults(self): |
348 | 332 |
from kamaki.cli.config import Config, DEFAULTS |
349 | 333 |
_cnf = Config(path=self.f.name) |
Also available in: Unified diff