@@ -123,3 +123,50 @@ def test_pr_is_awaiting_merge():
123
123
def test_pr_is_not_awaiting_merge ():
124
124
labels = [{"name" : "CLA Signed" , "name" : "skip issue" , "name" : "awaiting review" }]
125
125
assert util .pr_is_awaiting_merge (labels ) is False
126
+
127
+
128
+ def test_comment_on_pr_success (requests_mock ):
129
+ issue_number = 100
130
+ message = "Thanks for the PR!"
131
+ post_url = (
132
+ f"https://github.com/api/repos/python/cpython/issues/{ issue_number } /comments"
133
+ )
134
+ requests_mock .post (
135
+ post_url ,
136
+ json = {
137
+ "html_url" : "https://github.com/python/cpython/pull/{issue_number}#issuecomment-401309376"
138
+ },
139
+ status_code = 201 ,
140
+ )
141
+ response = util .comment_on_pr (issue_number , message )
142
+ assert response .status_code == 201
143
+
144
+
145
+ def test_comment_on_pr_failure (requests_mock ):
146
+ issue_number = 100
147
+ message = "Thanks for the PR!"
148
+ post_url = (
149
+ f"https://github.com/api/repos/python/cpython/issues/{ issue_number } /comments"
150
+ )
151
+ requests_mock .post (post_url , status_code = 400 )
152
+ response = util .comment_on_pr (issue_number , message )
153
+ assert response .status_code == 400
154
+
155
+
156
+ def test_assign_pr_to_coredev_success (requests_mock ):
157
+
158
+ issue_number = 100
159
+ coredev_login = "Mariatta"
160
+ patch_url = f"https://github.com/api/repos/python/cpython/issues/{ issue_number } "
161
+ requests_mock .patch (patch_url , status_code = 201 )
162
+ response = util .assign_pr_to_core_dev (issue_number , coredev_login )
163
+ assert response .status_code == 201
164
+
165
+
166
+ def test_assign_pr_to_coredev_failed (requests_mock ):
167
+ issue_number = 100
168
+ coredev_login = "Mariatta"
169
+ patch_url = f"https://github.com/api/repos/python/cpython/issues/{ issue_number } "
170
+ requests_mock .patch (patch_url , status_code = 400 )
171
+ response = util .assign_pr_to_core_dev (issue_number , coredev_login )
172
+ assert response .status_code == 400
0 commit comments