|
29 | 29 | import logging |
30 | 30 | import os |
31 | 31 | from unittest import mock |
| 32 | +from urllib.parse import urlparse |
32 | 33 |
|
33 | 34 | from helpers import AppriseURLTester |
34 | 35 | import pytest |
@@ -199,9 +200,9 @@ def _mk_resp(code, content=b""): |
199 | 200 | assert obj.notify(body="Test message") is True |
200 | 201 | assert mock_post.call_count == 1 |
201 | 202 |
|
202 | | - # Verify the correct URL was used |
| 203 | + # Verify the correct URL host was used |
203 | 204 | call_url = mock_post.call_args[0][0] |
204 | | - assert "api.groupme.com" in call_url |
| 205 | + assert urlparse(call_url).hostname == "api.groupme.com" |
205 | 206 |
|
206 | 207 | mock_post.reset_mock() |
207 | 208 |
|
@@ -304,13 +305,13 @@ def _mk_resp(code, content=b""): |
304 | 305 | # Two requests: upload + bot post |
305 | 306 | assert mock_post.call_count == 2 |
306 | 307 |
|
307 | | - # Verify the image service URL was called first |
| 308 | + # Verify the image service URL host was called first |
308 | 309 | upload_url = mock_post.call_args_list[0][0][0] |
309 | | - assert "image.groupme.com" in upload_url |
| 310 | + assert urlparse(upload_url).hostname == "image.groupme.com" |
310 | 311 |
|
311 | | - # Verify the bot post URL was called second |
| 312 | + # Verify the bot post URL host was called second |
312 | 313 | post_url = mock_post.call_args_list[1][0][0] |
313 | | - assert "api.groupme.com" in post_url |
| 314 | + assert urlparse(post_url).hostname == "api.groupme.com" |
314 | 315 |
|
315 | 316 |
|
316 | 317 | @mock.patch("requests.post") |
|
0 commit comments