Changeset 12262 for main/waeup.ikoba


Ignore:
Timestamp:
19 Dec 2014, 08:24:55 (10 years ago)
Author:
Henrik Bettermann
Message:

Validate product id properly. Add tests.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py

    r12259 r12262  
    4444from waeup.ikoba.interfaces import (
    4545    IUserAccount, IJobManager, APPROVED, SUBMITTED,
    46     IFileStoreNameChooser, IExtFileStore, IFileStoreHandler)
     46    IFileStoreNameChooser, IExtFileStore, IFileStoreHandler, NotIdValue)
    4747from waeup.ikoba.imagestorage import (
    4848    FileStoreNameChooser, ExtFileStore, DefaultFileStoreHandler,
     
    121121        self.document.title = u'My first document'
    122122        self.document.document_id = u'DOC1'
     123        self.assertRaises(
     124            NotIdValue, setattr, self.document, 'document_id', u'id with spaces')
    123125        self.customer['documents'].addDocument(self.document)
    124126        self.contract = createObject('waeup.SampleContract')
    125127        self.contract.title = u'My first contract'
    126128        self.contract.contract_id = u'CON1'
     129        self.assertRaises(
     130            NotIdValue, setattr, self.contract, 'contract_id', u'id with spaces')
    127131        self.customer['contracts'].addContract(self.contract)
    128132
  • main/waeup.ikoba/trunk/src/waeup/ikoba/products/interfaces.py

    r12098 r12262  
    1919from zope import schema
    2020from waeup.ikoba.interfaces import (
    21     IIkobaObject,
     21    IIkobaObject, validate_id,
    2222    ContextualDictSourceFactoryBase)
    2323from waeup.ikoba.interfaces import MessageFactory as _
     
    4747        default = u'NA',
    4848        required = True,
     49        constraint=validate_id,
    4950        )
    5051
  • main/waeup.ikoba/trunk/src/waeup/ikoba/products/tests/test_browser.py

    r12213 r12262  
    3838from waeup.ikoba.testing import FunctionalLayer, FunctionalTestCase
    3939from waeup.ikoba.app import Company
    40 from waeup.ikoba.interfaces import IUserAccount, IJobManager, APPROVED
     40from waeup.ikoba.interfaces import (
     41    IUserAccount, IJobManager, APPROVED, NotIdValue)
    4142from waeup.ikoba.authentication import LocalRoleSetEvent
    4243from waeup.ikoba.tests.test_async import FunctionalAsyncTestCase
     
    9192        self.product = createObject('waeup.Product')
    9293        self.product.product_id = u'LIC'
     94        self.assertRaises(
     95            NotIdValue, setattr, self.product, 'product_id', u'id with spaces')
    9396        self.product.title = u'Our License'
    9497        self.app['products'].addProduct(self.product)
Note: See TracChangeset for help on using the changeset viewer.