File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change
1
+ # -*- coding: utf-8 -*-
1
2
2
3
import re
3
4
@@ -122,6 +123,21 @@ def test_char_field_encrypted(self):
122
123
fresh_model = TestModel .objects .get (id = model .id )
123
124
self .assertEqual (fresh_model .char , plaintext )
124
125
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
+
125
141
def test_short_char_field_encrypted (self ):
126
142
""" Test the max_length validation of an encrypted char field """
127
143
plaintext = 'Oh hi, test reader!'
You can’t perform that action at this time.
0 commit comments