forked from mirrors/bookwyrm
Test users with domains that contain dashes
This commit is contained in:
parent
1a30546b99
commit
14a90e805a
1 changed files with 23 additions and 0 deletions
|
@ -80,6 +80,29 @@ class UserViews(TestCase):
|
||||||
self.assertIsInstance(result, ActivitypubResponse)
|
self.assertIsInstance(result, ActivitypubResponse)
|
||||||
self.assertEqual(result.status_code, 200)
|
self.assertEqual(result.status_code, 200)
|
||||||
|
|
||||||
|
def test_user_page_domain(self):
|
||||||
|
"""when the user domain has dashes in it"""
|
||||||
|
with patch("bookwyrm.models.user.set_remote_server"):
|
||||||
|
self.remote_user = models.User.objects.create_user(
|
||||||
|
"nutria",
|
||||||
|
"",
|
||||||
|
"nutriaword",
|
||||||
|
local=False,
|
||||||
|
remote_id="https://ex--ample.co----m/users/nutria",
|
||||||
|
inbox="https://ex--ample.co----m/users/nutria/inbox",
|
||||||
|
outbox="https://ex--ample.co----m/users/nutria/outbox",
|
||||||
|
)
|
||||||
|
|
||||||
|
view = views.User.as_view()
|
||||||
|
request = self.factory.get("")
|
||||||
|
request.user = self.local_user
|
||||||
|
with patch("bookwyrm.views.user.is_api_request") as is_api:
|
||||||
|
is_api.return_value = False
|
||||||
|
result = view(request, "nutria@ex--ample.co----m")
|
||||||
|
self.assertIsInstance(result, TemplateResponse)
|
||||||
|
validate_html(result.render())
|
||||||
|
self.assertEqual(result.status_code, 200)
|
||||||
|
|
||||||
def test_user_page_blocked(self):
|
def test_user_page_blocked(self):
|
||||||
"""there are so many views, this just makes sure it LOADS"""
|
"""there are so many views, this just makes sure it LOADS"""
|
||||||
view = views.User.as_view()
|
view = views.User.as_view()
|
||||||
|
|
Loading…
Reference in a new issue