def main(argv): config = Generator.parse_args(argv, _display_help) if not config or not config[0]: # Assume the library already generated a helpful message on screen sys.exit(2) metadataUrl, namespace, resource = config metadata = Generator.retrieve_metadata(metadataUrl) factory = Generator.create_factory(metadata, namespace, resource) fileName = Generator.build_file_name(['factories', 'resources'], resource) Generator.write_file(factory, fileName) client = Generator.create_client(namespace, resource) fileName = Generator.build_file_name(['api', 'client'], resource) Generator.write_file(client, fileName) pipeclean = Generator.create_pipeclean_test(resource) fileName = Generator.build_file_name(['tasks', 'pipeclean'], resource) Generator.write_file(pipeclean, fileName) volume = Generator.create_volume_test(resource) fileName = Generator.build_file_name(['tasks', 'volume'], resource) Generator.write_file(volume, fileName) print( 'Boilerplate files have been written. Don\'t forget to review them carefully:' ) print(Generator.files_created(resource))
def test_mix(self): argv = ['--metadataUrl', 'a', '-n', 'b', '--resource', 'c'] metadataUrl, namespace, resource = Generator.parse_args( argv, lambda: None) assert metadataUrl == 'a' assert namespace == 'b' assert resource == 'c'
def test_uppercase(self): argv = ['-M', 'a', '-N', 'b', '-R', 'c'] metadataUrl, namespace, resource = Generator.parse_args( argv, lambda: None) assert not metadataUrl assert not namespace assert not resource
def test_lowercase(self): argv = ['-m', 'a', '-n', 'b', '-r', 'c'] metadataUrl, namespace, resource = Generator.parse_args( argv, lambda: None) assert metadataUrl == 'a' assert namespace == 'b' assert resource == 'c'