Skip to content

Commit 1c704fc

Browse files
committed
Add unit tests for strip_Url
1 parent fe85a04 commit 1c704fc

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tests/test_utils.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from aws_xray_sdk.ext.util import to_snake_case, get_hostname
1+
from aws_xray_sdk.ext.util import to_snake_case, get_hostname, strip_url
22

33

44
def test_to_snake_case():
@@ -36,3 +36,17 @@ def test_get_hostname():
3636

3737
s7 = get_hostname(None)
3838
assert not s7
39+
40+
41+
def test_strip_url():
42+
s1 = strip_url("https://amazon.com/page?getdata=response&stuff=morestuff")
43+
assert s1 == "https://amazon.com/page"
44+
45+
s2 = strip_url("aws.google.com/index.html?field=data&suchcool=data")
46+
assert s2 == "aws.google.com/index.html"
47+
48+
s3 = strip_url("INVALID_URL")
49+
assert s3 == "INVALID_URL"
50+
51+
assert strip_url("") == ""
52+
assert not strip_url(None)

0 commit comments

Comments
 (0)