本文整理汇总了Python中tests.factories.UserFactory.get_activity_points方法的典型用法代码示例。如果您正苦于以下问题:Python UserFactory.get_activity_points方法的具体用法?Python UserFactory.get_activity_points怎么用?Python UserFactory.get_activity_points使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.factories.UserFactory
的用法示例。
在下文中一共展示了UserFactory.get_activity_points方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_increment_user_activity_counters
# 需要导入模块: from tests.factories import UserFactory [as 别名]
# 或者: from tests.factories.UserFactory import get_activity_points [as 别名]
def test_increment_user_activity_counters(self):
user = UserFactory()
date = datetime.utcnow()
assert_equal(user.get_activity_points(db=self.db), 0)
analytics.increment_user_activity_counters(user._id, 'project_created', date, db=self.db)
assert_equal(user.get_activity_points(db=self.db), 1)
示例2: test_get_total_activity_count
# 需要导入模块: from tests.factories import UserFactory [as 别名]
# 或者: from tests.factories.UserFactory import get_activity_points [as 别名]
def test_get_total_activity_count(self):
user = UserFactory()
date = datetime.utcnow()
assert_equal(analytics.get_total_activity_count(user._id), 0)
assert_equal(analytics.get_total_activity_count(user._id), user.get_activity_points(db=self.db))
analytics.increment_user_activity_counters(user._id, 'project_created', date.isoformat(), db=self.db)
assert_equal(analytics.get_total_activity_count(user._id, db=self.db), 1)
assert_equal(analytics.get_total_activity_count(user._id, db=self.db), user.get_activity_points(db=self.db))