Skip to content

Commit a4914f4

Browse files
committed
Update test model names prefix and suffix
1 parent 324c959 commit a4914f4

File tree

2 files changed

+57
-57
lines changed

2 files changed

+57
-57
lines changed

tests/encryption_/models.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -53,78 +53,78 @@ class Billing(EmbeddedModel):
5353

5454

5555
# Equality-queryable fields
56-
class EncryptedBinaryTest(EncryptedTestModel):
56+
class BinaryModel(EncryptedTestModel):
5757
value = EncryptedBinaryField(queries={"queryType": "equality"})
5858

5959

60-
class EncryptedBooleanTest(EncryptedTestModel):
60+
class BooleanModel(EncryptedTestModel):
6161
value = EncryptedBooleanField(queries={"queryType": "equality"})
6262

6363

64-
class EncryptedCharTest(EncryptedTestModel):
64+
class CharModel(EncryptedTestModel):
6565
value = EncryptedCharField(max_length=255, queries={"queryType": "equality"})
6666

6767

68-
class EncryptedEmailTest(EncryptedTestModel):
68+
class EmailModel(EncryptedTestModel):
6969
value = EncryptedEmailField(max_length=255, queries={"queryType": "equality"})
7070

7171

72-
class EncryptedGenericIPAddressTest(EncryptedTestModel):
72+
class GenericIPAddressModel(EncryptedTestModel):
7373
value = EncryptedGenericIPAddressField(queries={"queryType": "equality"})
7474

7575

76-
class EncryptedTextTest(EncryptedTestModel):
76+
class TextModel(EncryptedTestModel):
7777
value = EncryptedTextField(queries={"queryType": "equality"})
7878

7979

80-
class EncryptedURLTest(EncryptedTestModel):
80+
class URLModel(EncryptedTestModel):
8181
value = EncryptedURLField(max_length=500, queries={"queryType": "equality"})
8282

8383

8484
# Range-queryable fields (also support equality)
85-
class EncryptedBigIntegerTest(EncryptedTestModel):
85+
class BigIntegerModel(EncryptedTestModel):
8686
value = EncryptedBigIntegerField(queries={"queryType": "range"})
8787

8888

89-
class EncryptedDateTest(EncryptedTestModel):
89+
class DateModel(EncryptedTestModel):
9090
value = EncryptedDateField(queries={"queryType": "range"})
9191

9292

93-
class EncryptedDateTimeTest(EncryptedTestModel):
93+
class DateTimeModel(EncryptedTestModel):
9494
value = EncryptedDateTimeField(queries={"queryType": "range"})
9595

9696

97-
class EncryptedDecimalTest(EncryptedTestModel):
97+
class DecimalModel(EncryptedTestModel):
9898
value = EncryptedDecimalField(max_digits=10, decimal_places=2, queries={"queryType": "range"})
9999

100100

101-
class EncryptedDurationTest(EncryptedTestModel):
101+
class DurationModel(EncryptedTestModel):
102102
value = EncryptedDurationField(queries={"queryType": "range"})
103103

104104

105-
class EncryptedFloatTest(EncryptedTestModel):
105+
class FloatModel(EncryptedTestModel):
106106
value = EncryptedFloatField(queries={"queryType": "range"})
107107

108108

109-
class EncryptedIntegerTest(EncryptedTestModel):
109+
class IntegerModel(EncryptedTestModel):
110110
value = EncryptedIntegerField(queries={"queryType": "range"})
111111

112112

113-
class EncryptedPositiveBigIntegerTest(EncryptedTestModel):
113+
class PositiveBigIntegerModel(EncryptedTestModel):
114114
value = EncryptedPositiveBigIntegerField(queries={"queryType": "range"})
115115

116116

117-
class EncryptedPositiveIntegerTest(EncryptedTestModel):
117+
class PositiveIntegerModel(EncryptedTestModel):
118118
value = EncryptedPositiveIntegerField(queries={"queryType": "range"})
119119

120120

121-
class EncryptedPositiveSmallIntegerTest(EncryptedTestModel):
121+
class PositiveSmallIntegerModel(EncryptedTestModel):
122122
value = EncryptedPositiveSmallIntegerField(queries={"queryType": "range"})
123123

124124

125-
class EncryptedSmallIntegerTest(EncryptedTestModel):
125+
class SmallIntegerModel(EncryptedTestModel):
126126
value = EncryptedSmallIntegerField(queries={"queryType": "range"})
127127

128128

129-
class EncryptedTimeTest(EncryptedTestModel):
129+
class TimeModel(EncryptedTestModel):
130130
value = EncryptedTimeField(queries={"queryType": "range"})

tests/encryption_/test_fields.py

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,28 @@
44
from django_mongodb_backend.fields import EncryptedCharField
55

