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

Validate document and contract ids properly.

File:
1 edited

Legend:

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

    r11949 r12260  
    2121import grok
    2222import unittest
    23 from waeup.ikoba.interfaces import DuplicationError, RoleSource, check_email
     23from waeup.ikoba.interfaces import (
     24    DuplicationError, RoleSource, check_email, check_id, check_uuid)
    2425from waeup.ikoba.testing import FunctionalLayer, FunctionalTestCase
    2526
     
    6162        self.assertTrue(check_email('bob@foo,alice@bar') is None)
    6263        return
     64
     65    def test_check_id(self):
     66        self.assertTrue(check_id('abcABC') is not None)
     67        # No spaces
     68        self.assertTrue(check_id('abc ABC') is None)
     69        # More than 6 characters are not allowed
     70        self.assertTrue(check_id('abcdefg') is None)
     71        # Only underscores and hyphens are allowed
     72        self.assertTrue(check_id('a+b') is None)
     73        self.assertTrue(check_id('a/b') is None)
     74        self.assertTrue(check_id('a-b') is not None)
     75        self.assertTrue(check_id('a_b') is not None)
     76        # 32 charachters are allowed
     77        self.assertTrue(
     78            check_uuid('dfceb5c587364faf95e17b3cbaf98d5f') is not None)
     79        return
     80
    6381
    6482class DuplicationErrorTests(unittest.TestCase):
Note: See TracChangeset for help on using the changeset viewer.