@@ -28,6 +28,51 @@ def test_comments(self):
2828 comments = self .jira .comments (issue )
2929 assert len (comments ) == 0
3030
31+ def test_comments_start_at (self ):
32+ comments_created = []
33+ for i in range (10 ):
34+ comments_created .append (
35+ self .jira .add_comment (self .issue_1_key , f"Comment #{ i + 1 } " )
36+ )
37+ comments = self .jira .comments (self .issue_1_key , start_at = 5 )
38+ self .assertEqual (len (comments ), 5 )
39+ self .assertEqual (comments [0 ].body , "Comment #6" )
40+ for comment in comments_created :
41+ comment .delete ()
42+ comments = self .jira .comments (self .issue_1_key )
43+ assert len (comments ) == 0
44+
45+ def test_comments_max_results (self ):
46+ comments_created = []
47+ for i in range (10 ):
48+ comments_created .append (
49+ self .jira .add_comment (self .issue_1_key , f"Comment #{ i + 1 } " )
50+ )
51+ comments = self .jira .comments (self .issue_1_key , max_results = 4 )
52+ self .assertEqual (len (comments ), 4 )
53+ self .assertEqual (comments [0 ].body , "Comment #1" )
54+ for comment in comments_created :
55+ comment .delete ()
56+ comments = self .jira .comments (self .issue_1_key )
57+ assert len (comments ) == 0
58+
59+ def test_comments_order_by (self ):
60+ comments_created = []
61+ for i in range (10 ):
62+ comments_created .append (
63+ self .jira .add_comment (self .issue_1_key , f"Comment #{ i + 1 } " )
64+ )
65+ comments = self .jira .comments (self .issue_1_key , order_by = "created" )
66+ self .assertEqual (comments [0 ].body , "Comment #1" )
67+ comments = self .jira .comments (self .issue_1_key , order_by = "+created" )
68+ self .assertEqual (comments [0 ].body , "Comment #1" )
69+ comments = self .jira .comments (self .issue_1_key , order_by = "-created" )
70+ self .assertEqual (comments [0 ].body , "Comment #10" )
71+ for comment in comments_created :
72+ comment .delete ()
73+ comments = self .jira .comments (self .issue_1_key )
74+ assert len (comments ) == 0
75+
3176 def test_expanded_comments (self ):
3277 comment1 = self .jira .add_comment (self .issue_1_key , "First comment" )
3378 comment2 = self .jira .add_comment (self .issue_1_key , "Second comment" )
0 commit comments