66
from .models import (
7+
BigIntegerModel,
78
Billing,
8-
EncryptedBigIntegerTest,
9-
EncryptedBinaryTest,
10-
EncryptedBooleanTest,
11-
EncryptedCharTest,
12-
EncryptedDateTest,
13-
EncryptedDateTimeTest,
14-
EncryptedDecimalTest,
15-
EncryptedDurationTest,
16-
EncryptedEmailTest,
17-
EncryptedFloatTest,
18-
EncryptedGenericIPAddressTest,
19-
EncryptedIntegerTest,
20-
EncryptedPositiveBigIntegerTest,
21-
EncryptedPositiveIntegerTest,
22-
EncryptedPositiveSmallIntegerTest,
23-
EncryptedSmallIntegerTest,
24-
EncryptedTextTest,
25-
EncryptedTimeTest,
26-
EncryptedURLTest,
9+
BinaryModel,
10+
BooleanModel,
11+
CharModel,
12+
DateModel,
13+
DateTimeModel,
14+
DecimalModel,
15+
DurationModel,
16+
EmailModel,
17+
FloatModel,
18+
GenericIPAddressModel,
19+
IntegerModel,
2720
Patient,
2821
PatientRecord,
22+
PositiveBigIntegerModel,
23+
PositiveIntegerModel,
24+
PositiveSmallIntegerModel,
25+
SmallIntegerModel,
26+
TextModel,
27+
TimeModel,
28+
URLModel,
2929
)
3030
from .test_base import EncryptionTestCase
3131

@@ -66,83 +66,83 @@ def assertRange(self, model_cls, *, low, high, threshold):
6666

6767
# Equality-only fields
6868
def test_binary(self):
69-
self.assertEquality(EncryptedBinaryTest, b"\x00\x01\x02")
69+
self.assertEquality(BinaryModel, b"\x00\x01\x02")
7070

7171
def test_boolean(self):
72-
self.assertEquality(EncryptedBooleanTest, True)
72+
self.assertEquality(BooleanModel, True)
7373

7474
def test_char(self):
75-
self.assertEquality(EncryptedCharTest, "hello")
75+
self.assertEquality(CharModel, "hello")
7676

7777
def test_email(self):
78-
self.assertEquality(EncryptedEmailTest, "[email protected]")
78+
self.assertEquality(EmailModel, "[email protected]")
7979

8080
def test_ip(self):
81-
self.assertEquality(EncryptedGenericIPAddressTest, "192.168.0.1")
81+
self.assertEquality(GenericIPAddressModel, "192.168.0.1")
8282

8383
def test_text(self):
84-
self.assertEquality(EncryptedTextTest, "some text")
84+
self.assertEquality(TextModel, "some text")
8585

8686
def test_url(self):
87-
self.assertEquality(EncryptedURLTest, "https://example.com")
87+
self.assertEquality(URLModel, "https://example.com")
8888

8989
# Range fields
9090
def test_big_integer(self):
91-
self.assertRange(EncryptedBigIntegerTest, low=100, high=200, threshold=150)
91+
self.assertRange(BigIntegerModel, low=100, high=200, threshold=150)
9292

9393
def test_date(self):
9494
self.assertRange(
95-
EncryptedDateTest,
95+
DateModel,
9696
low=datetime.date(2024, 6, 1),
9797
high=datetime.date(2024, 6, 10),
9898
threshold=datetime.date(2024, 6, 5),
9999
)
100100

101101
def test_datetime(self):
102102
self.assertRange(
103-
EncryptedDateTimeTest,
103+
DateTimeModel,
104104
low=datetime.datetime(2024, 6, 1, 12, 0),
105105
high=datetime.datetime(2024, 6, 2, 12, 0),
106106
threshold=datetime.datetime(2024, 6, 2, 0, 0),
107107
)
108108

109109
def test_decimal(self):
110110
self.assertRange(
111-
EncryptedDecimalTest,
111+
DecimalModel,
112112
low=Decimal("123.45"),
113113
high=Decimal("200.50"),
114114
threshold=Decimal("150"),
115115
)
116116

117117
def test_duration(self):
118118
self.assertRange(
119-
EncryptedDurationTest,
119+
DurationModel,
120120
low=datetime.timedelta(days=3),
121121
high=datetime.timedelta(days=10),
122122
threshold=datetime.timedelta(days=5),
123123
)
124124

125125
def test_float(self):
126-
self.assertRange(EncryptedFloatTest, low=1.23, high=4.56, threshold=3.0)
126+
self.assertRange(FloatModel, low=1.23, high=4.56, threshold=3.0)
127127

128128
def test_integer(self):
129-
self.assertRange(EncryptedIntegerTest, low=5, high=10, threshold=7)
129+
self.assertRange(IntegerModel, low=5, high=10, threshold=7)
130130

131131
def test_positive_big_integer(self):
132-
self.assertRange(EncryptedPositiveBigIntegerTest, low=100, high=500, threshold=200)
132+
self.assertRange(PositiveBigIntegerModel, low=100, high=500, threshold=200)
133133

134134
def test_positive_integer(self):
135-
self.assertRange(EncryptedPositiveIntegerTest, low=10, high=20, threshold=15)
135+
self.assertRange(PositiveIntegerModel, low=10, high=20, threshold=15)
136136

137137
def test_positive_small_integer(self):
138-
self.assertRange(EncryptedPositiveSmallIntegerTest, low=5, high=8, threshold=6)
138+
self.assertRange(PositiveSmallIntegerModel, low=5, high=8, threshold=6)
139139

140140
def test_small_integer(self):
141-
self.assertRange(EncryptedSmallIntegerTest, low=-5, high=2, threshold=0)
141+
self.assertRange(SmallIntegerModel, low=-5, high=2, threshold=0)
142142

143143
def test_time(self):
144144
self.assertRange(
145-
EncryptedTimeTest,
145+
TimeModel,
146146
low=datetime.time(10, 0),
147147
high=datetime.time(15, 0),
148148
threshold=datetime.time(12, 0),

0 commit comments

Comments
 (0)