def test_fetch_repos(self):
     repos = github_adapter.fetch_repos("tonylampada")
     self.assertTrue(len(repos) >= 6)
     _assert_repo_contains(self, repos, "PituKontrol")
     _assert_repo_contains(self, repos, "Svn-Hooks-In-Java")
     _assert_repo_contains(self, repos, "www.freedomsponsors.org")
     _assert_repo_contains(self, repos, "freedomsponsors-jira-plugin")
     _assert_repo_contains(self, repos, "freedomsponsors.github.com")
 def test_fetch_repos(self):
     repos = github_adapter.fetch_repos("tonylampada")
     self.assertTrue(len(repos) >= 6)
     _assert_repo_contains(self, repos, "PituKontrol")
     _assert_repo_contains(self, repos, "Svn-Hooks-In-Java")
     _assert_repo_contains(self, repos, "www.freedomsponsors.org")
     _assert_repo_contains(self, repos, "freedomsponsors-jira-plugin")
     _assert_repo_contains(self, repos, "freedomsponsors.github.com")
def get_repos_and_configs(user):
    repos = []
    github_username = user.github_username()
    if github_username:
        repos = github_adapter.fetch_repos(github_username)
    for repo_dict in repos:
        gh_id = repo_dict['id']
        repodb = get_repodb_by_githubid(gh_id)
        if repodb:
            user_repo_config = get_repo_config_by_repo_and_user(repodb, user)
            if user_repo_config:
                repo_dict['add_links'] = user_repo_config.add_links
                repo_dict['new_only'] = user_repo_config.new_only
    return repos
def get_repos_and_configs(user):
    repos = []
    github_username = user.github_username()
    if github_username:
        repos = github_adapter.fetch_repos(github_username)
    for repo_dict in repos:
        gh_id = repo_dict['id']
        repodb = get_repodb_by_githubid(gh_id)
        if repodb:
            user_repo_config = get_repo_config_by_repo_and_user(repodb, user)
            if user_repo_config:
                repo_dict['add_links'] = user_repo_config.add_links
                repo_dict['new_only'] = user_repo_config.new_only
    return repos
def update_user_configs(user, dict):
    github_username = user.github_username()
    if github_username:
        repos = github_adapter.fetch_repos(github_username)
        my_repo_ids = []
    for repo_dict in repos:
        gh_id = repo_dict['id']
        repodb = get_repodb_by_githubid(gh_id)
        if not repodb:
            owner = repo_dict['owner']['login']
            owner_type = repo_dict['owner']['type']
            name = repo_dict['name']
            repodb = Repo.newRepo(owner, owner_type, name, gh_id, user)
            repodb.save()
        config = get_repo_config_by_repo_and_user(repodb, user)
        if not config:
            config = UserRepoConfig.newConfig(user, repodb)
        config.add_links = dict.has_key('check_addlink_%s' % gh_id)
#        config.new_only = dict.has_key('check_newonly_%s' % gh_id)
        config.new_only = True
        config.save()
        my_repo_ids.append(gh_id)
    UserRepoConfig.objects.filter(user__id = user.id).exclude(repo__gh_id__in = my_repo_ids).delete()
def update_user_configs(user, dict):
    github_username = user.github_username()
    if github_username:
        repos = github_adapter.fetch_repos(github_username)
        my_repo_ids = []
    for repo_dict in repos:
        gh_id = repo_dict['id']
        repodb = get_repodb_by_githubid(gh_id)
        if not repodb:
            owner = repo_dict['owner']['login']
            owner_type = repo_dict['owner']['type']
            name = repo_dict['name']
            repodb = Repo.newRepo(owner, owner_type, name, gh_id, user)
            repodb.save()
        config = get_repo_config_by_repo_and_user(repodb, user)
        if not config:
            config = UserRepoConfig.newConfig(user, repodb)
        config.add_links = dict.has_key('check_addlink_%s' % gh_id)
        #        config.new_only = dict.has_key('check_newonly_%s' % gh_id)
        config.new_only = True
        config.save()
        my_repo_ids.append(gh_id)
    UserRepoConfig.objects.filter(user__id=user.id).exclude(
        repo__gh_id__in=my_repo_ids).delete()
 def test_fetch_repos(self):
     repos = github_adapter.fetch_repos("tonylampada")
     self.assertTrue(len(repos) >= 6)
     _assert_repo_contains(self, repos, "angulife")
     _assert_repo_contains(self, repos, "eunaoaguentomaisnaosabercss")
 def test_fetch_repos(self):
     repos = github_adapter.fetch_repos("tonylampada")
     self.assertTrue(len(repos) >= 6)
     _assert_repo_contains(self, repos, "angulife")
     _assert_repo_contains(self, repos, "eunaoaguentomaisnaosabercss")