本文整理匯總了Python中auvsi_suas.models.AccessLog.last_for_user方法的典型用法代碼示例。如果您正苦於以下問題:Python AccessLog.last_for_user方法的具體用法?Python AccessLog.last_for_user怎麽用?Python AccessLog.last_for_user使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類auvsi_suas.models.AccessLog
的用法示例。
在下文中一共展示了AccessLog.last_for_user方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_last_for_user_before_time
# 需要導入模塊: from auvsi_suas.models import AccessLog [as 別名]
# 或者: from auvsi_suas.models.AccessLog import last_for_user [as 別名]
def test_last_for_user_before_time(self):
start = timezone.now()
delta = datetime.timedelta(seconds=1)
logs = self.create_logs(self.user1, num=10, start=start, delta=delta)
before_time = start + delta * 3
log = AccessLog.last_for_user(self.user1, before_time=before_time)
self.assertEqual(logs[2], log)
示例2: test_basic_access
# 需要導入模塊: from auvsi_suas.models import AccessLog [as 別名]
# 或者: from auvsi_suas.models.AccessLog import last_for_user [as 別名]
def test_basic_access(self):
start = timezone.now() - datetime.timedelta(seconds=10)
logs = self.create_logs(self.user1, start=start)
log = AccessLog.last_for_user(self.user1)
self.assertEqual(logs[-1], log)
results = AccessLog.by_user(self.user1)
self.assertSequenceEqual(logs, results)
示例3: test_multi_user
# 需要導入模塊: from auvsi_suas.models import AccessLog [as 別名]
# 或者: from auvsi_suas.models.AccessLog import last_for_user [as 別名]
def test_multi_user(self):
# Intersperse logs from two users
logs = []
for _ in xrange(10):
logs += self.create_logs(self.user1, num=1)
self.create_logs(self.user2, num=1)
log = AccessLog.last_for_user(self.user1)
self.assertEqual(logs[-1], log)
results = AccessLog.by_user(self.user1)
self.assertSequenceEqual(logs, results)
示例4: test_no_data
# 需要導入模塊: from auvsi_suas.models import AccessLog [as 別名]
# 或者: from auvsi_suas.models.AccessLog import last_for_user [as 別名]
def test_no_data(self):
log = AccessLog.last_for_user(self.user1)
self.assertEqual(None, log)
logs = AccessLog.by_user(self.user1)
self.assertEqual(len(logs), 0)
logs = AccessLog.by_time_period(self.user1, [])
self.assertEqual(len(logs), 0)
log_rates = AccessLog.rates(self.user1, [])
self.assertTupleEqual(log_rates, (None, None))