def test_get_last_login_logs(self): self.generate_fixture_person() login_logs = events_service.get_last_login_logs() self.assertEqual(len(login_logs), 1) events_service.create_login_log(self.person.id, "127.0.0.1", "web") events_service.create_login_log(self.person.id, "127.0.0.1", "web") events_service.create_login_log(self.person.id, "127.0.0.1", "web") login_logs = events_service.get_last_login_logs() self.assertEqual(len(login_logs), 4) login_logs = events_service.get_last_login_logs(page_size=2) self.assertEqual(len(login_logs), 2)
def get(self): args = self.get_args( [("before", None, None), ("page_size", 100, False)] ) permissions.check_manager_permissions() before = None if args["before"] is not None: before = fields.get_date_object(args["before"], "%Y-%m-%dT%H:%M:%S") page_size = args["page_size"] return events_service.get_last_login_logs(before, page_size)