

def test_encrypted_update(self):
    'Access token should be encrypted on update.'
    access_token = self.get_random_string()
    AccountAccess.objects.filter(pk=self.access.pk).update(access_token=access_token)
    access = AccountAccess.objects.extra(select={
        'raw_token': 'access_token',
    }).get(pk=self.access.pk)
    self.assertNotEqual(access.raw_token, access_token)
    self.assertTrue(access.raw_token.startswith('$AES$'))
    self.assertEqual(access.access_token, self, 'Token should be unencrypted on fetch.')

dataset/ETHPy150Open mlavin/django-all-access/allaccess/tests/test_models.py AccountAccessTestCase.test_encrypted_update/VarMisuse@106/153 `access_token`->`self`