'Ensure that the correct preference for the user is persisted'

def assertPrefValid(self, user):

    pref = UserPreference.objects.get(user=user, key=NOTIFICATION_PREF_KEY)
    self.assertTrue(pref)
    self.assertEqual(str(user.username.encode('utf-8')), UsernameCipher().decrypt(str(pref.value)))
