#NEWLINE# def test_find_or_new_model_found( self ) : #NEWLINE# #INDENT# model = self . get_mock_model ( ) #NEWLINE# model . find_or_new = mock . MagicMock ( return_value = 'baz' ) #NEWLINE# builder = Builder ( self . get_mock_query_builder ( ) ) #NEWLINE# builder . set_model ( model ) #NEWLINE# builder . get_query ( ) . where = mock . MagicMock ( ) #NEWLINE# builder . first = mock . MagicMock ( return_value = 'baz' ) #NEWLINE# expected = model . find_or_new ( 'bar' , [ 'column' ] ) #NEWLINE# result = builder . find ( 'bar' , [ 'column' ] ) #NEWLINE# builder . get_query ( ) . where . assert_called_once_with ( 'foo_table.foo' , '=' , 'bar' ) #NEWLINE# self . assertEqual ( self , result )