Ignore:
Timestamp:
01/18/12 11:59:51 (9 years ago)
Author:
pcosquer
Message:

3D branch: merge changes from trunk (rev [661])

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3D/openPLM/plmapp/tests/controllers/plmobject.py

    r472 r662  
    3434import openPLM.plmapp.models as models 
    3535from openPLM.plmapp.controllers import PLMObjectController 
    36 from openPLM.plmapp.lifecycle import LifecycleList 
    3736 
    3837from openPLM.plmapp.tests.base import BaseTestCase 
     
    4847        self.assertEqual(controller.name, "") 
    4948        self.assertEqual(controller.type, self.TYPE) 
    50         self.assertEqual(type(controller.object),  
    51                 models.get_all_plmobjects()[self.TYPE]) 
    5249        type_ = models.get_all_plmobjects()[self.TYPE] 
     50        self.assertEqual(type(controller.object), type_)  
    5351        obj = type_.objects.get(reference=controller.reference, 
    5452                revision=controller.revision, type=controller.type) 
     
    126124        self.assertRaises(ValueError, setattr, controller, "state", "draft") 
    127125 
    128     def test_promote(self): 
    129         controller = self.create("Part1") 
    130         self.assertEqual(controller.state.name, "draft") 
    131         controller.promote() 
    132         self.assertEqual(controller.state.name, "official") 
    133         self.failIf(controller.is_editable) 
    134         self.assertRaises(exc.PromotionError, controller.demote) 
    135         lcl = LifecycleList("diop", "official", "draft",  
    136                 "issue1", "official", "deprecated") 
    137         lc = models.Lifecycle.from_lifecyclelist(lcl) 
    138         controller.lifecycle = lc 
    139         controller.state = models.State.objects.get(name="draft") 
    140         controller.save() 
    141         controller.promote() 
    142         self.assertEqual(controller.state.name, "issue1") 
    143         controller.demote() 
    144         self.assertEqual(controller.state.name, "draft") 
    145         self.failUnless(controller.is_editable) 
    146  
    147126    def test_revise(self): 
    148127        """ 
     
    158137            self.assertEqual(getattr(controller, attr), getattr(rev, attr)) 
    159138 
     139    def test_revise_official(self): 
     140        ctrl = self.create("Part1") 
     141        ctrl.state = ctrl.lifecycle.official_state 
     142        ctrl.set_owner(self.cie) 
     143        ctrl.save() 
     144        self.failUnless(ctrl.is_revisable()) 
     145        rev = ctrl.revise("b") 
     146        self.assertEqual(self.user, rev.owner) 
     147 
    160148    def test_revise_error1(self): 
    161         "Revision : error : empty name" 
     149        "Revision : error : empty new revision" 
    162150        controller = self.create("Part1") 
    163151        self.assertRaises(exc.RevisionError, controller.revise, "") 
Note: See TracChangeset for help on using the changeset viewer.