def github_dl(queries, dst, username, password, token, config): g = setup_github(username, password, token, config) for query in queries: # todo: can also pass sort, order, qualifiers... # currently expects user to pass parameters like... # 'machine learning language:jupyter-notebook size:<1000' repos = search_repos(g, query) download_repos(dst, repos)
def dl(users, dst, username, password, token, config, extension): g = setup_github(username, password, token, config) if (users): # get the users' gists for user in users: gists = user_gists(user, g) download_gists(dst, gists, extension) else: # get the public gists gists = public_gists(g) download_gists(dst, gists, extension)
def test_setup_github_username_token(): """test when nothing is passed via command line""" g = setup_github(None, None, 'token', None) assert g
def test_setup_github_username_password(): """test when nothing is passed via command line""" g = setup_github('foo', 'bar', None, None) assert g
def test_setup_github_prompt(): """test when nothing is passed via command line""" g = setup_github(None, None, None, None) assert g
def test_setup_github_bad_config(): """test when a config file has nothing in it""" config = './tests/bad-config.json' g = setup_github(None, None, None, config) assert g
def test_setup_github_config(): """test when a config file is passed to via command line""" config = './tests/good-config.json' g = setup_github(None, None, None, config) assert g