Skip to content

Commit

Permalink
Use mostly HTTPS in tests -autopull
Browse files Browse the repository at this point in the history
  • Loading branch information
makyen committed Jan 20, 2020
1 parent a9dbb81 commit 364327c
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 73 deletions.
2 changes: 1 addition & 1 deletion classes/_Post.py
Expand Up @@ -83,7 +83,7 @@ def _parse_json_post(self, json_data):

if "ownerUrl" not in data:
# owner's account doesn't exist anymore, no need to post it in chat:
# http://chat.stackexchange.com/transcript/message/18380776#18380776
# https://chat.stackexchange.com/transcript/message/18380776#18380776
return

element_map = {
Expand Down
18 changes: 9 additions & 9 deletions test/data_test_parsing.txt
@@ -1,13 +1,13 @@
[ [SmokeDetector](https://github.com/Charcoal-SE/SmokeDetector) ] Bad keyword in title: [Best Weight Loss Tips For Fast Results](http://meta.stackexchange.com/questions/246651/best-weight-loss-tips-for-fast-results) by [Lisa Usher](http://meta.stackexchange.com/users/279263/lisa-usher) on `meta.stackexchange.com`
[ [SmokeDetector](https://github.com/Charcoal-SE/SmokeDetector) ] All-caps title: [TEST TEST TEST ]]])))](http://stackoverflow.com/questions/0/test-test) * by [TEST TEST](http://stackoverflow.com/users/0/test-test) on `stackoverflow.com`
[ [SmokeDetector](https://github.com/Charcoal-SE/SmokeDetector) ] Bad keyword in title: [Best Weight Loss Tips For Fast Results](https://meta.stackexchange.com/questions/246651/best-weight-loss-tips-for-fast-results) by [Lisa Usher](https://meta.stackexchange.com/users/279263/lisa-usher) on `meta.stackexchange.com`
[ [SmokeDetector](https://github.com/Charcoal-SE/SmokeDetector) ] All-caps title: [TEST TEST TEST ]]])))](https://stackoverflow.com/questions/0/test-test) * by [TEST TEST](https://stackoverflow.com/users/0/test-test) on `stackoverflow.com`
[ [SmokeDetector](https://github.com/Charcoal-SE/SmokeDetector) ] Offensive answer detected: [TEST TEST TEST 2]]])))](http://stackoverflow.com/questions/0/test-test/42#42) by [TEST TEST 2](http://stackoverflow.com/users/0/test-test) on `stackoverflow.com`
[ [SmokeDetector](https://github.com/Charcoal-SE/SmokeDetector) ] Repeating characters in body: [Why I can't insert data in a model from a custom controller?](http://stackoverflow.com/questions/27954020/why-i-cant-insert-data-in-a-model-from-a-custom-controller) * by [user3754535](http://stackoverflow.com/users/3754535/user3754535) on `stackoverflow.com`
[ [SmokeDetector](https://github.com/Charcoal-SE/SmokeDetector) ] Repeating characters in body: [Why I can't insert data in a model from a custom controller?](http://stackoverflow.com/questions/27954020/why-i-cant-insert-data-in-a-model-from-a-custom-controller) by a deleted user on `stackoverflow.com`
[ [SmokeDetector](https://github.com/Charcoal-SE/SmokeDetector) ] Bad keyword in title: [Best Weight Loss Tips For Fast Results](http://meta.stackexchange.com/q/246651) * by [Lisa Usher](http://meta.stackexchange.com/users/279263/lisa-usher) on `meta.stackexchange.com`
[ [SmokeDetector](https://github.com/Charcoal-SE/SmokeDetector) ] All-caps title: [TEST TEST TEST ]]])))](http://stackoverflow.com/q/0) by [TEST TEST](http://stackoverflow.com/users/0/test-test) on `stackoverflow.com`
[ [SmokeDetector](https://github.com/Charcoal-SE/SmokeDetector) ] Offensive answer detected: [TEST TEST TEST 2]]])))](http://stackoverflow.com/a/42) * by [TEST TEST 2](http://stackoverflow.com/users/0/test-test) on `stackoverflow.com`
[ [SmokeDetector](https://github.com/Charcoal-SE/SmokeDetector) ] Repeating characters in body: [Why I can't insert data in a model from a custom controller?](http://stackoverflow.com/q/27954020) by [user3754535](http://stackoverflow.com/users/3754535/user3754535) on `stackoverflow.com`
[ [SmokeDetector](https://github.com/Charcoal-SE/SmokeDetector) ] Repeating characters in body: [Why I can't insert data in a model from a custom controller?](http://stackoverflow.com/q/27954020) * by a deleted user on `stackoverflow.com`
[ [SmokeDetector](https://github.com/Charcoal-SE/SmokeDetector) ] Repeating characters in body: [Why I can't insert data in a model from a custom controller?](https://stackoverflow.com/questions/27954020/why-i-cant-insert-data-in-a-model-from-a-custom-controller) * by [user3754535](https://stackoverflow.com/users/3754535/user3754535) on `stackoverflow.com`
[ [SmokeDetector](https://github.com/Charcoal-SE/SmokeDetector) ] Repeating characters in body: [Why I can't insert data in a model from a custom controller?](https://stackoverflow.com/questions/27954020/why-i-cant-insert-data-in-a-model-from-a-custom-controller) by a deleted user on `stackoverflow.com`
[ [SmokeDetector](https://github.com/Charcoal-SE/SmokeDetector) ] Bad keyword in title: [Best Weight Loss Tips For Fast Results](https://meta.stackexchange.com/q/246651) * by [Lisa Usher](https://meta.stackexchange.com/users/279263/lisa-usher) on `meta.stackexchange.com`
[ [SmokeDetector](https://github.com/Charcoal-SE/SmokeDetector) ] All-caps title: [TEST TEST TEST ]]])))](https://stackoverflow.com/q/0) by [TEST TEST](https://stackoverflow.com/users/0/test-test) on `stackoverflow.com`
[ [SmokeDetector](https://github.com/Charcoal-SE/SmokeDetector) ] Offensive answer detected: [TEST TEST TEST 2]]])))](https://stackoverflow.com/a/42) * by [TEST TEST 2](https://stackoverflow.com/users/0/test-test) on `stackoverflow.com`
[ [SmokeDetector](https://github.com/Charcoal-SE/SmokeDetector) ] Repeating characters in body: [Why I can't insert data in a model from a custom controller?](https://stackoverflow.com/q/27954020) by [user3754535](https://stackoverflow.com/users/3754535/user3754535) on `stackoverflow.com`
[ [SmokeDetector](https://github.com/Charcoal-SE/SmokeDetector) ] Repeating characters in body: [Why I can't insert data in a model from a custom controller?](https://stackoverflow.com/q/27954020) * by a deleted user on `stackoverflow.com`
[ [SmokeDetector](https://github.com/Charcoal-SE/SmokeDetector) ] Repeating characters in body: [Why I can't insert data in a model from a custom controller?](//stackoverflow.com/q/27954020) by [user3754535](//stackoverflow.com/users/3754535/user3754535) on `stackoverflow.com`
[ [SmokeDetector](https://github.com/Charcoal-SE/SmokeDetector) ] Repeating characters in body: [Why I can't insert data in a model from a custom controller?](//stackoverflow.com/questions/27954020) * by [user3754535](//stackoverflow.com/users/3754535/user3754535) on `stackoverflow.com`
[ [SmokeDetector](https://github.com/Charcoal-SE/SmokeDetector) ] Title has only one unique char: [-----------------------------](//ru.stackoverflow.com/questions/458053/) by [Ni55aN](//ru.stackoverflow.com/users/20555/ni55an) on `ru.stackoverflow.com`
Expand Down
2 changes: 1 addition & 1 deletion test/data_test_spamhandling.txt
@@ -1 +1 @@
{"action":"155-questions-active","data":"{\"siteBaseHostAddress\":\"diy.stackexchange.com\",\"id\":57991,\"titleEncodedFancy\":\"What projects to do prior to move in?\",\"bodySummary\":\"I am in the process of closing on a relatively new home (2005). \\n\\nI have had the home inspection done and some specific work identified I will likely do early on in my ownership of the unit. \\n\\nI am ...\",\"tags\":[\"cabinets\",\"lock\",\"new-home\"],\"lastActivityDate\":1421536273,\"url\":\"http://diy.stackexchange.com/questions/57991/what-projects-to-do-prior-to-move-in\",\"ownerUrl\":\"http://diy.stackexchange.com/users/31801/panky\",\"ownerDisplayName\":\"Panky\",\"apiSiteParameter\":\"diy\"}"}
{"action":"155-questions-active","data":"{\"siteBaseHostAddress\":\"diy.stackexchange.com\",\"id\":57991,\"titleEncodedFancy\":\"What projects to do prior to move in?\",\"bodySummary\":\"I am in the process of closing on a relatively new home (2005). \\n\\nI have had the home inspection done and some specific work identified I will likely do early on in my ownership of the unit. \\n\\nI am ...\",\"tags\":[\"cabinets\",\"lock\",\"new-home\"],\"lastActivityDate\":1421536273,\"url\":\"https://diy.stackexchange.com/questions/57991/what-projects-to-do-prior-to-move-in\",\"ownerUrl\":\"https://diy.stackexchange.com/users/31801/panky\",\"ownerDisplayName\":\"Panky\",\"apiSiteParameter\":\"diy\"}"}
50 changes: 25 additions & 25 deletions test/test_chatcommands.py
Expand Up @@ -350,41 +350,41 @@ def test_allspam(handle_spam):
assert chatcommands.allspam("test", original_msg=msg) == "That doesn't look like a valid user URL."

# If this code lasts long enough to fail, I'll be happy
assert chatcommands.allspam("http://stackexchange.com/users/10000000000", original_msg=msg) == \
assert chatcommands.allspam("https://stackexchange.com/users/10000000000", original_msg=msg) == \
"The specified user does not appear to exist."

assert chatcommands.allspam("http://stackexchange.com/users/5869449", original_msg=msg) == (
assert chatcommands.allspam("https://stackexchange.com/users/5869449", original_msg=msg) == (
"The specified user has an abnormally high number of accounts. Please consider flagging for moderator "
"attention, otherwise use !!/report on the user's posts individually."
)

assert chatcommands.allspam("http://stackexchange.com/users/11683", original_msg=msg) == (
assert chatcommands.allspam("https://stackexchange.com/users/11683", original_msg=msg) == (
"The specified user's reputation is abnormally high. Please consider flagging for moderator attention, "
"otherwise use !!/report on the posts individually."
)

assert chatcommands.allspam("http://stackoverflow.com/users/22656", original_msg=msg) == (
assert chatcommands.allspam("https://stackoverflow.com/users/22656", original_msg=msg) == (
"The specified user's reputation is abnormally high. Please consider flagging for moderator attention, "
"otherwise use !!/report on the posts individually."
)

assert chatcommands.allspam("http://stackexchange.com/users/12108751", original_msg=msg) == \
assert chatcommands.allspam("https://stackexchange.com/users/12108751", original_msg=msg) == \
"The specified user hasn't posted anything."

assert chatcommands.allspam("http://stackoverflow.com/users/8846458", original_msg=msg) == \
assert chatcommands.allspam("https://stackoverflow.com/users/8846458", original_msg=msg) == \
"The specified user has no posts on this site."

# This test is for users with <100rep but >15 posts
# If this breaks in the future because the below user eventually gets 100 rep (highly unlikely), use the following
# data.SE query to find a new target. Alternatively, get a sock to post 16 answers in the sandbox.
# https://stackoverflow.com/users/7052649/vibin (look for low rep but >1rep users, 1rep users are usually suspended)
assert chatcommands.allspam("http://stackoverflow.com/users/7052649", original_msg=msg) == (
assert chatcommands.allspam("https://stackoverflow.com/users/7052649", original_msg=msg) == (
"The specified user has an abnormally high number of spam posts. Please consider flagging for moderator "
"attention, otherwise use !!/report on the posts individually."
)

# Valid user for allspam command
assert chatcommands.allspam("http://stackexchange.com/users/12108974", original_msg=msg) is None
assert chatcommands.allspam("https://stackexchange.com/users/12108974", original_msg=msg) is None

assert handle_spam.call_count == 1
_, call = handle_spam.call_args_list[0]
Expand All @@ -393,7 +393,7 @@ def test_allspam(handle_spam):
assert call["why"] == "User manually reported by *ArtOfCode* in room *Charcoal HQ*.\n"

handle_spam.reset_mock()
assert chatcommands.allspam("http://meta.stackexchange.com/users/373807", original_msg=msg) is None
assert chatcommands.allspam("https://meta.stackexchange.com/users/373807", original_msg=msg) is None

assert handle_spam.call_count == 1
_, call = handle_spam.call_args_list[0]
Expand Down Expand Up @@ -427,18 +427,18 @@ def test_blacklisted_users():
})

# Format: !!/*blu profileurl
assert chatcommands.isblu("http://stackoverflow.com/users/4622463/angussidney", original_msg=msg) == \
assert chatcommands.isblu("https://stackoverflow.com/users/4622463/angussidney", original_msg=msg) == \
"User is not blacklisted (`4622463` on `stackoverflow.com`)."
assert chatcommands.addblu("http://stackoverflow.com/users/4622463/angussidney", original_msg=msg) == \
assert chatcommands.addblu("https://stackoverflow.com/users/4622463/angussidney", original_msg=msg) == \
"User blacklisted (`4622463` on `stackoverflow.com`)."
# TODO: Edit command to check and not blacklist again, add test
assert chatcommands.isblu("http://stackoverflow.com/users/4622463/angussidney", original_msg=msg) == \
assert chatcommands.isblu("https://stackoverflow.com/users/4622463/angussidney", original_msg=msg) == \
"User is blacklisted (`4622463` on `stackoverflow.com`)."
assert chatcommands.rmblu("http://stackoverflow.com/users/4622463/angussidney", original_msg=msg) == \
assert chatcommands.rmblu("https://stackoverflow.com/users/4622463/angussidney", original_msg=msg) == \
"User removed from blacklist (`4622463` on `stackoverflow.com`)."
assert chatcommands.isblu("http://stackoverflow.com/users/4622463/angussidney", original_msg=msg) == \
assert chatcommands.isblu("https://stackoverflow.com/users/4622463/angussidney", original_msg=msg) == \
"User is not blacklisted (`4622463` on `stackoverflow.com`)."
assert chatcommands.rmblu("http://stackoverflow.com/users/4622463/angussidney", original_msg=msg) == \
assert chatcommands.rmblu("https://stackoverflow.com/users/4622463/angussidney", original_msg=msg) == \
"User is not blacklisted."

# Format: !!/*blu userid sitename
Expand All @@ -457,9 +457,9 @@ def test_blacklisted_users():
"User is not blacklisted."

# Invalid input
assert chatcommands.addblu("http://meta.stackexchange.com/users", original_msg=msg) == \
assert chatcommands.addblu("https://meta.stackexchange.com/users", original_msg=msg) == \
"Invalid format. Valid format: `!!/addblu profileurl` *or* `!!/addblu userid sitename`."
assert chatcommands.rmblu("http://meta.stackexchange.com/", original_msg=msg) == \
assert chatcommands.rmblu("https://meta.stackexchange.com/", original_msg=msg) == \
"Invalid format. Valid format: `!!/rmblu profileurl` *or* `!!/rmblu userid sitename`."
assert chatcommands.isblu("msklkldsklaskd", original_msg=msg) == \
"Invalid format. Valid format: `!!/isblu profileurl` *or* `!!/isblu userid sitename`."
Expand Down Expand Up @@ -497,18 +497,18 @@ def test_whitelisted_users():
})

# Format: !!/*wlu profileurl
assert chatcommands.iswlu("http://stackoverflow.com/users/4622463/angussidney", original_msg=msg) == \
assert chatcommands.iswlu("https://stackoverflow.com/users/4622463/angussidney", original_msg=msg) == \
"User is not whitelisted (`4622463` on `stackoverflow.com`)."
assert chatcommands.addwlu("http://stackoverflow.com/users/4622463/angussidney", original_msg=msg) == \
assert chatcommands.addwlu("https://stackoverflow.com/users/4622463/angussidney", original_msg=msg) == \
"User whitelisted (`4622463` on `stackoverflow.com`)."
# TODO: Add test here as well
assert chatcommands.iswlu("http://stackoverflow.com/users/4622463/angussidney", original_msg=msg) == \
assert chatcommands.iswlu("https://stackoverflow.com/users/4622463/angussidney", original_msg=msg) == \
"User is whitelisted (`4622463` on `stackoverflow.com`)."
assert chatcommands.rmwlu("http://stackoverflow.com/users/4622463/angussidney", original_msg=msg) == \
assert chatcommands.rmwlu("https://stackoverflow.com/users/4622463/angussidney", original_msg=msg) == \
"User removed from whitelist (`4622463` on `stackoverflow.com`)."
assert chatcommands.iswlu("http://stackoverflow.com/users/4622463/angussidney", original_msg=msg) == \
assert chatcommands.iswlu("https://stackoverflow.com/users/4622463/angussidney", original_msg=msg) == \
"User is not whitelisted (`4622463` on `stackoverflow.com`)."
assert chatcommands.rmwlu("http://stackoverflow.com/users/4622463/angussidney", original_msg=msg) == \
assert chatcommands.rmwlu("https://stackoverflow.com/users/4622463/angussidney", original_msg=msg) == \
"User is not whitelisted."

# Format: !!/*wlu userid sitename
Expand All @@ -527,9 +527,9 @@ def test_whitelisted_users():
"User is not whitelisted."

# Invalid input
assert chatcommands.addwlu("http://meta.stackexchange.com/users", original_msg=msg) == \
assert chatcommands.addwlu("https://meta.stackexchange.com/users", original_msg=msg) == \
"Invalid format. Valid format: `!!/addwlu profileurl` *or* `!!/addwlu userid sitename`."
assert chatcommands.rmwlu("http://meta.stackexchange.com/", original_msg=msg) == \
assert chatcommands.rmwlu("https://meta.stackexchange.com/", original_msg=msg) == \
"Invalid format. Valid format: `!!/rmwlu profileurl` *or* `!!/rmwlu userid sitename`."
assert chatcommands.iswlu("msklkldsklaskd", original_msg=msg) == \
"Invalid format. Valid format: `!!/iswlu profileurl` *or* `!!/iswlu userid sitename`."
Expand Down

0 comments on commit 364327c

Please sign in to comment.