Esempio n. 1
0
def reconcile_db_with_gh(*args, **kwargs):
    ghc = GitHubConnector()
    repos = ghc.get_all_repos()
    issues = ghc.get_all_issues()

    for repo in repos:
        r = Repo(github_id=repo.id, name=repo.name, url=repo.html_url)
        r.save()

    for issue in issues:
        i = Issue(github_id=issue.id)
        i.title = issue.title
        i.number = issue.number
        i.repo = Repo.objects.get(name=issue.repository[1])
        i.open = not issue.is_closed()
        i.url = issue.html_url
        if issue.assignee:
            try:
                i.assignee = GithubAlias.objects.get(github_name=issue.assignee).user
            except GithubAlias.DoesNotExist:
                print("No GithubAlias with github_name '%s' exists" % issue.assignee)
        else:
            i.assignee = None
        i.body = issue.body
        i.save()

    print("Not only did your task run successfully, but you're damned good looking too.")
Esempio n. 2
0
    def setUp(self):
        self.ghc = GitHubConnector()
        self.repos = self.ghc.get_all_repos()

        for repo in self.repos:
            new_repo = Repo(github_id=repo.id, name=repo.name)
            new_repo.save()

        factories.UserFactory.create_batch(10)
        factories.JobFactory.create_batch(10)
Esempio n. 3
0
    def test_commit_hash_swap(self):

        repo = self.repos.pop()
        commit = repo.iter_commits().next()

        repo_obj = Repo()
        repo_obj.github_id = repo.id
        repo_obj.name = repo.name
        repo_obj.save()

        workitem = WorkItem()
        workitem.user = User.objects.all()[0]
        workitem.job = Job.objects.filter(available_all_users=True)[0]
        workitem.hours = 10
        workitem.date = datetime.date.today()
        workitem.repo = repo_obj
        workitem.text = 'commit ' + commit.sha + ' extra text'
        workitem.save()

        self.assertEquals(workitem.text, commit.commit.message + ' extra text')