@@ -1640,8 +1640,10 @@ def test_dref_imminent_v2_final_report(self):
16401640 is_published = True ,
16411641 is_dref_imminent_v2 = True ,
16421642 sub_total_cost = 75000 ,
1643- indirect_cost = 5000 ,
1644- total_cost = 80000 ,
1643+ indirect_cost = 5800 ,
1644+ is_surge_personnel_deployed = True ,
1645+ surge_deployment_cost = 10000 ,
1646+ total_cost = 90800 ,
16451647 )
16461648 dref1 .proposed_action .set ([proposed_action_1 , proposed_action_2 ])
16471649 url = "/api/v2/dref-final-report/"
@@ -1663,11 +1665,15 @@ def test_dref_imminent_v2_final_report(self):
16631665 response .data ["sub_total_cost" ],
16641666 response .data ["indirect_cost" ],
16651667 response .data ["total_cost" ],
1668+ response .data ["surge_deployment_expenditure_cost" ],
1669+ response .data ["indirect_expenditure_cost" ],
16661670 },
16671671 {
16681672 dref1 .sub_total_cost ,
16691673 dref1 .indirect_cost ,
16701674 dref1 .total_cost ,
1675+ dref1 .surge_deployment_cost ,
1676+ dref1 .indirect_cost ,
16711677 },
16721678 )
16731679
@@ -1688,8 +1694,8 @@ def test_dref_imminent_v2_final_report(self):
16881694 ],
16891695 "sub_total_expenditure_cost" : 55000 ,
16901696 "surge_deployment_expenditure_cost" : 10000 ,
1691- "indirect_expenditure_cost" : 5000 ,
1692- "total_expenditure_cost" : 60000 ,
1697+ "indirect_expenditure_cost" : 5800 ,
1698+ "total_expenditure_cost" : 70800 ,
16931699 }
16941700 url = f"/api/v2/dref-final-report/{ response .data ['id' ]} /"
16951701 response = self .client .patch (url , data = data )
@@ -1761,6 +1767,27 @@ def test_dref_imminent_v2_final_report(self):
17611767 self .assert_201 (response )
17621768 self .assertEqual (response .data ["type_of_dref" ], Dref .DrefType .IMMINENT )
17631769
1770+ # Update existing dref final report
1771+ url = f"/api/v2/dref-final-report/{ response .data ['id' ]} /"
1772+ data = {
1773+ "title" : "Old Title" ,
1774+ "modified_at" : datetime .now (),
1775+ }
1776+ response = self .client .patch (url , data = data )
1777+ self .assert_200 (response )
1778+ self .assertEqual (
1779+ {
1780+ response .data ["title" ],
1781+ response .data ["type_of_dref" ],
1782+ response .data ["is_dref_imminent_v2" ],
1783+ },
1784+ {
1785+ data ["title" ],
1786+ Dref .DrefType .IMMINENT ,
1787+ False , # is_dref_imminent_v2 should be False for existing Dref of type IMMINENT
1788+ },
1789+ )
1790+
17641791
17651792User = get_user_model ()
17661793
0 commit comments