#NEWLINE# def test_assign_form_to_project( self ) : #NEWLINE# #INDENT# view = ProjectViewSet . as_view ( { #NEWLINE# #INDENT# 'post' : 'forms' , #NEWLINE# 'get' : 'retrieve' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . _publish_xls_form_to_project ( ) #NEWLINE# formid = self . xform . pk #NEWLINE# old_project = self . project #NEWLINE# project_name = 'another project' #NEWLINE# self . _project_create ( { #NEWLINE# #INDENT# 'name' : project_name , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertTrue ( ( self . project . name == project_name ) ) #NEWLINE# project_id = self . project . pk #NEWLINE# post_data = { #NEWLINE# #INDENT# 'formid' : formid , #NEWLINE# #UNINDENT# } #NEWLINE# request = self . factory . post ( '/' , data = post_data , ** self . extra ) #NEWLINE# response = view ( request , pk = project_id ) #NEWLINE# self . assertEqual ( response . status_code , 201 ) #NEWLINE# self . assertTrue ( self . project . projectxform_set . filter ( xform = self . xform ) ) #NEWLINE# self . assertFalse ( old_project . projectxform_set . filter ( xform = self . xform ) ) #NEWLINE# request = self . factory . get ( '/' , ** self . extra ) #NEWLINE# response = view ( request , pk = self . project . pk ) #NEWLINE# self . assertIn ( 'forms' , response . data . keys ( ) ) #NEWLINE# self . assertEqual ( len ( response . data [ 'forms' ] ) , 1 )