Skip to content

Commit 202d562

Browse files
committed
test: hostname format check fails on empty string
Assert that hostname format validation fails gracefully on empty strings. This is especially for Python `jsonschema` library that raises an unexpected ValueError exception on `hostname` check (python-jsonschema/jsonschema#1121). Adds similar test for: * draft3: host-name * draft4: hostname * draft6: hosntame * draft7: hostname, idn-hostname * draft2019-09: hostname, idn-hostname * draft2020-12: hostname, idn-hostname * draft-next: hostname, idn-hostname
1 parent b069ac3 commit 202d562

File tree

11 files changed

+55
-0
lines changed

11 files changed

+55
-0
lines changed

tests/draft-next/optional/format/hostname.json

+5
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@
9595
"description": "exceeds maximum label length",
9696
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
9797
"valid": false
98+
},
99+
{
100+
"description": "empty string",
101+
"data": "",
102+
"valid": false
98103
}
99104
]
100105
}

tests/draft-next/optional/format/idn-hostname.json

+5
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,11 @@
301301
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.1 https://www.w3.org/TR/alreq/#h_disjoining_enforcement",
302302
"data": "\u0628\u064a\u200c\u0628\u064a",
303303
"valid": true
304+
},
305+
{
306+
"description": "empty string",
307+
"data": "",
308+
"valid": false
304309
}
305310
]
306311
}

tests/draft2019-09/optional/format/hostname.json

+5
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@
9595
"description": "exceeds maximum label length",
9696
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
9797
"valid": false
98+
},
99+
{
100+
"description": "empty string",
101+
"data": "",
102+
"valid": false
98103
}
99104
]
100105
}

tests/draft2019-09/optional/format/idn-hostname.json

+5
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,11 @@
301301
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.1 https://www.w3.org/TR/alreq/#h_disjoining_enforcement",
302302
"data": "\u0628\u064a\u200c\u0628\u064a",
303303
"valid": true
304+
},
305+
{
306+
"description": "empty string",
307+
"data": "",
308+
"valid": false
304309
}
305310
]
306311
}

tests/draft2020-12/optional/format/hostname.json

+5
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@
9595
"description": "exceeds maximum label length",
9696
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
9797
"valid": false
98+
},
99+
{
100+
"description": "empty string",
101+
"data": "",
102+
"valid": false
98103
}
99104
]
100105
}

tests/draft2020-12/optional/format/idn-hostname.json

+5
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,11 @@
301301
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.1 https://www.w3.org/TR/alreq/#h_disjoining_enforcement",
302302
"data": "\u0628\u064a\u200c\u0628\u064a",
303303
"valid": true
304+
},
305+
{
306+
"description": "empty string",
307+
"data": "",
308+
"valid": false
304309
}
305310
]
306311
}

tests/draft3/optional/format/host-name.json

+5
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@
5757
"description": "exceeds maximum label length",
5858
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
5959
"valid": false
60+
},
61+
{
62+
"description": "empty string",
63+
"data": "",
64+
"valid": false
6065
}
6166
]
6267
}

tests/draft4/optional/format/hostname.json

+5
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@
9292
"description": "exceeds maximum label length",
9393
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
9494
"valid": false
95+
},
96+
{
97+
"description": "empty string",
98+
"data": "",
99+
"valid": false
95100
}
96101
]
97102
}

tests/draft6/optional/format/hostname.json

+5
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@
9292
"description": "exceeds maximum label length",
9393
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
9494
"valid": false
95+
},
96+
{
97+
"description": "empty string",
98+
"data": "",
99+
"valid": false
95100
}
96101
]
97102
}

tests/draft7/optional/format/hostname.json

+5
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@
9292
"description": "exceeds maximum label length",
9393
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
9494
"valid": false
95+
},
96+
{
97+
"description": "empty string",
98+
"data": "",
99+
"valid": false
95100
}
96101
]
97102
}

tests/draft7/optional/format/idn-hostname.json

+5
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,11 @@
298298
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.1 https://www.w3.org/TR/alreq/#h_disjoining_enforcement",
299299
"data": "\u0628\u064a\u200c\u0628\u064a",
300300
"valid": true
301+
},
302+
{
303+
"description": "empty string",
304+
"data": "",
305+
"valid": false
301306
}
302307
]
303308
}

0 commit comments

Comments
 (0)