Skip to content

Commit 23b0216

Browse files
committed
failing unicode test
1 parent 2bc7503 commit 23b0216

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

encrypted_fields/tests.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12

23
import re
34

@@ -122,6 +123,21 @@ def test_char_field_encrypted(self):
122123
fresh_model = TestModel.objects.get(id=model.id)
123124
self.assertEqual(fresh_model.char, plaintext)
124125

126+
def test_unicode_encrypted(self):
127+
plaintext = 'Oh hi, test reader! 🐱'
128+
129+
model = TestModel()
130+
model.char = plaintext
131+
model.save()
132+
133+
ciphertext = self.get_db_value('char', model.id)
134+
135+
self.assertNotEqual(plaintext, ciphertext)
136+
self.assertTrue('test' not in ciphertext)
137+
138+
fresh_model = TestModel.objects.get(id=model.id)
139+
self.assertEqual(fresh_model.char, plaintext)
140+
125141
def test_short_char_field_encrypted(self):
126142
""" Test the max_length validation of an encrypted char field """
127143
plaintext = 'Oh hi, test reader!'

0 commit comments

Comments
 (0)