← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/test-apachelogparser-ipv6 into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/test-apachelogparser-ipv6 into lp:launchpad.

Commit message:
Test that apachelogparser can handle IPv6 addresses.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/test-apachelogparser-ipv6/+merge/370769
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/test-apachelogparser-ipv6 into lp:launchpad.
=== modified file 'lib/lp/services/apachelogparser/tests/test_apachelogparser.py'
--- lib/lp/services/apachelogparser/tests/test_apachelogparser.py	2019-05-24 11:10:38 +0000
+++ lib/lp/services/apachelogparser/tests/test_apachelogparser.py	2019-07-30 14:51:58 +0000
@@ -82,6 +82,18 @@
         self.assertEqual(
             request, 'GET /10133748/cramfsswap_1.4.1.tar.gz HTTP/1.0')
 
+    def test_parsing_line_with_ipv6_address(self):
+        # IPv6 addresses in the hostname field are parsed.
+        line = (r'2001:67c:1560:8003::8003 - - [25/Jan/2009:15:48:07 +0000] '
+                r'"GET /10133748/cramfsswap_1.4.1.tar.gz HTTP/1.0" 200 12341 '
+                r'"http://foo.bar/baz"; "Mozilla/5.0"')
+        host, date, status, request = get_host_date_status_and_request(line)
+        self.assertEqual(host, '2001:67c:1560:8003::8003')
+        self.assertEqual(date, '[25/Jan/2009:15:48:07 +0000]')
+        self.assertEqual(status, '200')
+        self.assertEqual(
+            request, 'GET /10133748/cramfsswap_1.4.1.tar.gz HTTP/1.0')
+
     def test_day_extraction(self):
         date = '[13/Jun/2008:18:38:57 +0100]'
         self.assertEqual(get_day(date), datetime(2008, 6, 13))


Follow ups