def test_issue_stat(self): issue_rs = get_all_issue() assert len(issue_rs) == 0 issue_open_count = len(filter(lambda x: x[1] is None, issue_rs)) assert issue_open_count == 0 assert len(issue_rs) - issue_open_count == 0 i1 = Issue.add('test1', 'test des1', 'testuser1', 'assignee') issue_rs = get_all_issue() assert len(issue_rs) == 1 issue_open_count = len(filter(lambda x: x[1] is None, issue_rs)) assert issue_open_count == 1 assert len(issue_rs) - issue_open_count == 0 i2 = Issue.add('test2', 'test des1', 'testuser1', 'assignee') i3 = Issue.add('test3', 'test des1', 'testuser2', 'assignee') issue_rs = get_all_issue() assert len(issue_rs) == 3 issue_open_count = len(filter(lambda x: x[1] is None, issue_rs)) assert issue_open_count == 3 assert len(issue_rs) - issue_open_count == 0 i1.close('testuser1') issue_rs = get_all_issue() assert len(issue_rs) == 3 issue_open_count = len(filter(lambda x: x[1] is None, issue_rs)) assert issue_open_count == 2 assert len(issue_rs) - issue_open_count == 1 issue_comment_count = get_issue_comment_count() assert issue_comment_count == 0 IssueComment.add(i2.id, 'content', 'test') IssueComment.add(i3.id, 'content', 'test1') issue_comment_count = get_issue_comment_count() assert issue_comment_count == 2
def source(request): # pr相关数据 pr_rs = get_all_ticket() pr_count = len(pr_rs) pr_open_count = len(filter(lambda x: x[1] is None, pr_rs)) # issue相关数据 issue_rs = get_all_issue() issue_count = len(issue_rs) issue_open_count = len(filter(lambda x: x[1] is None, issue_rs)) project_rs = get_all_project() gist_rs = get_all_gist() data = dict( # pr相关数据 pr_count=pr_count, pr_open_count=pr_open_count, pr_closed_count=pr_count - pr_open_count, pr_comment_count=get_ticket_comment_count(), # issue相关数据 issue_count=issue_count, issue_open_count=issue_open_count, issue_closed_count=issue_count - issue_open_count, issue_comment_count=get_issue_comment_count(), # project相关数据 project_count=len(project_rs), project_fork_count=len(filter(lambda x: x[1] is not None, project_rs)), # gist相关数据 gist_count=len(gist_rs), gist_fork_count=len(filter(lambda x: x[1] != 0, gist_rs)), ) return data
def source(request): # pr相关数据 pr_rs = get_all_ticket() pr_count = len(pr_rs) pr_open_count = len(filter(lambda x: x[1] is None, pr_rs)) # issue相关数据 issue_rs = get_all_issue() issue_count = len(issue_rs) issue_open_count = len(filter(lambda x: x[1] is None, issue_rs)) project_rs = get_all_project() gist_rs = get_all_gist() data = dict( # pr相关数据 pr_count=pr_count, pr_open_count=pr_open_count, pr_closed_count=pr_count - pr_open_count, pr_comment_count=get_ticket_comment_count(), # issue相关数据 issue_count=issue_count, issue_open_count=issue_open_count, issue_closed_count=issue_count - issue_open_count, issue_comment_count=get_issue_comment_count(), # project相关数据 project_count=len(project_rs), project_fork_count=len(filter(lambda x: x[1] is not None, project_rs)), # gist相关数据 gist_count=len(gist_rs), gist_fork_count=len(filter(lambda x: x[1] != 0, gist_rs)) ) return data
def test_issue_stat(self): issue_rs = get_all_issue() store.execute("delete from issues where id < 20") assert len(issue_rs) == 0 issue_open_count = len(filter(lambda x: x[1] is None, issue_rs)) assert issue_open_count == 0 assert len(issue_rs) - issue_open_count == 0 i1 = Issue.add('test1', 'test des1', 'testuser1', 'assignee') issue_rs = get_all_issue() assert len(issue_rs) == 1 issue_open_count = len(filter(lambda x: x[1] is None, issue_rs)) assert issue_open_count == 1 assert len(issue_rs) - issue_open_count == 0 i2 = Issue.add('test2', 'test des1', 'testuser1', 'assignee') i3 = Issue.add('test3', 'test des1', 'testuser2', 'assignee') issue_rs = get_all_issue() assert len(issue_rs) == 3 issue_open_count = len(filter(lambda x: x[1] is None, issue_rs)) assert issue_open_count == 3 assert len(issue_rs) - issue_open_count == 0 i1.close('testuser1') issue_rs = get_all_issue() assert len(issue_rs) == 3 issue_open_count = len(filter(lambda x: x[1] is None, issue_rs)) assert issue_open_count == 2 assert len(issue_rs) - issue_open_count == 1 issue_comment_count = get_issue_comment_count() assert issue_comment_count == 0 IssueComment.add(i2.id, 'content', 'test') IssueComment.add(i3.id, 'content', 'test1') issue_comment_count = get_issue_comment_count() assert issue_comment_count == 2