def test_ordering_by_assigned_to_desc_with_none_values(self): project = f.ProjectFactory.create() issue1 = f.IssueFactory.create(project=project, assigned_to=None) issue2 = f.IssueFactory.create(project=project, assigned_to=None) issue3 = f.IssueFactory.create(project=project, assigned_to=None) issues = Issue.objects.filter(project=project).order_by( "-assigned_to__full_name", "-id") issue1_neighbors = n.get_neighbors(issue1, results_set=issues) issue2_neighbors = n.get_neighbors(issue2, results_set=issues) assert issue1_neighbors.left == issue2 assert issue1_neighbors.right is None assert issue2_neighbors.left == issue3 assert issue2_neighbors.right == issue1
def test_ordering_by_owner_desc(self): project = f.ProjectFactory.create() owner1 = f.UserFactory.create(full_name="Chuck Norris") owner2 = f.UserFactory.create(full_name="George Of The Jungle") issue1 = f.IssueFactory.create(project=project, owner=owner2) issue2 = f.IssueFactory.create(project=project, owner=owner1) issue3 = f.IssueFactory.create(project=project, owner=owner1) issues = Issue.objects.filter(project=project).order_by( "-owner__full_name", "-id") issue1_neighbors = n.get_neighbors(issue1, results_set=issues) issue2_neighbors = n.get_neighbors(issue2, results_set=issues) assert issue1_neighbors.left is None assert issue1_neighbors.right == issue3 assert issue2_neighbors.left == issue3 assert issue2_neighbors.right is None
def test_ordering_by_priority_desc(self): project = f.ProjectFactory.create() priority1 = f.PriorityFactory.create(project=project, order=1) priority2 = f.PriorityFactory.create(project=project, order=2) issue1 = f.IssueFactory.create(project=project, priority=priority2) issue2 = f.IssueFactory.create(project=project, priority=priority1) issue3 = f.IssueFactory.create(project=project, priority=priority1) issues = Issue.objects.filter(project=project).order_by( "-priority", "-id") issue1_neighbors = n.get_neighbors(issue1, results_set=issues) issue2_neighbors = n.get_neighbors(issue2, results_set=issues) assert issue1_neighbors.left is None assert issue1_neighbors.right == issue3 assert issue2_neighbors.left == issue3 assert issue2_neighbors.right is None
def test_ordering_by_status_desc(self): project = f.ProjectFactory.create() status1 = f.IssueStatusFactory.create(project=project, order=1) status2 = f.IssueStatusFactory.create(project=project, order=2) issue1 = f.IssueFactory.create(project=project, status=status2) issue2 = f.IssueFactory.create(project=project, status=status1) issue3 = f.IssueFactory.create(project=project, status=status1) issues = Issue.objects.filter(project=project).order_by( "-status", "-id") issue1_neighbors = n.get_neighbors(issue1, results_set=issues) issue2_neighbors = n.get_neighbors(issue2, results_set=issues) assert issue1_neighbors.left is None assert issue1_neighbors.right == issue3 assert issue2_neighbors.left == issue3 assert issue2_neighbors.right is None
def test_ordering_by_severity(self): project = f.ProjectFactory.create() severity1 = f.SeverityFactory.create(project=project, order=1) severity2 = f.SeverityFactory.create(project=project, order=2) issue1 = f.IssueFactory.create(project=project, severity=severity2) issue2 = f.IssueFactory.create(project=project, severity=severity1) issue3 = f.IssueFactory.create(project=project, severity=severity1) issues = Issue.objects.filter(project=project).order_by( "severity", "-id") issue2_neighbors = n.get_neighbors(issue2, results_set=issues) issue3_neighbors = n.get_neighbors(issue3, results_set=issues) assert issue3_neighbors.left is None assert issue3_neighbors.right == issue2 assert issue2_neighbors.left == issue3 assert issue2_neighbors.right == issue1
def test_empty_related_queryset(self): project = f.ProjectFactory.create() issue1 = f.IssueFactory.create(project=project) issue2 = f.IssueFactory.create(project=project) issue3 = f.IssueFactory.create(project=project) neighbors = n.get_neighbors(issue2, Issue.objects.none()) assert neighbors.left == issue3 assert neighbors.right == issue1
def test_no_filters(self): project = f.ProjectFactory.create() issue1 = f.IssueFactory.create(project=project) issue2 = f.IssueFactory.create(project=project) issue3 = f.IssueFactory.create(project=project) neighbors = n.get_neighbors(issue2) assert neighbors.left == issue3 assert neighbors.right == issue1
def test_no_filters(self): project = f.ProjectFactory.create() us1 = f.UserStoryFactory.create(project=project) us2 = f.UserStoryFactory.create(project=project) us3 = f.UserStoryFactory.create(project=project) neighbors = n.get_neighbors(us2) assert neighbors.left == us1 assert neighbors.right == us3
def test_ordering_by_assigned_to(self): project = f.ProjectFactory.create() assigned_to1 = f.UserFactory.create(full_name="Chuck Norris") assigned_to2 = f.UserFactory.create(full_name="George Of The Jungle") issue1 = f.IssueFactory.create(project=project, assigned_to=assigned_to2) issue2 = f.IssueFactory.create(project=project, assigned_to=assigned_to1) issue3 = f.IssueFactory.create(project=project, assigned_to=assigned_to1) issues = Issue.objects.filter(project=project).order_by( "assigned_to__full_name", "-id") issue2_neighbors = n.get_neighbors(issue2, results_set=issues) issue3_neighbors = n.get_neighbors(issue3, results_set=issues) assert issue3_neighbors.left is None assert issue3_neighbors.right == issue2 assert issue2_neighbors.left == issue3 assert issue2_neighbors.right == issue1
def test_filtered_by_milestone(self): project = f.ProjectFactory.create() milestone = f.MilestoneFactory.create(project=project) f.UserStoryFactory.create(project=project) us1 = f.UserStoryFactory.create(project=project, milestone=milestone) us2 = f.UserStoryFactory.create(project=project, milestone=milestone) milestone_user_stories = UserStory.objects.filter(milestone=milestone) neighbors = n.get_neighbors(us1, results_set=milestone_user_stories) assert neighbors.left is None assert neighbors.right == us2
def test_filtered_by_tags(self): tag_names = ["test"] project = f.ProjectFactory.create() f.UserStoryFactory.create(project=project) us1 = f.UserStoryFactory.create(project=project, tags=tag_names) us2 = f.UserStoryFactory.create(project=project, tags=tag_names) test_user_stories = UserStory.objects.get_queryset().filter( tags__contains=tag_names) neighbors = n.get_neighbors(us1, results_set=test_user_stories) assert neighbors.left is None assert neighbors.right == us2