@@ -287,6 +287,7 @@ def test_embed__topics__without_ancestors__valid():
287287 "topics" : [
288288 {
289289 "id" : str (uuid .uuid4 ()),
290+ "channel_id" : str (uuid .uuid4 ()),
290291 "title" : "Target topic" ,
291292 "description" : "Target description" ,
292293 "language" : "en" ,
@@ -308,6 +309,7 @@ def test_embed__topics__with_ancestors__valid():
308309 "topics" : [
309310 {
310311 "id" : str (uuid .uuid4 ()),
312+ "channel_id" : str (uuid .uuid4 ()),
311313 "title" : "Target topic" ,
312314 "description" : "Target description" ,
313315 "language" : "en" ,
@@ -316,7 +318,6 @@ def test_embed__topics__with_ancestors__valid():
316318 "id" : str (uuid .uuid4 ()),
317319 "title" : "Parent topic" ,
318320 "description" : "Parent description" ,
319- "language" : "en" ,
320321 "level" : 1 ,
321322 }
322323 ],
@@ -338,6 +339,7 @@ def test_embed__topics__invalid_id():
338339 "topics" : [
339340 {
340341 "id" : "123" ,
342+ "channel_id" : str (uuid .uuid4 ()),
341343 "title" : "Target topic" ,
342344 "description" : "Target description" ,
343345 "language" : "en" ,
@@ -359,8 +361,52 @@ def test_embed__topics__missing_language():
359361 "topics" : [
360362 {
361363 "id" : str (uuid .uuid4 ()),
364+ "channel_id" : str (uuid .uuid4 ()),
365+ "title" : "Target topic" ,
366+ "description" : "Target description" ,
367+ }
368+ ],
369+ "metadata" : {
370+ "channel_title" : "Channel title" ,
371+ "some_additional_field" : "some_random_value" ,
372+ },
373+ }
374+ )
375+
376+
377+ @skip_if_jsonschema_unavailable
378+ def test_embed__topics__invalid_channel_id ():
379+ with pytest .raises (jsonschema .ValidationError ):
380+ validate_embed_topics_request (
381+ {
382+ "topics" : [
383+ {
384+ "id" : str (uuid .uuid4 ()),
385+ "channel_id" : "123" ,
362386 "title" : "Target topic" ,
363387 "description" : "Target description" ,
388+ "language" : "en" ,
389+ }
390+ ],
391+ "metadata" : {
392+ "channel_title" : "Channel title" ,
393+ "some_additional_field" : "some_random_value" ,
394+ },
395+ }
396+ )
397+
398+
399+ @skip_if_jsonschema_unavailable
400+ def test_embed__topics__missing_channel_id ():
401+ with pytest .raises (jsonschema .ValidationError ):
402+ validate_embed_topics_request (
403+ {
404+ "topics" : [
405+ {
406+ "id" : str (uuid .uuid4 ()),
407+ "title" : "Target topic" ,
408+ "description" : "Target description" ,
409+ "language" : "en" ,
364410 }
365411 ],
366412 "metadata" : {
0 commit comments