(self, name, extra_opts, inputs)
| 122 | token="token", client="base", solver="solver")), |
| 123 | ]) |
| 124 | def test_update(self, name, extra_opts, inputs): |
| 125 | config_file = 'dwave.conf' |
| 126 | profile = 'profile' |
| 127 | |
| 128 | runner = CliRunner() |
| 129 | with runner.isolated_filesystem(): |
| 130 | # create config |
| 131 | config_body = '\n'.join(f"{k} = old-{v}" for k,v in inputs.items()) |
| 132 | with open(config_file, 'w') as fp: |
| 133 | fp.write(f"[{profile}]\n{config_body}") |
| 134 | |
| 135 | # verify config before update |
| 136 | with isolated_environ(remove_dwave=True): |
| 137 | config = load_config(config_file=config_file) |
| 138 | for var, val in inputs.items(): |
| 139 | self.assertEqual(config.get(var), f"old-{val}") |
| 140 | |
| 141 | # update config |
| 142 | result = runner.invoke(cli, [ |
| 143 | 'config', 'create', '-f', config_file, '-p', profile, |
| 144 | ] + extra_opts, input='\n'.join('' if v is None else v for v in inputs.values())) |
| 145 | self.assertEqual(result.exit_code, 0) |
| 146 | |
| 147 | # verify config updated |
| 148 | with isolated_environ(remove_dwave=True): |
| 149 | config = load_config(config_file=config_file) |
| 150 | for var, val in inputs.items(): |
| 151 | self.assertEqual(config.get(var), val) |
| 152 | |
| 153 | |
| 154 | class TestCli(unittest.TestCase): |
nothing calls this directly
no test coverage detected