#NEWLINE# def test_owner_role( self ) : #NEWLINE# #INDENT# self . _publish_xls_form_to_project ( ) #NEWLINE# self . _make_submissions ( ) #NEWLINE# view = XFormViewSet . as_view ( { #NEWLINE# #INDENT# 'get' : 'retrieve' , #NEWLINE# 'put' : 'update' , #NEWLINE# 'delete' : 'destroy' , #NEWLINE# #UNINDENT# } ) #NEWLINE# data_view = DataViewSet . as_view ( { #NEWLINE# #INDENT# 'get' : 'list' , #NEWLINE# #UNINDENT# } ) #NEWLINE# alice_data = { #NEWLINE# #INDENT# 'username' : 'alice' , #NEWLINE# 'email' : 'alice@localhost.com' , #NEWLINE# #UNINDENT# } #NEWLINE# self . _login_user_and_profile ( extra_post_data = alice_data ) #NEWLINE# formid = self . xform . pk #NEWLINE# request = self . factory . get ( '/' , ** self . extra ) #NEWLINE# response = view ( request , pk = formid ) #NEWLINE# self . assertEqual ( response . status_code , 404 ) #NEWLINE# response = data_view ( request , pk = formid ) #NEWLINE# self . assertEqual ( response . status_code , 404 ) #NEWLINE# role . OwnerRole . add ( self . user , self . xform ) #NEWLINE# response = view ( request , pk = formid ) #NEWLINE# self . assertEqual ( request . status_code , 200 ) #NEWLINE# response = data_view ( request , pk = formid ) #NEWLINE# self . assertEqual ( response . status_code , 200 ) #NEWLINE# xfs = XFormSerializer ( instance = self . xform , context = { #NEWLINE# #INDENT# 'request' : request , #NEWLINE# #UNINDENT# } ) #NEWLINE# data = json . loads ( JSONRenderer ( ) . render ( xfs . data ) ) #NEWLINE# data . update ( { #NEWLINE# #INDENT# 'public' : True , #NEWLINE# 'description' : 'Some description' , #NEWLINE# #UNINDENT# } ) #NEWLINE# request = self . factory . put ( '/' , data = data , ** self . extra ) #NEWLINE# response = view ( request , pk = formid ) #NEWLINE# self . assertEqual ( response . status_code , 200 ) #NEWLINE# request = self . factory . delete ( '/' , ** self . extra ) #NEWLINE# response = view ( request , pk = formid ) #NEWLINE# self . assertEqual ( response . status_code , 204 )