| 240 | os.path.join('.', 'dwave.conf')) |
| 241 | |
| 242 | def test_configure_inspect(self): |
| 243 | runner = CliRunner() |
| 244 | with runner.isolated_filesystem(): |
| 245 | config_file = 'dwave.conf' |
| 246 | with open(config_file, 'w') as f: |
| 247 | f.write(''' |
| 248 | [defaults] |
| 249 | endpoint = 1 |
| 250 | [a] |
| 251 | endpoint = 2 |
| 252 | [b] |
| 253 | token = 3''') |
| 254 | |
| 255 | # test auto-detected case |
| 256 | with mock.patch('dwave.cloud.config.loaders.get_configfile_paths', |
| 257 | lambda **kw: [config_file]): |
| 258 | result = runner.invoke(cli, [ |
| 259 | 'config', 'inspect' |
| 260 | ]) |
| 261 | self.assertIn('endpoint = 2', result.output) |
| 262 | |
| 263 | # test explicit config |
| 264 | result = runner.invoke(cli, [ |
| 265 | 'config', 'inspect', '--config-file', config_file |
| 266 | ]) |
| 267 | self.assertIn('endpoint = 2', result.output) |
| 268 | |
| 269 | # test explicit profile |
| 270 | result = runner.invoke(cli, [ |
| 271 | 'config', 'inspect', '--config-file', config_file, '--profile', 'b' |
| 272 | ]) |
| 273 | self.assertIn('endpoint = 1', result.output) |
| 274 | self.assertIn('token = 3', result.output) |
| 275 | |
| 276 | @parameterized.expand([ |
| 277 | ("--config-file", ), |