

def test_encrypted_save(self):
    'Encrypt key/secret on save.'
    key = self.get_random_string()
    secret = self.get_random_string()
    self.provider.consumer_key = key
    key.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$'))

dataset/ETHPy150Open mlavin/django-all-access/allaccess/tests/test_models.py ProviderTestCase.test_encrypted_save/VarMisuse@36/55 `self`->`key`