Ejemplo n.º 1
0
 def tearDown(self):
     try:
         self.f.close()
     except Exception:
         pass
     finally:
         from kamaki.cli.config import DEFAULTS
         keys = DEFAULTS.keys()
         for k in keys:
             DEFAULTS.pop(k)
         for k, v in self.DEFAULTS.items():
             DEFAULTS[k] = v
Ejemplo n.º 2
0
 def tearDown(self):
     try:
         self.f.close()
     except Exception:
         pass
     finally:
         from kamaki.cli.config import DEFAULTS
         keys = DEFAULTS.keys()
         for k in keys:
             DEFAULTS.pop(k)
         for k, v in self.DEFAULTS.items():
             DEFAULTS[k] = v
Ejemplo n.º 3
0
    def setUp(self):
        self.f = NamedTemporaryFile()

        from kamaki.cli.config import DEFAULTS

        self.DEFAULTS = dict()
        for k, v in DEFAULTS.items():
            self.DEFAULTS[k] = dict(v) if isinstance(v, dict) else v

        self.config_file_content = [
            HEADER,
            '[global]\n',
            'default_cloud = ~mycloud\n',
            'file_cli = pithos\n',
            'history_file = /home/user/.kamaki.history\n',
            'colors = off\n',
            'config_cli = config\n',
            'history_cli = history\n',
            'log_token = off\n',
            'server_cli = cyclades\n',
            'user_cli = astakos\n',
            'log_data = off\n',
            'flavor_cli = cyclades\n',
            'image_cli = image\n',
            'log_file = /home/user/.kamaki.log\n',
            'network_cli = cyclades\n',
            'log_pid = off\n',
            '\n',
            '[cloud "demo"]\n',
            'url = https://demo.example.com\n',
            'token = t0k3n-0f-d3m0-3x4mp13\n',
            '\n',
            '[cloud "~mycloud"]\n',
            'url = https://example.com\n',
            'pithos_container = images\n']
Ejemplo n.º 4
0
    def test__load_defaults(self):
        from kamaki.cli.config import Config, DEFAULTS
        _cnf = Config(path=self.f.name)

        with patch('kamaki.cli.config.Config.set') as c_set:
            _cnf._load_defaults()
            for i, (section, options) in enumerate(DEFAULTS.items()):
                for j, (option, val) in enumerate(options.items()):
                    self.assertEqual(c_set.mock_calls[(i + 1) * j],
                                     call(section, option, val))
Ejemplo n.º 5
0
    def test__load_defaults(self):
        from kamaki.cli.config import Config, DEFAULTS
        _cnf = Config(path=self.f.name)

        with patch('kamaki.cli.config.Config.set') as c_set:
            _cnf._load_defaults()
            for i, (section, options) in enumerate(DEFAULTS.items()):
                for j, (option, val) in enumerate(options.items()):
                    self.assertEqual(
                        c_set.mock_calls[(i + 1) * j],
                        call(section, option, val))
Ejemplo n.º 6
0
    def setUp(self):
        self.f = NamedTemporaryFile()

        from kamaki.cli.config import DEFAULTS

        self.DEFAULTS = dict()
        for k, v in DEFAULTS.items():
            self.DEFAULTS[k] = dict(v) if isinstance(v, dict) else v

        self.config_file_content = [
            HEADER, '[global]\n', 'default_cloud = ~mycloud\n',
            'file_cli = pithos\n',
            'history_file = /home/user/.kamaki.history\n', 'colors = off\n',
            'config_cli = config\n', 'history_cli = history\n',
            'log_token = off\n', 'server_cli = cyclades\n',
            'user_cli = astakos\n', 'log_data = off\n',
            'flavor_cli = cyclades\n', 'image_cli = image\n',
            'log_file = /home/user/.kamaki.log\n', 'network_cli = cyclades\n',
            'log_pid = off\n', '\n', '[cloud "demo"]\n',
            'url = https://demo.example.com\n',
            'token = t0k3n-0f-d3m0-3x4mp13\n', '\n', '[cloud "~mycloud"]\n',
            'url = https://example.com\n', 'pithos_container = images\n'
        ]