def METHOD_NAME(self, setup_parser, mlog, mglog):
    """Functional test of a full 'charm create' run."""
    class args(object):
        charmname = 'testcharm'
        charmhome = self.tempdir
        template = 'bash'
        verbose = False
    setup_parser.return_value.parse_args.return_value = args
    unwriteable = join(self.tempdir, '_unwriteable')
    os.mkdir(unwriteable, 0o555)
    args.charmhome = unwriteable
    self.assertEqual(main(), 1)
    assert mlog.error.called
    self.assertIn('Unable to write to', mlog.error.call_args[0][0])
    mglog.warn.reset_mock()
    self.assertEqual(main(), 1)
    args.charmhome = self.tempdir
    self.assertEqual(main(), 0)
    outputdir = join(self.tempdir, args.charmname)
    actual_files = list(flatten(outputdir))
    expected_files = list(flatten(pkg_resources.resource_filename(
        'charmtools', 'templates/bash/files')))
    metadata = yaml.safe_load(open(join(outputdir, 'metadata.yaml'), 'r'))
    self.assertEqual(expected_files, actual_files)
    self.assertEqual(metadata['name'], args.charmname)