MCPcopy Create free account
hub / github.com/dwavesystems/dwave-cloud-client / test_upload

Method test_upload

tests/test_cli.py:430–466  ·  view source on GitHub ↗
(self, config_file_option)

Source from the content-addressed store, hash-verified

428 ("-f", ),
429 ])
430 def test_upload(self, config_file_option):
431 config_file = 'dwave.conf'
432 profile = 'profile'
433 client_type = 'base'
434 format = 'dimodbqm'
435 problem_id = 'prob:lem:id'
436 filename = 'filename'
437
438 with mock.patch('dwave.cloud.cli.Client') as m:
439
440 runner = CliRunner()
441 with runner.isolated_filesystem():
442 touch(config_file)
443 touch(filename)
444 result = runner.invoke(cli, ['upload',
445 config_file_option, config_file,
446 '--profile', profile,
447 '--client', client_type,
448 '--format', format,
449 '--problem-id', problem_id,
450 filename])
451
452 # proper arguments passed to Client.from_config?
453 m.from_config.assert_called_with(
454 config_file=config_file, profile=profile,
455 endpoint=None, region=None,
456 client=client_type)
457
458 # upload method called on client?
459 c = m.from_config.return_value
460 self.assertTrue(c.upload_problem_encoded.called)
461
462 # verify problem_id
463 args, kwargs = c.upload_problem_encoded.call_args
464 self.assertEqual(kwargs.get('problem_id'), problem_id)
465
466 self.assertEqual(result.exit_code, 0)
467
468 def test_platform(self):
469 runner = CliRunner()

Callers

nothing calls this directly

Calls 2

touchFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected