def setUp(self):
     self.fn = config.get('Tests', 'test_file')
     self.table_entityName = config.get('Tests', 'test_entity_name')
     self.table_physical_objectName = config.get('Tests', 'test_obj_name')
     self.table_count = config.getint('Tests', 'test_tbl_cnt')
     self.n_table = config.getint('Tests', 'test_ref_tbl')
     self.table_physical_count = config.getint('Tests', 'test_tbl_phys_cnt')
     self.n_physical = config.getint('Tests', 'test_ref_tbl_phys')
     self.dp = data_package.DataPackage(self.fn)
     self.dt = data_table.DataTable(self.dp.get_dataTable())
示例#2
0
    def test_update(self, name, extra_opts, inputs):
        config_file = 'dwave.conf'
        profile = 'profile'

        runner = CliRunner(mix_stderr=False)
        with runner.isolated_filesystem():
            # create config
            config_body = '\n'.join(f"{k} = old-{v}"
                                    for k, v in inputs.items())
            with open(config_file, 'w') as fp:
                fp.write(f"[{profile}]\n{config_body}")

            # verify config before update
            with isolated_environ(remove_dwave=True):
                config = load_config(config_file=config_file)
                for var, val in inputs.items():
                    self.assertEqual(config.get(var), f"old-{val}")

            # update config
            result = runner.invoke(cli,
                                   [
                                       'config',
                                       'create',
                                       '-f',
                                       config_file,
                                       '-p',
                                       profile,
                                   ] + extra_opts,
                                   input='\n'.join('' if v is None else v
                                                   for v in inputs.values()))
            self.assertEqual(result.exit_code, 0)

            # verify config updated
            with isolated_environ(remove_dwave=True):
                config = load_config(config_file=config_file)
                for var, val in inputs.items():
                    self.assertEqual(config.get(var), val)
示例#3
0
    def test_default_flows(self, name, extra_opts, inputs):
        runner = CliRunner(mix_stderr=False)
        with runner.isolated_filesystem():
            with mock.patch("dwave.cloud.config.get_configfile_paths",
                            lambda: ['dwave.conf']):
                with mock.patch("dwave.cloud.utils.input", side_effect=inputs):
                    result = runner.invoke(
                        cli, ['config', 'create'] + extra_opts,
                        input='\n'.join('' if v is None else v
                                        for v in inputs.values()))
                    self.assertEqual(result.exit_code, 0)

                # load and verify config
                with isolated_environ(remove_dwave=True):
                    config = load_config()
                    for var, val in inputs.items():
                        if val:  # skip empty default confirmations
                            self.assertEqual(config.get(var), val)
示例#4
0
    def test_create(self, name, extra_opts, inputs):
        config_file = 'path/to/dwave.conf'
        profile = 'profile'

        runner = CliRunner(mix_stderr=False)
        with runner.isolated_filesystem():
            result = runner.invoke(cli,
                                   [
                                       'config', 'create', '--config-file',
                                       config_file, '--profile', profile
                                   ] + extra_opts,
                                   input='\n'.join('' if v is None else v
                                                   for v in inputs.values()))
            self.assertEqual(result.exit_code, 0)

            # load and verify config
            with isolated_environ(remove_dwave=True):
                config = load_config(config_file, profile=profile)
                for var, val in inputs.items():
                    self.assertEqual(config.get(var), val)
示例#5
0
    def test_config_create(self):
        config_file = 'dwave.conf'
        profile = 'profile'
        values = 'endpoint token client solver'.split()

        runner = CliRunner()
        with runner.isolated_filesystem():
            # create config file through simulated user input in `dwave configure`
            touch(config_file)
            with mock.patch("dwave.cloud.utils.input", side_effect=values):
                result = runner.invoke(cli, [
                    'config', 'create', '--config-file', config_file, '--profile', profile
                ], input='\n'.join(values))
                self.assertEqual(result.exit_code, 0)

            # load and verify config
            with isolated_environ(remove_dwave=True):
                config = load_config(config_file, profile=profile)
                for val in values:
                    self.assertEqual(config.get(val), val)
 def setUp(self):
     self.fn = config.get('Tests', 'test_file')
     self.file_sha1 = '2b9dcb56e7bdf7057ead3160fdb9bbc952a1fc02'
     self.file_md5 = 'a10455a9623a90d49ae88de54cdbe5e1'
 def setUp(self):
     self.fn = config.get('Tests', 'test_file')
     self.package_id = config.get('Tests', 'test_pid')
     self.title = config.get('Tests', 'test_title')
     self.dp = data_package.DataPackage(self.fn)
示例#8
0
 def setUp(self):
     self.fn = config.get('Tests', 'test_file')
     self.hash_algorithm = config.get('Tests', 'test_hash_alg')
     self.hash_value = config.get('Tests', 'test_hash_val')
     self.sm = d1_sysmeta.SysMeta(self.fn)
 def setUp(self):
     self.fn = config.get('Tests', 'test_file')
     self.file_sha1 = '2b9dcb56e7bdf7057ead3160fdb9bbc952a1fc02'
     self.file_md5 = 'a10455a9623a90d49ae88de54cdbe5e1'
示例#10
0
 def setUp(self):
     self.fn = config.get('Tests', 'test_file')
     self.package_id = config.get('Tests', 'test_pid')
     self.title = config.get('Tests', 'test_title')
     self.dp = data_package.DataPackage(self.fn)