2424
2525from ietf .group .factories import GroupFactory , RoleFactory
2626from ietf .liaisons .factories import ( LiaisonStatementFactory ,
27- LiaisonStatementEventFactory , LiaisonStatementAttachmentFactory , )
27+ LiaisonStatementEventFactory , LiaisonStatementAttachmentFactory , RelatedLiaisonStatementFactory )
2828from ietf .liaisons .models import (LiaisonStatement , LiaisonStatementPurposeName ,
2929 LiaisonStatementAttachment )
3030from ietf .person .models import Person
@@ -393,6 +393,8 @@ def test_edit_liaison(self):
393393 LiaisonStatementEventFactory (statement = liaison ,type_id = 'posted' )
394394 from_group = liaison .from_groups .first ()
395395 to_group = liaison .to_groups .first ()
396+ rel1 = RelatedLiaisonStatementFactory (source = liaison )
397+ rel2 = RelatedLiaisonStatementFactory (source = liaison )
396398
397399 url = urlreverse ('ietf.liaisons.views.liaison_edit' , kwargs = dict (object_id = liaison .pk ))
398400 login_testing_unauthorized (self , "secretary" , url )
@@ -402,6 +404,13 @@ def test_edit_liaison(self):
402404 self .assertEqual (r .status_code , 200 )
403405 q = PyQuery (r .content )
404406 self .assertEqual (len (q ('form input[name=from_contact]' )), 1 )
407+ json_data = q ('form select[name=related_to]' ).attr ('data-pre' )
408+ try :
409+ decoded = json .loads (json_data )
410+ except json .JSONDecodeError as e :
411+ self .fail ('data-pre contained invalid JSON data: %s' % str (e ))
412+ decoded_ids = [item ['id' ] for item in decoded ]
413+ self .assertEqual (decoded_ids , [rel1 .target .id , rel2 .target .id ])
405414
406415 # edit
407416 attachments_before = liaison .attachments .count ()
@@ -1165,4 +1174,4 @@ def test_send_liaison_deadline_reminder(self):
11651174
11661175 mailbox_before = len (outbox )
11671176 possibly_send_deadline_reminder (liaison )
1168- self .assertEqual (len (outbox ), mailbox_before )
1177+ self .assertEqual (len (outbox ), mailbox_before )
0 commit comments