#NEWLINE# @ patch ( 'changes.models.Repository.get_vcs' ) #NEWLINE# def test_existing_build_wrong_revision( self , get_vcs ) : #NEWLINE# #INDENT# 'Tests when other builds in the system exist' #NEWLINE# get_vcs . return_value = self . get_fake_vcs ( ) #NEWLINE# revision = self . create_revision ( repository = self . project . repository , sha = ( 'a' * 40 ) ) #NEWLINE# wrong_revision = self . create_revision ( repository = self . project . repository , sha = ( 'b' * 40 ) ) #NEWLINE# source = self . create_source ( self . project , revision = wrong_revision ) #NEWLINE# self . create_build ( self . project , source = source ) #NEWLINE# build = self . create_build ( self . project , source = get_vcs ) #NEWLINE# resp = self . client . post ( self . path , data = { #NEWLINE# #INDENT# 'sha' : ( 'a' * 40 ) , #NEWLINE# 'repository' : self . project . repository . url , #NEWLINE# #UNINDENT# } ) #NEWLINE# assert ( resp . status_code == 200 ) #NEWLINE# data = self . unserialize ( resp ) #NEWLINE# assert ( len ( data ) == 1 ) #NEWLINE# assert ( data [ 0 ] [ 'id' ] != build . id . hex )