1313 AppealFactory
1414)
1515from eap .factories import EAPFactory , EAPDocumentFactory
16+ from eap .models import EAPActivation
1617
1718
1819class AuthTokenTest (APITestCase ):
@@ -64,7 +65,6 @@ def test_sit_rep_types(self):
6465
6566 # Filter by event
6667 response = self .client .get ('/api/v2/situation_report/?limit=100&event=%s' % event1 .id )
67- print (response )
6868 self .assertEqual (response .status_code , 200 )
6969 count = response .json ()['count' ]
7070 self .assertEqual (count , 3 )
@@ -116,6 +116,15 @@ def test_create_and_update(self):
116116 'description' : 'test eap description' ,
117117 'trigger_met_date' : '2022-11-11 00:00' ,
118118 'document' : document1 .id ,
119+ 'originator_name' : 'test name' ,
120+ 'originator_title' : 'test originator title' ,
121+ 'originator_email' :
'[email protected] ' ,
122+ 'nsc_name_operational' : 'test name operational' ,
123+ 'nsc_title_operational' : 'test nsc operational' ,
124+ 'nsc_email_operational' : 'test nsc operational' ,
125+ 'ifrc_focal_name' : 'test focal name' ,
126+ 'ifrc_focal_title' : 'test focal title' ,
127+ 'ifrc_focal_email' :
'[email protected] ' 119128 }
120129 }
121130 self .client .force_authenticate (user = user )
@@ -149,6 +158,13 @@ def test_create_and_update(self):
149158 self .aws_translator ._fake_translation ('test' , 'es' , 'en' )
150159 )
151160
161+ # check eap-activation data
162+ eap_activation_obj = EAPActivation .objects .get (field_report = created )
163+ self .assertEqual (eap_activation_obj .title , 'eap activation title' )
164+ self .assertEqual (eap_activation_obj .eap .id , eap1 .id )
165+ self .assertEqual (eap_activation_obj .document .id , document1 .id )
166+ self .assertEqual (eap_activation_obj .field_report .id , created .id )
167+
152168 # created an emergency automatically
153169 self .assertEqual (created .event .name , 'test' )
154170 event_pk = created .event .id
@@ -168,7 +184,13 @@ def test_create_and_update(self):
168184 'trigger_met_date' : '2022-11-11 01:00' ,
169185 'document' : document2 .id ,
170186 'originator_name' : 'test name' ,
187+ 'originator_title' : 'test originator title' ,
188+ 'originator_email' :
'[email protected] ' ,
171189 'nsc_name_operational' : 'test name operational' ,
190+ 'nsc_title_operational' : 'test nsc operational' ,
191+ 'nsc_email_operational' : 'test nsc operational' ,
192+ 'ifrc_focal_name' : 'test focal name' ,
193+ 'ifrc_focal_title' : 'test focal title' ,
172194 'ifrc_focal_email' :
'[email protected] ' 173195 }
174196
@@ -200,6 +222,13 @@ def test_create_and_update(self):
200222 self .aws_translator ._fake_translation ('this is a test description' , 'es' , 'en' ),
201223 ) # This has not been reset
202224
225+ # check eap-activation data
226+ eap_activation_obj = EAPActivation .objects .get (field_report = updated )
227+ self .assertEqual (eap_activation_obj .title , 'eap activation title updated' )
228+ self .assertEqual (eap_activation_obj .eap .id , eap2 .id )
229+ self .assertEqual (eap_activation_obj .document .id , document2 .id )
230+ self .assertEqual (eap_activation_obj .field_report .id , updated .id )
231+
203232 body ['summary' ] = 'test [updated again]'
204233 with self .capture_on_commit_callbacks (execute = True ):
205234 response = self .client .put (f'/api/v2/update_field_report/{ created .id } /' , body , format = 'json' ).json ()
0 commit comments