Ignore:
Timestamp:
10/31/11 11:17:31 (8 years ago)
Author:
pcosquer
Message:

add tests for add_thumbnail
+ fix a bug: revising a document with a thumbnail raised an exception

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/openPLM/plmapp/tests/controllers/document.py

    r428 r430  
    288288                          self.get_file()) 
    289289 
     290    def test_add_thumbnail(self): 
     291        thumbnail = ContentFile(file("datatests/thumbnail.png").read()) 
     292        thumbnail.name = "Thumbnail.png" 
     293        self.controller.add_file(self.get_file()) 
     294        f2 = self.controller.files.all()[0] 
     295        self.controller.add_thumbnail(f2, thumbnail) 
     296        self.assertNotEquals(None, f2.thumbnail) 
     297        Image.open 
     298         
     299 
     300    def test_revise_with_thumbnail(self): 
     301        thumbnail = ContentFile(file("datatests/thumbnail.png").read()) 
     302        thumbnail.name = "Thumbnail.png" 
     303        self.controller.add_file(self.get_file()) 
     304        f2 = self.controller.files.all()[0] 
     305        self.controller.add_thumbnail(f2, thumbnail) 
     306 
     307        revb = self.controller.revise("b") 
     308        f3 = revb.files.all()[0] 
     309        self.assertNotEquals(f2.thumbnail.path, f3.thumbnail.path) 
     310 
    290311 
    291312class OfficeTest(DocumentControllerTest): 
Note: See TracChangeset for help on using the changeset viewer.