当前位置: 首页>>代码示例>>Python>>正文


Python CourseEnrollment.enrollment_status_hash_cache_key方法代码示例

本文整理汇总了Python中student.models.CourseEnrollment.enrollment_status_hash_cache_key方法的典型用法代码示例。如果您正苦于以下问题:Python CourseEnrollment.enrollment_status_hash_cache_key方法的具体用法?Python CourseEnrollment.enrollment_status_hash_cache_key怎么用?Python CourseEnrollment.enrollment_status_hash_cache_key使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在student.models.CourseEnrollment的用法示例。


在下文中一共展示了CourseEnrollment.enrollment_status_hash_cache_key方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_save_deletes_cached_enrollment_status_hash

# 需要导入模块: from student.models import CourseEnrollment [as 别名]
# 或者: from student.models.CourseEnrollment import enrollment_status_hash_cache_key [as 别名]
    def test_save_deletes_cached_enrollment_status_hash(self):
        """ Verify the method deletes the cached enrollment status hash for the user. """
        # There should be no cached value for a new user with no enrollments.
        self.assertIsNone(cache.get(CourseEnrollment.enrollment_status_hash_cache_key(self.user)))

        # Generating a status hash should cache the generated value.
        status_hash = CourseEnrollment.generate_enrollment_status_hash(self.user)
        self.assert_enrollment_status_hash_cached(self.user, status_hash)

        # Modifying enrollments should delete the cached value.
        CourseEnrollmentFactory.create(user=self.user)
        self.assertIsNone(cache.get(CourseEnrollment.enrollment_status_hash_cache_key(self.user)))
开发者ID:Lektorium-LLC,项目名称:edx-platform,代码行数:14,代码来源:test_models.py

示例2: assert_enrollment_status_hash_cached

# 需要导入模块: from student.models import CourseEnrollment [as 别名]
# 或者: from student.models.CourseEnrollment import enrollment_status_hash_cache_key [as 别名]
 def assert_enrollment_status_hash_cached(self, user, expected_value):
     self.assertEqual(cache.get(CourseEnrollment.enrollment_status_hash_cache_key(user)), expected_value)
开发者ID:Lektorium-LLC,项目名称:edx-platform,代码行数:4,代码来源:test_models.py

示例3: test_enrollment_status_hash_cache_key

# 需要导入模块: from student.models import CourseEnrollment [as 别名]
# 或者: from student.models.CourseEnrollment import enrollment_status_hash_cache_key [as 别名]
 def test_enrollment_status_hash_cache_key(self):
     username = 'test-user'
     user = UserFactory(username=username)
     expected = 'enrollment_status_hash_' + username
     self.assertEqual(CourseEnrollment.enrollment_status_hash_cache_key(user), expected)
开发者ID:Lektorium-LLC,项目名称:edx-platform,代码行数:7,代码来源:test_models.py


注:本文中的student.models.CourseEnrollment.enrollment_status_hash_cache_key方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。