def test_list_repos(self): repos = ghprofile.list_repos('pedromduarte', verbose=False) names = [ghprofile.strip_username(r) for r in repos] check = [ 'apparatus3-plotgui', 'apparatus3-plotgui_wx', 'apparatus3-report2sql', 'bragg-scattering', 'cpt-cucuta-002', 'dipole', 'hubbard-data', 'hubbard-lda', 'hubbard-lda2', 'hubbard-lda3', 'hubbard-lda_evap', 'lattice_3D_ipynb', 'phase-contrast', 'phdthesis', 'thesis-analysis', 'thesis-hubbard', 'thesis-hubbard-lda_evap', 'thesis-lattice'] for ch in check: self.assertIn(ch, names)
def test_strip_username(self): repo_name = ghprofile.strip_username(self.repos[0]) self.assertEqual(repo_name, "apparatus3-imagesgui")
repolist = {k: v.split() for k, v in repolist.items()} else: repolist = {'toptier': [], 'contributedto': [], 'lowtier': []} repos = gp.list_repos(args.username, verbose=True) with open('gh-api-repoobj-example.txt', 'w') as fout: fout.write("List of keys availabe in repo object return by gh API:") for k in repos[0].keys(): fout.write(k) RepoInfo = namedtuple('RepoInfo', "title githuburl category datepushed datecreated " "languages keywords summary description") for r in repos: repo_name = gp.strip_username(r) if repo_name in repolist['toptier']: category = 'toptier' elif repo_name in repolist['contributedto']: category = 'contributedto' elif repo_name in repolist['lowtier']: category = 'lowtier' else: category = 'uncategorized' if args.skipuncategorized: continue pushed_at = dt.datetime.strptime(r['pushed_at'], "%Y-%m-%dT%H:%M:%SZ") created_at = dt.datetime.strptime(r['created_at'], "%Y-%m-%dT%H:%M:%SZ") content = RepoInfo(