Refactor get_user_from_username to raise 404 directly
This commit is contained in:
parent
d810d1bb8c
commit
4dacf4df3a
6 changed files with 21 additions and 38 deletions
|
@ -3,6 +3,7 @@ import json
|
|||
from unittest.mock import patch
|
||||
import pathlib
|
||||
from django.db.models import Q
|
||||
from django.http import Http404
|
||||
from django.test import TestCase
|
||||
from django.test.client import RequestFactory
|
||||
import responses
|
||||
|
@ -67,7 +68,7 @@ class ViewsHelpers(TestCase):
|
|||
views.helpers.get_user_from_username(self.local_user, "mouse@local.com"),
|
||||
self.local_user,
|
||||
)
|
||||
with self.assertRaises(models.User.DoesNotExist):
|
||||
with self.assertRaises(Http404):
|
||||
views.helpers.get_user_from_username(self.local_user, "mojfse@example.com")
|
||||
|
||||
def test_is_api_request(self, _):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue