Ejemplo n.º 1
0
 def test_adding_pool_that_was_renamed(self, filepath="tests/conf/adding_after_pool_rename.conf"):
     kwargs = {'address': '1.2.3.4', 'password': '******', 'pool_name': 'pool', 'username': '******'}
     box = {'address': '1.2.3.4', 'password': '******', 'pool_id': 1, 'username': '******',
            'key': 'infinibox-1-pool-1'}
     self.prepare_conf(filepath)
     with config.get_config_parser(filepath, True) as config_parser:
         self.assertEquals(config.get_enabled_backends(config_parser), list())
         with patch("infinisdk.InfiniBox") as InfiniBox, \
              patch("infinidat_openstack.versioncheck.get_system_version") as system_version:
             InfiniBox().get_serial.return_value = 1
             system_version.return_value = '1.5'
             pool = Mock()
             pool.get_id.return_value = 1
             InfiniBox().pools.safe_get.return_value = pool
             key = config.apply(config_parser, **kwargs)
             config.enable(config_parser, key)
         with patch("infinisdk.InfiniBox") as InfiniBox, \
              patch("infinidat_openstack.versioncheck.get_system_version") as system_version:
             InfiniBox().get_serial.return_value = 1
             system_version.return_value = '1.5'
             pool = Mock()
             pool.get_id.return_value = 1
             InfiniBox().pools.safe_get.return_value = pool
             kwargs['pool_name'] = 'pool2'
             key = config.apply(config_parser, **kwargs)
             config.enable(config_parser, key)
     with config.get_config_parser(filepath) as config_parser:
         self.assertEquals(len(config.get_volume_backends(config_parser)), 1)
         self.assertEquals(len(config.get_enabled_backends(config_parser)), 1)
Ejemplo n.º 2
0
 def test_empty_config_file(self):
     with config.get_config_parser("tests/conf/empty.conf") as config_parser:
         self.assertEquals(config.get_volume_backends(config_parser), list())
         self.assertEquals(config.get_enabled_backends(config_parser), list())
Ejemplo n.º 3
0
 def test_config_file_with_one_system(self):
     box = {'address': '1.2.3.4', 'password': '******', 'pool_id': 1, 'username': '******',
            'key': 'infinibox-1-pool-1'}
     with config.get_config_parser("tests/conf/one.conf") as config_parser:
         self.assertEquals(config.get_volume_backends(config_parser), [box])
         self.assertEquals(config.get_enabled_backends(config_parser), ["foobar"])