Skip to content

Commit e73f4a7

Browse files
committed
Code review fixes
- Remove t1/t2 in test_time - Factor out skipUnlessDBFeature into base test case. - Test encryption_patient not encryption_patientrecord (still not right, but will follow up to clarify/fix)
1 parent 9ec566e commit e73f4a7

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

tests/encryption_/test_base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from django.test import TestCase
1+
from django.test import TestCase, skipUnlessDBFeature
22

33

4+
@skipUnlessDBFeature("supports_queryable_encryption")
45
class EncryptionTestCase(TestCase):
56
databases = {"default", "encrypted"}
67
maxDiff = None

tests/encryption_/test_fields.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import datetime
22
from decimal import Decimal
33

4-
from django.test import TestCase, skipUnlessDBFeature
4+
from django.test import TestCase
55

66
from .models import (
77
Billing,
@@ -30,7 +30,6 @@
3030
from .test_base import EncryptionTestCase
3131

3232

33-
@skipUnlessDBFeature("supports_queryable_encryption")
3433
class PatientModelTests(EncryptionTestCase):
3534
def setUp(self):
3635
self.billing = Billing(cc_type="Visa", cc_number="4111111111111111")
@@ -46,7 +45,6 @@ def test_patient(self):
4645
self.assertEqual(patient.patient_record.billing.cc_number, "4111111111111111")
4746

4847

49-
@skipUnlessDBFeature("supports_queryable_encryption")
5048
class EncryptedFieldTests(TestCase):
5149
databases = {"default", "encrypted"}
5250

@@ -145,6 +143,9 @@ def test_small_integer(self):
145143
self.assertRange(EncryptedSmallIntegerTest, low=-5, high=2, threshold=0)
146144

147145
def test_time(self):
148-
t1 = datetime.time(10, 0)
149-
t2 = datetime.time(15, 0)
150-
self.assertRange(EncryptedTimeTest, low=t1, high=t2, threshold=datetime.time(12, 0))
146+
self.assertRange(
147+
EncryptedTimeTest,
148+
low=datetime.time(10, 0),
149+
high=datetime.time(15, 0),
150+
threshold=datetime.time(12, 0),
151+
)

tests/encryption_/test_management.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22

33
from bson import json_util
44
from django.core.management import call_command
5-
from django.test import modify_settings, skipUnlessDBFeature
5+
from django.test import modify_settings
66

77
from .test_base import EncryptionTestCase
88

99

10-
@skipUnlessDBFeature("supports_queryable_encryption")
1110
@modify_settings(INSTALLED_APPS={"prepend": "django_mongodb_backend"})
1211
class CommandTests(EncryptionTestCase):
1312
# Expected encrypted field maps for all Encrypted* models
1413
expected_maps = {
15-
"encryption__patientrecord": {
14+
"encryption__patient": {
1615
"fields": [
1716
{"bsonType": "string", "path": "ssn", "queries": {"queryType": "equality"}},
1817
{"bsonType": "object", "path": "billing"},

tests/encryption_/test_schema.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
from django.db import connections
2-
from django.test import skipUnlessDBFeature
32

43
from . import models
54
from .test_base import EncryptionTestCase
65

76

8-
@skipUnlessDBFeature("supports_queryable_encryption")
97
class SchemaTests(EncryptionTestCase):
108
# Expected encrypted fields map per model
119
expected_map = {

0 commit comments

Comments
 (0)