def test_resolve_charm_type(config): """The config indicates the project is a charm.""" config.set(type="charm") cmd = PackCommand(config) with patch.object(cmd, "_pack_charm") as mock: cmd.run(noargs) mock.assert_called_with(noargs)
def test_resolve_bundle_type(config): """The config indicates the project is a bundle.""" config.set(type="bundle") cmd = PackCommand("group", config) with patch.object(cmd, "_pack_bundle") as mock: cmd.run(noargs) mock.assert_called_with()
def test_resolve_no_config_packs_charm(config): """There is no config, so it's decided to pack a charm.""" config.set(project=Project(config_provided=False)) cmd = PackCommand("group", config) with patch.object(cmd, "_pack_charm") as mock: cmd.run(noargs) mock.assert_called_with(noargs)
def test_resolve_no_config_packs_charm(config, tmp_path): """There is no config, so it's decided to pack a charm.""" config.set(project=Project( config_provided=False, dirpath=tmp_path, started_at=datetime.datetime.utcnow(), )) cmd = PackCommand(config) with patch.object(cmd, "_pack_charm") as mock: cmd.run(noargs) mock.assert_called_with(noargs)