def test_deconstruct(self): f = fields.EncryptedTextField() assert 'key' not in f.deconstruct()[3]
def test_PGCRYPTO_KEY_setting(self, settings): settings.PGCRYPTO_KEY = 'other' f = fields.EncryptedTextField() assert f.key == 'other'
def test_verbose_name(self): f = fields.EncryptedTextField("The Field") assert f.verbose_name == "The Field"
def test_name(self): f = fields.EncryptedTextField(name='field') assert f.name == 'field'
class EncryptedText(models.Model): value = fields.EncryptedTextField(default='hey')
def test_PGCRYPTO_KEY_setting_per_database_encrypt(self, db): conn = connections['secondary'] f = fields.EncryptedTextField() placeholder = f.get_placeholder('test', None, conn) assert 'secondary_key' in placeholder
def test_PGCRYPTO_KEY_setting(self, settings): settings.PGCRYPTO_KEY = 'other' f = fields.EncryptedTextField() placeholder = f.get_placeholder('test', None, connection) assert 'other' in placeholder