#NEWLINE# def test_register( self ) : #NEWLINE# #INDENT# api = Api ( ) #NEWLINE# self . assertEqual ( len ( api . _registry ) , 0 ) #NEWLINE# api . register ( NoteResource ( ) ) #NEWLINE# self . assertEqual ( len ( api . _registry ) , 1 ) #NEWLINE# self . assertEqual ( sorted ( api . _registry . keys ( ) ) , [ 'notes' ] ) #NEWLINE# api . register ( UserResource ( ) ) #NEWLINE# self . assertEqual ( len ( api . _registry ) , 2 ) #NEWLINE# self . assertEqual ( sorted ( api . _registry . keys ( ) ) , [ 'notes' , 'users' ] ) #NEWLINE# api . register ( UserResource ( ) ) #NEWLINE# self . assertEqual ( len ( api . _registry ) , 2 ) #NEWLINE# self . assertEqual ( sorted ( api . _registry . keys ( ) ) , [ 'notes' , 'users' ] ) #NEWLINE# self . assertEqual ( len ( api . _canonicals ) , 2 ) #NEWLINE# api . register ( UserResource ( ) , canonical = False ) #NEWLINE# self . assertEqual ( len ( api . _registry ) , 2 ) #NEWLINE# self . assertEqual ( sorted ( api . _registry . keys ( ) ) , [ 'notes' , 'users' ] ) #NEWLINE# self . assertEqual ( len ( api . _canonicals ) , 2 ) #NEWLINE# self . assertRaises ( ValueError , self . register , NoteResource )