11import os
22from unittest import mock
3- from datetime import datetime
3+ from datetime import datetime , timedelta
44
55
66from django .conf import settings
@@ -356,7 +356,8 @@ def test_update_dref_image(self):
356356 "file" : file2 .id ,
357357 "caption" : "Test Caption"
358358 }
359- ]
359+ ],
360+ "modified_at" : datetime .now ()
360361 }
361362 self .client .force_authenticate (self .user )
362363 response = self .client .patch (url , data = data , format = "json" )
@@ -373,7 +374,8 @@ def test_update_dref_image(self):
373374 "file" : file4 .id ,
374375 "caption" : "Test Caption"
375376 }
376- ]
377+ ],
378+ "modified_at" : datetime .now ()
377379 }
378380 self .client .force_authenticate (self .ifrc_user )
379381 response = self .client .patch (url , data , format = 'multipart' )
@@ -386,7 +388,8 @@ def test_update_dref_image(self):
386388 "file" : file4 .id ,
387389 "caption" : "Test Caption"
388390 }
389- ]
391+ ],
392+ "modified_at" : datetime .now ()
390393 }
391394 self .client .force_authenticate (self .ifrc_user )
392395 response = self .client .patch (url , data )
@@ -399,7 +402,8 @@ def test_update_dref_image(self):
399402 "file" : file5 .id ,
400403 "caption" : "Test Caption"
401404 }
402- ]
405+ ],
406+ "modified_at" : datetime .now ()
403407 }
404408 self .client .force_authenticate (self .ifrc_user )
405409 response = self .client .patch (url , data )
@@ -443,11 +447,13 @@ def test_dref_is_published(self):
443447 """
444448 dref = DrefFactory .create (
445449 title = 'test' , created_by = self .user ,
446- is_published = True
450+ is_published = True ,
451+ modified_at = datetime .now () + timedelta (days = - 1 )
447452 )
448453 url = f'/api/v2/dref/{ dref .id } /'
449454 data = {
450- "title" : "New Update Title"
455+ "title" : "New Update Title" ,
456+ "modified_at" : datetime .now (),
451457 }
452458 self .client .force_authenticate (self .user )
453459 response = self .client .patch (url , data )
@@ -456,6 +462,7 @@ def test_dref_is_published(self):
456462 # create new dref with is_published = False
457463 not_published_dref = DrefFactory .create (
458464 title = 'test' , created_by = self .user ,
465+ modified_at = datetime .now () + timedelta (days = - 1 )
459466 )
460467 url = f'/api/v2/dref/{ not_published_dref .id } /'
461468 self .client .force_authenticate (self .user )
0 commit comments