Esempio n. 1
0
    def test_new_project_issue_participant_count(self):
        app = TestApp(M.app)
        project_name = "project"
        project = CodeDoubanProject.add(project_name, owner_id="test1", summary="test", product="fire")
        issue = ProjectIssue.add("test", "test description", "test", project=project.id)
        resp = app.get(issue.url)

        assert resp.status_int == 200
        assert "Issues" in resp.body
        assert "<strong>1</strong> participant" in resp.text
        assert "<strong>1</strong> participants" not in resp.text
    def test_zero_vote_and_zero_comment_display(self):
        app = TestApp(M.app)
        project_name = "project"
        project = CodeDoubanProject.add(
            project_name, owner_id="test1", summary="test", product="fire")
        issue = ProjectIssue.add('test', 'test description', 'test',
                                 project=project.id)
        resp = app.get(project.url + "/issues/")

        assert resp.status_int == 200
        assert 'Issues' in resp.body
        assert '0 vote' not in resp.body
        assert '0 comment' not in resp.body
    def test_two_comments_display(self):
        app = TestApp(M.app)
        project_name = "project4"
        project = CodeDoubanProject.add(
            project_name, owner_id="test1", summary="test", product="fire")
        issue = ProjectIssue.add('test', 'test description', 'test',
                                 project=project.id)
        issue.add_comment('this is a comment', 'test')
        issue.add_comment('this is also a comment', 'test')
        resp = app.get(project.url + "/issues/")

        assert resp.status_int == 200
        assert "Issues" in resp.body
        assert "2 comments" in resp.body
    def test_two_votes_display(self):
        app = TestApp(M.app)
        project_name = "project3"
        project = CodeDoubanProject.add(
            project_name, owner_id="test1", summary="test", product="fire")
        issue = ProjectIssue.add('test', 'test description', 'test',
                                 project=project.id)
        issue.upvote_by_user('test1')
        issue.upvote_by_user('test2')
        resp = app.get(project.url + "/issues/")

        assert resp.status_int == 200
        assert "Issues" in resp.body
        assert "2 votes" in resp.body
Esempio n. 5
0
if p2_id:
    store.execute("delete from pullreq where from_project=%s", p2_id)
store.commit()


def setup2repos(proj1, proj2):
    path = proj1.git_real_path
    with clone(path) as workdir:
        with open(join(workdir, 'origin'), 'w') as f:
            f.write('origin')

    path = proj2.git_real_path
    with clone(path) as workdir:
        with open(join(workdir, 'origin'), 'w') as f:
            f.write('modified')

project = Project.add(
    p1_name, owner_id="testuser", summary="test", product="")
assert project
project_fork = Project.add(
    p2_name, owner_id="testuser", summary="test", product="",
    fork_from=project.id)

setup2repos(project, project_fork)

pullreq1 = PullRequest.open(project_fork, 'master', project, 'master')
ticket1 = Ticket.add(project.id, 'title', 'content', 'testuser')
pullreq1.insert(ticket1.ticket_number)

print "PR has been built at: %s" % (DOMAIN + ticket1.url)