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