Ignore:
Timestamp:
15/12/08 14:23:40 (12 years ago)
Author:
cbyrom
Message:

Improve test suite, allowing referenced artefacts to be properly set
up and removed before and after tests + set global logging + adjust
file references + add required data files + simplify and fix some tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • exist/trunk/python/ndgutilstests/lib/testatomvalidator.py

    r4630 r4641  
    99import ndgutilstests.testconstants as tc 
    1010from ndgUtils.models.Atom import Atom 
    11 import ndgUtils.lib.existdbclient as dbc 
    1211from ndgUtils.vocabtermdata import VocabTermData as VTD 
    1312 
     
    2524        self.v.setAtom(self.atom) 
    2625         
    27     def offtestSetNoneAtom(self): 
     26    def testSetNoneAtom(self): 
    2827        self.assertRaises(ValueError, self.v.setAtom, None) 
    2928         
    30     def offtestSetDodgyAtom(self): 
     29    def testSetDodgyAtom(self): 
    3130        self.assertRaises(ValueError, self.v.setAtom, []) 
    3231         
    33     def offtestSetAtom(self): 
     32    def testSetAtom(self): 
    3433        try: 
    3534            self.v.setAtom(self.atom) 
     
    3736            self.fail("An exception shouldn't have been thrown") 
    3837             
    39     def offtestValidateAtom(self): 
     38    def testValidateAtom(self): 
    4039        try: 
    4140            errors = self.v.validateAtom() 
     
    4443 
    4544 
    46     def offtestValidateLinks(self): 
     45    def testValidateLinks(self): 
    4746        try: 
    4847            self.v._AtomValidator__validateLinks() 
     
    9897            self.fail("An exception shouldn't have been thrown") 
    9998             
    100     def offtestInvalidValidateAtom(self): 
     99    def testInvalidValidateAtom(self): 
    101100        self.__setInvalidAtom() 
    102101        try: 
     
    106105            self.assertEqual(ValidationError.BASE_MESSAGE, e.message) 
    107106            self.assertNotEqual(None, e.unpack_errors()) 
    108             self.assertTrue(isinstance(self.v.errors, e.unpack_errors())) 
     107            self.assertTrue(isinstance(self.v.errors, dict)) 
     108            if not self.v.errors: 
     109                self.fail("Validation errors should have been detected") 
    109110        except Exception, e: 
    110111            self.fail("A validation exception should have been thrown") 
    111112 
    112113 
    113     def offtestInvalidValidateLinks(self): 
     114    def testInvalidValidateLinks(self): 
    114115        self.__setInvalidAtom() 
    115116        try: 
     
    141142            self.assertNotEquals(None, self.v.errors) 
    142143            self.assertTrue(isinstance(self.v.errors, dict)) 
    143             print self.v.errors 
    144144            if not self.v.errors: 
    145145                self.fail("Schema validation errors should have been detected") 
     
    154154            self.assertNotEquals(None, self.v.errors) 
    155155            self.assertTrue(isinstance(self.v.errors, dict)) 
    156             print self.v.errors 
    157156            if not self.v.errors: 
    158157                self.fail("Atom content errors should have been detected") 
     
    168167            self.assertNotEquals(None, self.v.errors) 
    169168            self.assertTrue(isinstance(self.v.errors, dict)) 
    170             print self.v.errors 
    171169            if not self.v.errors: 
    172170                self.fail("Unicode errors should have been detected") 
     171            self.assertTrue(self.v.errors['title'].startswith(self.v.ILLEGAL_UNICODE_MESSAGE)) 
    173172        except Exception, e: 
    174173            self.fail("A validation exception should have been thrown") 
Note: See TracChangeset for help on using the changeset viewer.