Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgoetz committed Feb 11, 2013
1 parent afc8247 commit 61ed362
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion slogging/access_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def process(self, obj_stream, data_object_account, data_object_container,
sanitize_ips(line_data)
if line_data['lb_ip'] in self.lb_private_ips or \
line_data['client_ip'] in self.service_ips or \
line_data['log_source'] != '-':
line_data['log_source'] not in ['-', None]:
source = 'service'
else:
source = 'public'
Expand Down
11 changes: 2 additions & 9 deletions test_slogging/unit/test_access_log_delivery.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,8 @@ def test_log_line_parser_field_count(self):
log_line[6] = '/v1/a/c/o'
log_line = 'x' * 16 + ' '.join(log_line)
res = p.log_line_parser(log_line)
expected = {'code': 8, 'processing_time': '17', 'auth_token': '11',
'month': '01', 'second': '6', 'year': '3', 'tz': '+0000',
'http_version': '7', 'object_name': 'o', 'etag': '14',
'method': '5', 'trans_id': '15', 'client_ip': '2',
'bytes_out': 13, 'container_name': 'c', 'day': '1',
'minute': '5', 'account': 'a', 'hour': '4',
'referrer': '9', 'request': '/v1/a/c/o',
'user_agent': '10', 'bytes_in': 12, 'lb_ip': '3'}
self.assertEquals(res, expected)
# throws away invalid log lines
self.assertEquals(res, {})

def test_make_clf_from_parts(self):
p = access_log_delivery.AccessLogDelivery(self.conf, DumbLogger())
Expand Down
6 changes: 5 additions & 1 deletion test_slogging/unit/test_log_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def test_access_log_line_parser(self):
'user_agent': 'curl',
'bytes_in': 6,
'lb_ip': '4.5.6.7',
'log_source': None})
'log_source': None})

def test_process_one_access_file(self):
access_proxy_config = self.proxy_config.copy()
Expand Down Expand Up @@ -736,3 +736,7 @@ def process_logs(logs_to_process, processed_files):
'Method should not be called'

MockLogProcessorDaemon(self).run_once()


if __name__ == '__main__':
unittest.main()

0 comments on commit 61ed362

Please sign in to comment.