Changeset 705 in main for branches


Ignore:
Timestamp:
02/02/12 14:58:56 (8 years ago)
Author:
agalech
Message:

Adding test

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

Legend:

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

    r704 r705  
    88from django.http import HttpResponse ,HttpResponseRedirect 
    99from django.test import TestCase 
    10 from openPLM.document3D.test_request import * 
    1110from openPLM.document3D.views import * 
    1211from openPLM.document3D.forms import * 
     
    7069     
    7170      
    72 class View3DTest(CommonViewTest): 
     71class display_3dTest(CommonViewTest): 
    7372 
    7473    def setUp(self): 
    75         super(View3DTest, self).setUp() 
     74        super(display_3dTest, self).setUp() 
    7675        self.document = Document3DController.create('doc1', 'Document3D', 
    7776                'a', self.user, self.DATA) 
     
    8281        response = self.get(self.document.object.plmobject_url+"3D/") 
    8382        form=Form3D(document=self.document) 
    84         self.document.delete_file(new_doc_file) 
     83        #self.document.delete_file(new_doc_file) 
    8584        self.assertEqual(response.context["select_stp_form"].as_table(), form.as_table()) 
    8685         
     
    9998        stp.delete() 
    10099        response = self.get(self.document.object.plmobject_url+"3D/")  
    101         self.document.delete_file(new_doc_file)       
     100        #self.document.delete_file(new_doc_file)       
    102101        self.assertNotEqual(response.context["multi_image3D"],'') 
    103102        self.assertEqual(response.context["menu_arborescense"], '') 
     103         
     104         
     105class display_bomb_childTest(CommonViewTest): 
     106    def setUp(self): 
     107        super(display_bomb_childTest, self).setUp() 
     108        self.document = Document3DController.create('doc1', 'Document3D', 
     109                'a', self.user, self.DATA) 
     110 
     111    def test_bomb_child(self): 
     112        child1 = PartController.create("c1", "Part", "a", self.user, self.DATA) 
     113        self.controller.add_child(child1, 10 , 20) 
     114        child2 = PartController.create("c2", "Part", "a", self.user, self.DATA) 
     115        self.controller.add_child(child2, 10, 20) 
     116        response = self.get(self.base_url + "BOM-child/", page="BOM-child") 
     117        self.assertEqual(2, len(list(response.context["children"]))) 
     118        self.assertEqual(0, len(list(response.context["decomposable"])))  
     119         
     120         
     121    def test_decompose_bomb_child(self): 
     122        f=open("document3D/data_test/test.stp") 
     123        myfile = File(f) 
     124        new_doc_file=self.document.add_file(myfile)  
     125        self.controller.attach_to_document(self.document.object) 
     126        response = self.get(self.base_url + "BOM-child/", page="BOM-child") 
     127        #self.document.delete_file(new_doc_file)    
     128        self.assertEqual(0, len(list(response.context["children"]))) 
     129        self.assertEqual(1, len(list(response.context["decomposable"])))          
    104130 
    105131 
    106 #class Document3DtestCase(TestCase): 
    107  
  • branches/3D/openPLM/document3D/urls.py

    r703 r705  
    44urlpatterns = patterns('', 
    55    (r'^object/Document3D/([^/]+)/([^/]+)/3D/$', views.display_3d), 
    6     (r'^object/([^/]+)/([^/]+)/([^/]+)/BOM-child/$', views.display_object_child), 
     6    (r'^object/([^/]+)/([^/]+)/([^/]+)/BOM-child/$', views.display_bomb_child), 
    77    (r'^object/([^/]+)/([^/]+)/([^/]+)/decompose/([^/]+)/$', views.display_decompose), 
    88    (r'^ajax/decompose/$', views.ajax_decompose_form), 
  • branches/3D/openPLM/document3D/views.py

    r704 r705  
    9999 
    100100 
    101 def display_object_child(request, obj_type, obj_ref, obj_revi):     
     101def display_bomb_child(request, obj_type, obj_ref, obj_revi):     
    102102     
    103103     
Note: See TracChangeset for help on using the changeset viewer.