def METHOD_NAME(self, setup_parser):
    class args(object):
        charmname = 'testcharm'
        charmhome = None
        template = 'bash'
        verbose = False
    setup_parser.return_value.parse_args.return_value = args
    with patch.dict('os.environ', {'CHARM_HOME': self.tempdir,
                                   'USER': 'test'}):
        with patch('os.path.expanduser') as eu:
            eu.return_value = 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)