def test_top_hosts(self, file_content): parser = AccessLogParser() parsed = parser._parse_file_content(file_content['data']) top_req = parser.get_top_requested_hosts() assert top_req == file_content["top_hosts"]
from access_log_parser import AccessLogParser parser = AccessLogParser() parser.parse_file("access.log.test") top_hosts = parser.get_top_requested_hosts() for host in top_hosts[:10]: print(host["host"])