Skip to content

Commit

Permalink
failing unicode test
Browse files Browse the repository at this point in the history
  • Loading branch information
defrex committed Jan 9, 2014
1 parent 2bc7503 commit 23b0216
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions encrypted_fields/tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-

import re

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

def test_unicode_encrypted(self):
plaintext = 'Oh hi, test reader! 🐱'

model = TestModel()
model.char = plaintext
model.save()

ciphertext = self.get_db_value('char', model.id)

self.assertNotEqual(plaintext, ciphertext)
self.assertTrue('test' not in ciphertext)

fresh_model = TestModel.objects.get(id=model.id)
self.assertEqual(fresh_model.char, plaintext)

def test_short_char_field_encrypted(self):
""" Test the max_length validation of an encrypted char field """
plaintext = 'Oh hi, test reader!'
Expand Down

0 comments on commit 23b0216

Please sign in to comment.