'Create a new preference and assert the values.'

def _create_and_assert(self, user, key, value):

    preference = UserPreferenceFactory.create(user=user, key=key, value=value)
    self.assertEqual(preference.user, user)
    self.assertEqual(preference.key, key)
    self.assertEqual(preference.value, value)
    return preference
