Changeset 6241 for main/waeup.sirp/trunk


Ignore:
Timestamp:
30 May 2011, 01:49:09 (14 years ago)
Author:
uli
Message:

Update tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/university/tests/test_certificatecontainer.py

    r6239 r6241  
    9898    def test_setitem_duplicate_entry(self):
    9999        # we cannot add certificates whose code exists already in catalog
     100        container1 = CertificateContainer()
     101        container2 = CertificateContainer()
     102        self.app['certs1'] = container1 # enable catalogs
     103        self.app['certs2'] = container2
     104        cert1 = Certificate(code="CERT1")
     105        cert2 = Certificate(code="CERT1")
     106        self.app['certs1']['CERT1'] = cert1
     107        self.assertRaises(
     108            DuplicationError,
     109            self.app['certs2'].__setitem__, 'CERT1', cert2)
     110        assert len(container2) == 0
     111
     112    def test_setitem_name_unequal_code(self):
     113        # we cannot add certificates whose code != key
    100114        container = CertificateContainer()
    101115        self.app['certs'] = container # enable catalogs
    102116        cert1 = Certificate(code="CERT1")
    103         cert2 = Certificate(code="CERT1")
    104         self.app['certs']['SomeKey'] = cert1
    105117        self.assertRaises(
    106             DuplicationError,
    107             container.__setitem__, 'OtherKey', cert2)
    108         assert len(container) == 1
     118            ValueError,
     119            container.__setitem__, 'OtherKey', cert1)
     120        assert len(container) == 0
    109121
    110122    def test_clear(self):
     123        # clear() really empties the container.
    111124        container = CertificateContainer()
    112125        self.app['certs'] = container # enable catalogs
Note: See TracChangeset for help on using the changeset viewer.