mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-26 15:07:38 +00:00
Chore: Share the API client fixtures and build test users cheaply (#14199)
This commit is contained in:
1 parent
2d955e9697
commit
99ce6b5db3
44 files changed
+442
-477
No files matched your search
@@ -1,12 +1,13 @@
|
||||
import uuid
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.test import TestCase
|
||||
from django.test import override_settings
|
||||
from django.urls import resolve
|
||||
from django.urls import reverse
|
||||
from rest_framework import status
|
||||
|
||||
from paperless_testing.factories import UserFactory
|
||||
|
||||
|
||||
class TestApiAuthViews(TestCase):
|
||||
def test_api_auth_login_uses_allauth_login_view(self):
|
||||
@@ -24,10 +25,7 @@ class TestApiAuthViews(TestCase):
|
||||
@override_settings(DISABLE_REGULAR_LOGIN=True)
|
||||
def test_api_auth_login_respects_disable_regular_login(self):
|
||||
username = f"testuser-{uuid.uuid4().hex}"
|
||||
User.objects.create_user(
|
||||
username=username,
|
||||
password="testpassword",
|
||||
)
|
||||
UserFactory(username=username, password="testpassword")
|
||||
|
||||
response = self.client.post(
|
||||
reverse("rest_framework:login"),
|
||||
|
||||
Reference in new issue
Block a user