refactor(base): normalize empty/not used to be models.NOT_PROVIDED
ref: #883 #730
This commit is contained in:
@ -3,6 +3,7 @@ import django
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from django.contrib.auth.models import ContentType, Permission
|
from django.contrib.auth.models import ContentType, Permission
|
||||||
|
from django.db import models
|
||||||
from django.shortcuts import reverse
|
from django.shortcuts import reverse
|
||||||
from django.test import Client
|
from django.test import Client
|
||||||
|
|
||||||
@ -11,8 +12,6 @@ from rest_framework.relations import Hyperlink
|
|||||||
from access.models.team import Team
|
from access.models.team import Team
|
||||||
from access.models.team_user import TeamUsers
|
from access.models.team_user import TeamUsers
|
||||||
|
|
||||||
from centurion.tests.common import DoesNotExist
|
|
||||||
|
|
||||||
User = django.contrib.auth.get_user_model()
|
User = django.contrib.auth.get_user_model()
|
||||||
|
|
||||||
|
|
||||||
@ -252,7 +251,7 @@ class APIFieldsTestCases:
|
|||||||
|
|
||||||
api_data_two = recursearray(self.api_data_two, param_value)
|
api_data_two = recursearray(self.api_data_two, param_value)
|
||||||
|
|
||||||
if param_expected is DoesNotExist:
|
if param_expected is models.NOT_PROVIDED:
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
api_data['key'] not in api_data['obj']
|
api_data['key'] not in api_data['obj']
|
||||||
@ -278,7 +277,7 @@ class APIFieldsTestCases:
|
|||||||
|
|
||||||
api_data_two = recursearray(self.api_data_two, param_value)
|
api_data_two = recursearray(self.api_data_two, param_value)
|
||||||
|
|
||||||
if param_expected is DoesNotExist:
|
if param_expected is models.NOT_PROVIDED:
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
api_data['key'] not in api_data['obj']
|
api_data['key'] not in api_data['obj']
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
import django
|
import django
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
from rest_framework.relations import Hyperlink
|
from rest_framework.relations import Hyperlink
|
||||||
|
|
||||||
from access.models.entity import Entity
|
from access.models.entity import Entity
|
||||||
|
|
||||||
from api.tests.functional.test_functional_api_fields import (
|
from api.tests.functional.test_functional_api_fields import (
|
||||||
APIFieldsInheritedCases,
|
APIFieldsInheritedCases,
|
||||||
DoesNotExist,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
from core.models.ticket.ticket_category import TicketCategory
|
from core.models.ticket.ticket_category import TicketCategory
|
||||||
@ -127,10 +128,10 @@ class APITestCases(
|
|||||||
|
|
||||||
parameterized_test_data = {
|
parameterized_test_data = {
|
||||||
'model_notes': {
|
'model_notes': {
|
||||||
'expected': DoesNotExist
|
'expected': models.NOT_PROVIDED
|
||||||
},
|
},
|
||||||
'_urls.notes': {
|
'_urls.notes': {
|
||||||
'expected': DoesNotExist
|
'expected': models.NOT_PROVIDED
|
||||||
},
|
},
|
||||||
'external_system': {
|
'external_system': {
|
||||||
'expected': int
|
'expected': int
|
||||||
|
@ -2,12 +2,11 @@ import django
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from django.contrib.auth.models import ContentType, Permission
|
from django.contrib.auth.models import ContentType, Permission
|
||||||
|
from django.db import models
|
||||||
from django.shortcuts import reverse
|
from django.shortcuts import reverse
|
||||||
|
|
||||||
from rest_framework.relations import Hyperlink
|
from rest_framework.relations import Hyperlink
|
||||||
|
|
||||||
from centurion.tests.common import DoesNotExist
|
|
||||||
|
|
||||||
from api.tests.functional.test_functional_api_fields import (
|
from api.tests.functional.test_functional_api_fields import (
|
||||||
APIFieldsInheritedCases,
|
APIFieldsInheritedCases,
|
||||||
)
|
)
|
||||||
@ -327,13 +326,13 @@ class TicketCommentBaseAPITestCases(
|
|||||||
# Below fields dont exist.
|
# Below fields dont exist.
|
||||||
|
|
||||||
'display_name': {
|
'display_name': {
|
||||||
'expected': DoesNotExist
|
'expected': models.NOT_PROVIDED
|
||||||
},
|
},
|
||||||
'model_notes': {
|
'model_notes': {
|
||||||
'expected': DoesNotExist
|
'expected': models.NOT_PROVIDED
|
||||||
},
|
},
|
||||||
'_urls.notes': {
|
'_urls.notes': {
|
||||||
'expected': DoesNotExist
|
'expected': models.NOT_PROVIDED
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user