kopia lustrzana https://github.com/snarfed/bridgy-fed
rodzic
85b1a400ff
commit
c343164f5b
|
@ -1,4 +1,5 @@
|
|||
"""Datastore model classes."""
|
||||
import difflib
|
||||
import logging
|
||||
import urllib.parse
|
||||
|
||||
|
@ -142,7 +143,8 @@ class User(StringIdModel):
|
|||
if got in expected:
|
||||
self.has_redirects = True
|
||||
else:
|
||||
self.redirects_error = f'<code>{url}</code> redirects to <code>{got}</code> ; expected <code>{expected[0]}</code>'
|
||||
diff = '\n'.join(difflib.Differ().compare([got], [expected[0]]))
|
||||
self.redirects_error = f'Current vs expected:<pre>{diff}</pre>'
|
||||
except requests.RequestException:
|
||||
pass
|
||||
|
||||
|
|
|
@ -463,6 +463,10 @@ a img.shadow:hover
|
|||
background-color: inherit !important;
|
||||
}
|
||||
|
||||
.warning pre {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.docs {
|
||||
list-style: none;
|
||||
}
|
||||
|
|
|
@ -83,8 +83,9 @@ class UserTest(testutil.TestCase):
|
|||
allow_redirects=False)
|
||||
no_hcard = requests_response('<html><body></body></html>')
|
||||
mock_get.side_effect = [half_redir, no_hcard]
|
||||
check(False, False, None,
|
||||
'<code>https://y.z/.well-known/webfinger?resource=acct:y.z@y.z</code> redirects to <code>http://localhost/.well-known/webfinger</code> ; expected <code>https://fed.brid.gy/.well-known/webfinger?resource=acct:y.z@y.z</code>')
|
||||
check(False, False, None, """\
|
||||
Current vs expected:<pre>- http://localhost/.well-known/webfinger
|
||||
+ https://fed.brid.gy/.well-known/webfinger?resource=acct:y.z@y.z</pre>""")
|
||||
|
||||
# redirect works, non-representative h-card
|
||||
full_redir = requests_response(
|
||||
|
|
Ładowanie…
Reference in New Issue