Changeset 708 in main for branches


Ignore:
Timestamp:
02/03/12 13:10:44 (8 years ago)
Author:
agalech
Message:

add test to 3D

Location:
branches/3D/openPLM/document3D
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/3D/openPLM/document3D/forms.py

    r703 r708  
    3232    LIST_document3D = group_types(get_all_plmDocument3Dtypes_with_level())   
    3333    type_document3D = forms.TypedChoiceField(choices=LIST_document3D,label='') 
    34     type_document3D.widget.attrs["onclick"]="this.form.submit()" 
     34    type_part.widget.attrs["onchange"]="update_form()" 
    3535     
    3636     
  • branches/3D/openPLM/document3D/tests.py

    r707 r708  
    66""" 
    77#./manage.py test document3D --settings=settings_tests 
    8 from django.http import HttpResponse ,HttpResponseRedirect 
     8from django.http import HttpResponse ,HttpResponseRedirect , HttpRequest 
    99from django.test import TestCase 
    1010from openPLM.document3D.views import * 
     
    162162         
    163163         
    164          
     164        
    165165                  
    166166class display_decomposeTest(CommonViewTest): 
     
    170170        self.document = Document3DController.create('doc1', 'Document3D', 
    171171                'a', self.user, self.DATA) 
    172               
     172                  
    173173    #verificar los links creados en las buenas coordenadas       
    174174    def test_display_decompose_form_initial(self): 
     
    246246                self.assertEqual(atributes[0].errors,{'group': [u'Bad group, check that the group exists and that you belong to this group.']}) 
    247247            index+=1 
    248  
     248     
     249    def test_display_Ajax(self): 
     250        f=open("document3D/data_test/test.stp") 
     251        myfile = File(f) 
     252        new_doc_file=self.document.add_file(myfile)      
     253        self.controller.attach_to_document(self.document.object)    
     254        response_ajax = self.client.get("/ajax/decompose/"+data5) 
     255        zip=response_ajax.context["zip"] 
     256        index=0 
     257        for type, atributes , ord_qty in zip: 
     258            if index==1: 
     259                self.assertEqual(atributes[0].as_table() ,data5_1) 
     260            index+=1                                      
    249261 
    250262 
     
    262274data4 ={u'2-lifecycle': [u'draft_official_deprecated'], u'3-lifecycle': [u'draft_official_deprecated'], u'reference': [u'PART_00006'], u'form-0-quantity': [u'1'], 
    263275 u'form-1-order': [u'20'], u'3-revision': [u'a'], u'form-1-type_part': [u'Part'], u'initial-3-lifecycle': [u'draft_official_deprecated'], u'2-group': [u'1'], u'1-lifecycle': [u'draft_official_deprecated'], u'3-group': [u'2'], u'group': [u'2'], u'1-revision': [u'a'], u'lifecycle': [u'draft_official_deprecated'], u'2-name': [u'NUT'], u'form-0-type_part': [u'Part'], u'csrfmiddlewaretoken': [u'6a0951fed02461061f796c63d98bb430', u'6a0951fed02461061f796c63d98bb430'], u'3-name': [u'NUT'], u'revision': [u'a'], u'initial-2-lifecycle': [u'draft_official_deprecated'], u'initial-1-lifecycle': [u'draft_official_deprecated'], u'1-name': [u'BOLT'], u'form-TOTAL_FORMS': [u'2', u'2'], u'2-reference': [u'PART_00007'], u'2-revision': [u'a'], u'form-INITIAL_FORMS': [u'0', u'0'], u'form-1-quantity': [u'1'], u'initial-lifecycle': [u'draft_official_deprecated'], u'3-reference': [u'DOC_00008'], u'name': [u'BOLT'], u'form-MAX_NUM_FORMS': [u'', u''], u'1-group': [u'2'], u'form-0-type_document3D': [u'Document3D'], u'form-0-order': [u'10'], u'form-1-type_document3D': [u'Document3D'], u'1-reference': [u'DOC_00007']} 
     276  
     277#form-1-type_part=SinglePart  
     278data5 ="""?csrfmiddlewaretoken=6a0951fed02461061f796c63d98bb430&form-TOTAL_FORMS=2&form-INITIAL_FORMS=0&form-MAX_NUM_FORMS=&form-TOTAL_FORMS=2&form-INITIAL_FORMS=0&form-MAX_NUM_FORMS=&form-0-order=10&form-0-quantity=1&reference=PART_00009&revision=a&form-0-type_part=SinglePart&lifecycle=draft_official_deprecated&initial-lifecycle=draft_official_deprecated&name=L-BRACKET&group=1&1-reference=DOC_00010&1-revision=a&form-0-type_document3D=Document3D&1-lifecycle=draft_official_deprecated&initial-1-lifecycle=draft_official_deprecated&1-name=L-BRACKET&1-group=1&form-1-order=20&form-1-quantity=3&2-reference=PART_00010&2-revision=a&form-1-type_part=SinglePart&2-lifecycle=draft_official_deprecated&initial-2-lifecycle=draft_official_deprecated&2-name=NBA_ASM&2-group=1&3-reference=DOC_00011&3-revision=a&form-1-type_document3D=Document3D&3-lifecycle=draft_official_deprecated&initial-3-lifecycle=draft_official_deprecated&3-name=NBA_ASM&3-group=1 HTTP/1.1""" 
     279#u'form-1-type_part': [u'SinglePart'] u'1-name': [u'BOLT_NEW'] 
     280data5_1 ="""<tr><th><label for="id_2-reference">Reference:</label></th><td><input id="id_2-reference" type="text" name="2-reference" value="PART_00002" maxlength="50" /></td></tr> 
     281<tr><th><label for="id_2-revision">Revision:</label></th><td><input id="id_2-revision" type="text" name="2-revision" value="a" maxlength="50" /></td></tr> 
     282<tr><th><label for="id_2-lifecycle">Lifecycle:</label></th><td><select name="2-lifecycle" id="id_2-lifecycle"> 
     283<option value="draft_official_deprecated" selected="selected">Lifecycle&lt;draft_official_deprecated&gt;</option> 
     284<option value="draft_official">Lifecycle&lt;draft_official&gt;</option> 
     285</select><input type="hidden" name="initial-2-lifecycle" value="draft_official_deprecated" id="initial-2-id_2-lifecycle" /></td></tr> 
     286<tr><th><label for="id_2-name">Name:</label></th><td><input type="text"  autocomplete="off" name="2-name" id="id_2-name"/> 
     287                <script type="text/javascript"><!--// 
     288                $('#id_2-name').autocomplete({"source": "/ajax/complete/SinglePart/name/"});//--></script> 
     289                <br />Name of the product</td></tr> 
     290<tr><th><label for="id_2-group">Group:</label></th><td><select name="2-group" id="id_2-group"> 
     291<option value="" selected="selected">---------</option> 
     292<option value="2">grp</option> 
     293</select></td></tr> 
     294<tr><th><label for="id_2-supplier">Supplier:</label></th><td><input type="text"  autocomplete="off" name="2-supplier" id="id_2-supplier"/> 
     295                <script type="text/javascript"><!--// 
     296                $('#id_2-supplier').autocomplete({"source": "/ajax/complete/SinglePart/supplier/"});//--></script> 
     297                </td></tr> 
     298<tr><th><label for="id_2-tech_details">Tech details:</label></th><td><textarea id="id_2-tech_details" rows="10" cols="40" name="2-tech_details"></textarea></td></tr>""" 
     299 
  • branches/3D/openPLM/document3D/views.py

    r707 r708  
    173173     
    174174     
    175      
     175#posibilidades , el objeto a sido modificado despues de acceder al formulario     
    176176@transaction.commit_on_success                
    177177def display_decompose(request, obj_type, obj_ref, obj_revi, stp_id):     
     
    381381               
    382382def ajax_decompose_form(request): 
    383  
    384383    Select_Doc_Part_types = formset_factory(Doc_Part_type_Form) 
    385384    form_Doc_Part_types = Select_Doc_Part_types(request.GET) 
Note: See TracChangeset for help on using the changeset viewer.