def test_hub_build_push(): args = set_hub_build_parser().parse_args( [os.path.join(cur_dir, 'hub-mwu'), '--push', '--host-info']) summary = HubIO(args).build() with open(os.path.join(cur_dir, 'hub-mwu', 'manifest.yml')) as fp: manifest = yaml.load(fp) assert summary['is_build_success'] assert manifest['version'] == summary['version'] assert manifest['description'] == summary['manifest_info']['description'] assert manifest['author'] == summary['manifest_info']['author'] assert manifest['kind'] == summary['manifest_info']['kind'] assert manifest['type'] == summary['manifest_info']['type'] assert manifest['vendor'] == summary['manifest_info']['vendor'] assert manifest['keywords'] == summary['manifest_info']['keywords'] args = set_hub_list_parser().parse_args([ '--name', summary['manifest_info']['name'], '--keywords', summary['manifest_info']['keywords'][0], '--type', summary['manifest_info']['type'] ]) response = HubIO(args).list() manifests = response.json()['manifest'] assert response.status_code == 200 assert len(manifests) >= 1 assert manifests[0]['name'] == summary['manifest_info']['name']
def test_hub_list_keywords(): args = set_hub_list_parser().parse_args(['--keywords', 'numeric']) response = HubIO(args).list() numeric_count = len(response.json()['manifest']) assert response.status_code == 200 assert numeric_count > 1 args = set_hub_list_parser().parse_args( ['--keywords', 'numeric', 'randjojd']) response = HubIO(args).list() combined_count = len(response.json()['manifest']) assert response.status_code == 200 assert combined_count > 1 # Making sure both arguments are --keywords are considered as `either or` assert combined_count >= numeric_count