mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-27 03:09:31 +02:00
12794 change User ref to get_user_model (#12905)
* 12794 change User ref to get_user_model * 12794 call get_user_model once in tests * 12794 call get_user_model once in tests * 12794 use settings.AUTH_USER_MODEL for FK reference
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import datetime
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.urls import reverse
|
||||
from django.utils.timezone import make_aware
|
||||
@@ -15,6 +15,9 @@ from extras.scripts import BooleanVar, IntegerVar, Script, StringVar
|
||||
from utilities.testing import APITestCase, APIViewTestCases
|
||||
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
|
||||
class AppTest(APITestCase):
|
||||
|
||||
def test_root(self):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import uuid
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.test import TestCase
|
||||
|
||||
@@ -18,6 +18,9 @@ from utilities.testing import BaseFilterSetTests, ChangeLoggedFilterSetTests, cr
|
||||
from virtualization.models import Cluster, ClusterGroup, ClusterType
|
||||
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
|
||||
class CustomFieldTestCase(TestCase, BaseFilterSetTests):
|
||||
queryset = CustomField.objects.all()
|
||||
filterset = CustomFieldFilterSet
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import urllib.parse
|
||||
import uuid
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.urls import reverse
|
||||
|
||||
@@ -11,6 +11,9 @@ from extras.models import *
|
||||
from utilities.testing import ViewTestCases, TestCase
|
||||
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
|
||||
class CustomFieldTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
model = CustomField
|
||||
|
||||
|
||||
Reference in New Issue
Block a user