def test_get_issue(self): p1 = ProjectIssue.add('test1', 'test1 description', 'test', project=1, assignee='assignee') p1.close('test') p2 = ProjectIssue.add('test2', 'test2 description', 'test', project=1, assignee='assignee') p2.close('test') p3 = ProjectIssue.add('test3', 'test3 description', 'test', project=1, assignee='assignee') p4 = ProjectIssue.add('test4', 'test4 description', 'test', project=1, assignee='test') p5 = ProjectIssue.add('test5', 'test5 description', 'test1', project=2, assignee='test') rs = UserIssue.gets_by_creator_id('test', state='open') assert all([isinstance(i, ProjectIssue) for i in rs]) assert len(rs) == 2 rs = UserIssue.gets_by_assignee_id('test', state='open') assert all([isinstance(i, ProjectIssue) for i in rs]) assert len(rs) == 2
def get_count_assigned_issues(self, state): return len(UserIssue.gets_by_assignee_id(self.name, state))
def get_assigned_issues(self, state, limit=25, start=0): issues = UserIssue.gets_by_assignee_id(self.name, state) issues.sort(key=lambda x: x.updated_at, reverse=True) return issues[start:start + limit]
def get_count_created_issues(self, state): return len(UserIssue.gets_by_creator_id(self.name, state))
def get_repos_issues(self, state): return UserIssue.gets_by_creator_id(self.name, state)
def get_n_participated_issues(self, state='open'): issues = UserIssue.get_participated_issues(self.username, state) return len(issues)
def get_participated_issues(self, state='open', limit=25, start=0): issues = UserIssue.get_participated_issues(self.username, state) issues.sort(key=lambda x: x.updated_at, reverse=True) return issues[start:start + limit]
def issues(self, request): state = request.get_form_var('state', 'open') owner_id = self.user.name issues = UserIssue.gets_by_creator_id(owner_id, state=state) return [i.as_dict() for i in issues if i.target_type == 'project']