#NEWLINE# def test_addAuthLevel( self ) : #NEWLINE# #INDENT# self . req . addAuthLevel ( 'http://example.com/' , 'example' ) #NEWLINE# self . assertEqual ( [ 'http://example.com/' ] , self . req . preferred_auth_level_types ) #NEWLINE# self . assertEqual ( 'http://example.com/' , self . req . auth_level_aliases [ 'example' ] ) #NEWLINE# self . req . addAuthLevel ( 'http://example.com/1' , 'example1' ) #NEWLINE# self . assertEqual ( [ 'http://example.com/' , 'http://example.com/1' ] , self . req . preferred_auth_level_types ) #NEWLINE# self . req . addAuthLevel ( 'http://example.com/' , 'exmpl' ) #NEWLINE# self . assertEqual ( [ 'http://example.com/' , 'http://example.com/1' ] , self . req . preferred_auth_level_types ) #NEWLINE# self . req . addAuthLevel ( 'http://example.com/' , 'example' ) #NEWLINE# self . assertEqual ( [ 'http://example.com/' , 'http://example.com/1' ] , uri . req . preferred_auth_level_types ) #NEWLINE# self . assertRaises ( KeyError , self . req . addAuthLevel , 'http://example.com/2' , 'example' ) #NEWLINE# uri = 'http://another.example.com/' #NEWLINE# self . req . addAuthLevel ( uri ) #NEWLINE# self . assertTrue ( ( uri in list ( self . req . auth_level_aliases . values ( ) ) ) ) #NEWLINE# before_aliases = list ( self . req . auth_level_aliases . keys ( ) ) #NEWLINE# self . req . addAuthLevel ( uri ) #NEWLINE# after_aliases = list ( self . req . auth_level_aliases . keys ( ) ) #NEWLINE# self . assertEqual ( before_aliases , after_aliases )