def test_encrypted_save(self):
        key = self.get_random_string()
        secret = self.get_random_string()
        self.provider.consumer_key = key
        self.provider.consumer_secret = secret
        self.provider.save()
        provider = Provider.objects.extra(
            select={'raw_key': 'consumer_key', 'raw_secret': 'consumer_secret'}
        ).get(pk=self.provider.pk)
        self.assertNotEqual(provider.raw_key, key)
        self.assertTrue(provider.raw_key.startswith('$AES$'))
        self.assertNotEqual(provider.raw_secret, secret)
        self.assertTrue(provider.raw_secret.startswith('$AES$'))
Encrypt key/secret on save.
dataset/ETHPy150Open mlavin/django-all-access/allaccess/tests/test_models.py/ProviderTestCase.test_encrypted_save