#NEWLINE# def test_get_url_shortener( self ) : #NEWLINE# #INDENT# us_settings . URL_SHORTENER_BACKEND = 'mymodule.myclass' #NEWLINE# with warnings . catch_warnings ( record = True ) as w : #NEWLINE# #INDENT# self . assertEqual ( get_url_shortener ( ) , default . backend ) #NEWLINE# self . assertTrue ( issubclass ( self [ ( - 1 ) ] . category , RuntimeWarning ) ) #NEWLINE# self . assertEqual ( str ( w [ ( - 1 ) ] . message ) , 'mymodule.myclass backend cannot be imported' ) #NEWLINE# #UNINDENT# us_settings . URL_SHORTENER_BACKEND = 'zinnia.tests.implementations.custom_url_shortener' #NEWLINE# with warnings . catch_warnings ( record = True ) as w : #NEWLINE# #INDENT# self . assertEqual ( get_url_shortener ( ) , default . backend ) #NEWLINE# self . assertTrue ( issubclass ( w [ ( - 1 ) ] . category , RuntimeWarning ) ) #NEWLINE# self . assertEqual ( str ( w [ ( - 1 ) ] . message ) , 'This backend only exists for testing' ) #NEWLINE# #UNINDENT# us_settings . URL_SHORTENER_BACKEND = 'zinnia.url_shortener.backends.default' #NEWLINE# self . assertEqual ( get_url_shortener ( ) , default . backend )