#NEWLINE# def test_uri_prioritised_over_host_and_port( self ) : #NEWLINE# #INDENT# self . app . config [ 'MONGO_URI' ] = 'mongodb://localhost:27017/database_name' #NEWLINE# self . app . config [ 'MONGO_HOST' ] = 'some_other_host' #NEWLINE# self . app . config [ 'MONGO_PORT' ] = 27018 #NEWLINE# self . app . config [ 'MONGO_DBNAME' ] = 'not_the_correct_db_name' #NEWLINE# with warnings . catch_warnings ( ) : #NEWLINE# #INDENT# warnings . simplefilter ( 'ignore' ) #NEWLINE# mongo = flask . ext . pymongo . PyMongo ( self . app ) #NEWLINE# #UNINDENT# if ( pymongo . version_tuple [ 0 ] > 2 ) : #NEWLINE# #INDENT# time . sleep ( 0.2 ) #NEWLINE# assert ( ( 'localhost' , 27017 ) == mongo . cx . address ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# assert ( self . cx . host == 'localhost' ) #NEWLINE# assert ( mongo . cx . port == 27017 ) #NEWLINE# #UNINDENT# assert ( mongo . db . name == 'database_name' )