#NEWLINE# def test_dupe_complete_results_keeps_both_finds_latest( self ) : #NEWLINE# #INDENT# 'If dupe completed results exists, find the last-modified.' #NEWLINE# with mock . patch ( 'moztrap.model.mtmodel.utcnow' ) as mock_utcnow : #NEWLINE# #INDENT# mock_utcnow . return_value = datetime . datetime ( 2012 , 3 , 24 ) #NEWLINE# r = self . F . ResultFactory ( status = 'passed' ) #NEWLINE# mock_utcnow . return_value = datetime . datetime ( 2012 , 3 , 25 ) #NEWLINE# r2 = self . F . ResultFactory ( tester = r . tester , runcaseversion = r . runcaseversion , environment = r . environment , status = 'failed' ) #NEWLINE# #UNINDENT# self . assertEqual ( self . result_for ( r . runcaseversion , r . tester , r . environment , '{{ result.id }}' ) , str ( r2 . id ) ) #NEWLINE# self . assertEqual ( self . model . Result . objects . count ( ) , 2 )