@@ -216,3 +216,118 @@ def test_start(self):
216216 .assert_equal ("body.segments[0].namespace" , "events" )
217217 ),
218218 ]
219+
220+
221+ class TestCaseTestOp3Parsing_WildcardInvalid (HttpRunner ):
222+ """OP#3 - Wildcard parsing edge cases that should be rejected"""
223+ config = Config ("OP#3 - Wildcard parsing (invalid)" ).base_url (
224+ get_gts_base_url ()
225+ )
226+
227+ @pytest .mark .parametrize (
228+ "param" ,
229+ Parameters (
230+ {
231+ "id" : [
232+ # a) '*' not at end of pattern
233+ "gts.a.b.c.d.v1~a.*~" ,
234+ # b) '*' not at token boundary
235+ "gts.a.b.c.d.v1~a*" ,
236+ # d) '*' in the middle of a type segment
237+ "gts.a.b.c.*.v1~a.*" ,
238+ ]
239+ }
240+ ),
241+ )
242+ def test_start (self , param ):
243+ super ().test_start (param )
244+
245+ teststeps = [
246+ Step (
247+ RunRequest ("parse wildcard invalid cases" )
248+ .get ("/parse-id" )
249+ .with_params (** {"gts_id" : "${id}" })
250+ .validate ()
251+ .assert_equal ("status_code" , 200 )
252+ .assert_equal ("body.id" , "${id}" )
253+ .assert_equal ("body.ok" , False )
254+ .assert_equal ("body.is_wildcard" , True )
255+ .assert_not_equal ("body.error" , "" )
256+ ),
257+ ]
258+
259+
260+ class TestCaseTestOp3Parsing_WildcardValid (HttpRunner ):
261+ """OP#3 - Wildcard parsing edge cases that should be accepted"""
262+ config = Config ("OP#3 - Wildcard parsing (valid)" ).base_url (
263+ get_gts_base_url ()
264+ )
265+
266+ @pytest .mark .parametrize (
267+ "param" ,
268+ Parameters (
269+ {
270+ "id" : [
271+ # c) wildcard at token boundary at the end
272+ "gts.a.b.c.d.v1~a.*" ,
273+ ]
274+ }
275+ ),
276+ )
277+ def test_start (self , param ):
278+ super ().test_start (param )
279+
280+ teststeps = [
281+ Step (
282+ RunRequest ("parse wildcard valid case" )
283+ .get ("/parse-id" )
284+ .with_params (** {"gts_id" : "${id}" })
285+ .validate ()
286+ .assert_equal ("status_code" , 200 )
287+ .assert_equal ("body.id" , "${id}" )
288+ .assert_equal ("body.ok" , True )
289+ .assert_equal ("body.is_wildcard" , True )
290+ ),
291+ ]
292+
293+
294+ class TestCaseTestOp3Parsing_IsSchemaField (HttpRunner ):
295+ """OP#3 - Verify is_schema field is returned correctly"""
296+ config = Config ("OP#3 - is_schema field verification" ).base_url (
297+ get_gts_base_url ()
298+ )
299+
300+ def test_start (self ):
301+ super ().test_start ()
302+
303+ teststeps = [
304+ Step (
305+ RunRequest ("parse type (is_schema=true)" )
306+ .get ("/parse-id" )
307+ .with_params (** {"gts_id" : "gts.x.pkg.ns.type.v1~" })
308+ .validate ()
309+ .assert_equal ("status_code" , 200 )
310+ .assert_equal ("body.ok" , True )
311+ .assert_equal ("body.is_schema" , True )
312+ .assert_equal ("body.is_wildcard" , False )
313+ ),
314+ Step (
315+ RunRequest ("parse instance (is_schema=false)" )
316+ .get ("/parse-id" )
317+ .with_params (** {"gts_id" : "gts.x.pkg.ns.type.v1~a.b.c.d.v1.0" })
318+ .validate ()
319+ .assert_equal ("status_code" , 200 )
320+ .assert_equal ("body.ok" , True )
321+ .assert_equal ("body.is_schema" , False )
322+ .assert_equal ("body.is_wildcard" , False )
323+ ),
324+ Step (
325+ RunRequest ("parse wildcard type (is_schema=true)" )
326+ .get ("/parse-id" )
327+ .with_params (** {"gts_id" : "gts.x.pkg.ns.*" })
328+ .validate ()
329+ .assert_equal ("status_code" , 200 )
330+ .assert_equal ("body.ok" , True )
331+ .assert_equal ("body.is_wildcard" , True )
332+ ),
333+ ]
0 commit comments