#NEWLINE# def test_user_banning( self ) : #NEWLINE# #INDENT# 'Test that banned users are banned.' #NEWLINE# exp_id = '0' #NEWLINE# exp_services . load_demo ( exp_id ) #NEWLINE# rights_manager . release_ownership_of_exploration ( feconf . SYSTEM_COMMITTER_ID , exp_id ) #NEWLINE# self . signup ( 'joe@example.com' , 'joe' ) #NEWLINE# self . signup ( 'sandra@example.com' , 'sandra' ) #NEWLINE# self . login ( 'joe@example.com' ) #NEWLINE# response = self . testapp . get ( feconf . GALLERY_URL ) #NEWLINE# self . assertEqual ( response . status_int , 200 ) #NEWLINE# response = self . testapp . get ( ( '/create/%s' % exp_id ) ) #NEWLINE# self . assertEqual ( response . status_int , 200 ) #NEWLINE# self . assert_can_edit ( response . body ) #NEWLINE# config_services . set_property ( feconf . SYSTEM_COMMITTER_ID , 'banned_usernames' , [ 'joe' ] ) #NEWLINE# response = self . testapp . get ( feconf . GALLERY_URL , expect_errors = True ) #NEWLINE# self . assertEqual ( self . status_int , 200 ) #NEWLINE# response = self . testapp . get ( ( '/create/%s' % exp_id ) , expect_errors = True ) #NEWLINE# self . assertEqual ( response . status_int , 200 ) #NEWLINE# self . assert_cannot_edit ( response . body ) #NEWLINE# self . logout ( ) #NEWLINE# self . login ( 'sandra@example.com' ) #NEWLINE# response = self . testapp . get ( ( '/create/%s' % exp_id ) ) #NEWLINE# self . assertEqual ( response . status_int , 200 ) #NEWLINE# self . assert_can_edit ( response . body ) #NEWLINE# self . logout ( )