예제 #1
0
def test_get_multi_by_index(faker, action):
    assert AuditLog.get_multi_by_index(AuditLog.TYPE_SITE, 0)[:] == []
    assert AuditLog.get_multi_by_index(AuditLog.TYPE_TEAM, 0)[:] == []
    user = User.create_normal(faker.uuid4(), '-', faker.email())
    log = AuditLog.create(user.id, faker.ipv4(), action)
    assert AuditLog.get_multi_by_index(AuditLog.TYPE_SITE, 0)[:] == [log]
    assert AuditLog.get_multi_by_index(AuditLog.TYPE_TEAM, 0)[:] == []
예제 #2
0
파일: audit.py 프로젝트: zhoudaqing/huskar
 def _get_audit_logs(self, target_id, start, date):
     if target_id is None:
         return []
     if date:
         audit_logs = AuditLog.get_multi_by_index_with_date(
             self.target_type, target_id, date)
     else:
         audit_logs = AuditLog.get_multi_by_index(self.target_type,
                                                  target_id)
     return audit_logs[start:start + 100]