Пример #1
0
 def test_group_by(self, file_content):
     parser = AccessLogParser()
     parser._parse_file_content(file_content['data'])
     group_by = file_content["group_by"]
     parser.group_by(group_by['param'])
     parsed_data = parser.access_events
     rez = group_by['rez']
     assert len(parsed_data) == len(rez)
     for item in rez:
         assert item['requests'] == len(parsed_data[item['host']])
Пример #2
0
 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"]
Пример #3
0
 def test_page_content_parser(self, file_content):
     parser = AccessLogParser()
     parsed = parser._parse_file_content(file_content['data'])
     assert [pars['remote_host'] for pars in parsed] == file_content['hosts']