'A set of assertions for comparing a XBlockUser to a django User'

def assert_xblock_user_matches_django(self, xb_user, dj_user):

    self.assertTrue(xb_user.opt_attrs[ATTR_KEY_IS_AUTHENTICATED])
    self.assertEqual(xb_user.emails[0], dj_user.email)
    self.assertEqual(xb_user.full_name, dj_user.profile.name)
    self.assertEqual(xb_user.opt_attrs[ATTR_KEY_USERNAME], dj_user.username)
    self.assertEqual(xb_user.opt_attrs[ATTR_KEY_USER_ID], dj_user.id)
    self.assertFalse(xb_user.opt_attrs[ATTR_KEY_USER_IS_STAFF])
    self.assertTrue(all(((pref in USER_PREFERENCES_WHITE_LIST) for pref in xb_user.opt_attrs[ATTR_KEY_USER_PREFERENCES])))
