-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
29 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -415,7 +415,7 @@ def web_user_gets(domain='user.com'): | |
return [ | ||
requests_response(ACTOR_HTML, url=f'https://{domain}/'), | ||
requests_response(ACTOR_HTML, url=f'https://{domain}/'), | ||
requests_response('', status=404), # webfinger | ||
requests_response(status=404), # webfinger | ||
] | ||
|
||
|
||
|
@@ -2826,7 +2826,8 @@ def test_check_web_site(self, mock_create_task, mock_get, _): | |
|
||
redir = 'http://localhost/.well-known/webfinger?resource=acct:[email protected]' | ||
mock_get.side_effect = ( | ||
requests_response('', status=302, redirected_url=redir), | ||
ACTOR_HTML_RESP, | ||
requests_response(status=302, redirected_url=redir), | ||
ACTOR_HTML_RESP, | ||
) | ||
|
||
|
@@ -2908,6 +2909,23 @@ def test_check_web_site_opted_out(self, _, __): | |
get_flashed_messages()) | ||
self.assertEqual(1, Web.query().count()) | ||
|
||
def test_check_web_site_opted_out_reloads_ok(self, mock_get, __): | ||
self.user.has_redirects = False | ||
self.user.put() | ||
self.assertIsNotNone(self.user.status) | ||
|
||
mock_get.side_effect = [ | ||
ACTOR_HTML_RESP, | ||
requests_response(status=404), # webfinger | ||
ACTOR_HTML_RESP, | ||
] | ||
|
||
got = self.post('/web-site', data={'url': 'user.com'}) | ||
self.assert_equals(302, got.status_code) | ||
self.assert_equals('/web/user.com', got.headers['Location']) | ||
|
||
self.assertIsNone(self.user.key.get().status) | ||
|
||
@patch('oauth_dropins.webutil.appengine_config.tasks_client.create_task') | ||
def test_check_webfinger_redirects_then_fails(self, mock_task, mock_get, __): | ||
common.RUN_TASKS_INLINE = False | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters