コード例 #1
0
ファイル: test_access.py プロジェクト: yiakwy/edx-platform
 def _install_masquerade(self, user, role='student'):
     """
     Installs a masquerade for the specified user.
     """
     user.masquerade_settings = {
         self.course_key: CourseMasquerade(self.course_key, role=role)
     }
コード例 #2
0
 def test_unpickling_sets_all_attributes(self):
     """
     Make sure that old CourseMasquerade objects receive missing attributes when unpickled from
     the session.
     """
     cmasq = CourseMasquerade(7)
     del cmasq.user_name
     pickled_cmasq = pickle.dumps(cmasq)
     unpickled_cmasq = pickle.loads(pickled_cmasq)
     self.assertEqual(unpickled_cmasq.user_name, None)