aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2017-04-10 20:24:15 +0200
committerGitHub <noreply@github.com>2017-04-10 20:24:15 +0200
commitec6be96f2ad05776127efc29fae1df51647aa1fb (patch)
treef74088499d45c3ccf32a58cb5da0a26330acf1fe /test
parentc7b501275205e2cf82055981106336d4a0db252f (diff)
parent742127ef7bcde86bdde911a8399a05c4c4d75d5b (diff)
downloadmitmproxy-ec6be96f2ad05776127efc29fae1df51647aa1fb.tar.gz
mitmproxy-ec6be96f2ad05776127efc29fae1df51647aa1fb.tar.bz2
mitmproxy-ec6be96f2ad05776127efc29fae1df51647aa1fb.zip
Merge pull request #2234 from ujjwal96/ip-formatting
Fixes IP address formatting #2109
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/utils/test_human.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/mitmproxy/utils/test_human.py b/test/mitmproxy/utils/test_human.py
index 3d65dfd1..76dc2f88 100644
--- a/test/mitmproxy/utils/test_human.py
+++ b/test/mitmproxy/utils/test_human.py
@@ -46,3 +46,10 @@ def test_pretty_duration():
assert human.pretty_duration(10000) == "10000s"
assert human.pretty_duration(1.123) == "1.12s"
assert human.pretty_duration(0.123) == "123ms"
+
+
+def test_format_address():
+ assert human.format_address(("::1", "54010", "0", "0")) == "[::1]:54010"
+ assert human.format_address(("::ffff:127.0.0.1", "54010", "0", "0")) == "127.0.0.1:54010"
+ assert human.format_address(("127.0.0.1", "54010")) == "127.0.0.1:54010"
+ assert human.format_address(("example.com", "54010")) == "example.com:54010"