Skip to content

Commit fab7e33

Browse files
committed
github security report addressed
1 parent d064a32 commit fab7e33

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

tests/test_plugin_groupme.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import logging
3030
import os
3131
from unittest import mock
32+
from urllib.parse import urlparse
3233

3334
from helpers import AppriseURLTester
3435
import pytest
@@ -199,9 +200,9 @@ def _mk_resp(code, content=b""):
199200
assert obj.notify(body="Test message") is True
200201
assert mock_post.call_count == 1
201202

202-
# Verify the correct URL was used
203+
# Verify the correct URL host was used
203204
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"
205206

206207
mock_post.reset_mock()
207208

@@ -304,13 +305,13 @@ def _mk_resp(code, content=b""):
304305
# Two requests: upload + bot post
305306
assert mock_post.call_count == 2
306307

307-
# Verify the image service URL was called first
308+
# Verify the image service URL host was called first
308309
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"
310311

311-
# Verify the bot post URL was called second
312+
# Verify the bot post URL host was called second
312313
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"
314315

315316

316317
@mock.patch("requests.post")

0 commit comments

Comments
 (0)