Esempio n. 1
0
    def test_max_len(self):
        StrictType = String(max_len=3)

        self.assertEquals(StrictType.validate_string(StrictType, 'a'), True)
        self.assertEquals(StrictType.validate_string(StrictType, 'aaa'), True)
        self.assertEquals(StrictType.validate_string(StrictType, 'aaaa'),
                          False)
Esempio n. 2
0
 def test_unicode(self):
     s = u'\x34\x55\x65\x34'
     self.assertEquals(4, len(s))
     element = etree.Element('test')
     String.to_parent_element(s, 'test_ns', element)
     element = element[0]
     value = String.from_xml(element)
     self.assertEquals(value, s)
Esempio n. 3
0
 def test_unicode(self):
     s = u'\x34\x55\x65\x34'
     self.assertEquals(4, len(s))
     element = etree.Element('test')
     String.to_parent_element(s, 'test_ns', element)
     element = element[0]
     value = String.from_xml(element)
     self.assertEquals(value, s)
Esempio n. 4
0
        class SomeService(ServiceBase):
            @srpc(String(pattern='a'))
            def some_method(s):
                pass

            @srpc(String(pattern='a', max_occurs=2))
            def some_other_method(s):
                pass
Esempio n. 5
0
    def test_string(self):
        s = String()
        element = etree.Element('test')
        String.to_parent_element('value', ns_test, element)
        element=element[0]

        self.assertEquals(element.text, 'value')
        value = String.from_xml(element)
        self.assertEquals(value, 'value')
Esempio n. 6
0
    def test_string(self):
        s = String()
        element = etree.Element('test')
        String.to_parent_element('value', ns_test, element)
        element = element[0]

        self.assertEquals(element.text, 'value')
        value = String.from_xml(element)
        self.assertEquals(value, 'value')
Esempio n. 7
0
class SisMsg(ComplexModel):
    """Container with metadata for Jiva integration messages
    carried in the MQ payload.
    """
    data_source = String(nillable=False,
                         min_occurs=1,
                         max_occurs=1,
                         max_len=50)
    direction = String(nillable=False, min_occurs=1, max_occurs=1, max_len=50)
    interface_name = String(nillable=False,
                            min_occurs=1,
                            max_occurs=1,
                            max_len=50)
    crt_dt = DateTime(nillable=False)
Esempio n. 8
0
class NonNillableClass(ComplexModel):
    __namespace__ = "hunk.sunk"

    nillable = False
    min_occurs = 1

    dt = DateTime(min_occurs=1, nillable=False)
    i = Integer(nillable=False)
    s = String(min_len=1, nillable=False)
Esempio n. 9
0
class User(ComplexModel):
    __namespace__ = 'rpclib.examples.user_manager'

    user_id = Integer
    user_name = String
    first_name = String
    last_name = String
    email = String(pattern=r'[a-z0-9._%+-]+@[a-z0-9.-]+\.[A-Z]{2,4}')
    permissions = Array(Permission)
Esempio n. 10
0
    def test_string(self):
        s = String()
        element = etree.Element('test')
        XmlObject().to_parent_element(String, 'value', ns_test, element)
        element = element[0]

        self.assertEquals(element.text, 'value')
        value = XmlObject().from_element(String, element)
        self.assertEquals(value, 'value')
Esempio n. 11
0
    def test_pattern(self):
        StrictType = String(pattern='a')

        self.assertEquals(StrictType.validate_string(StrictType, 'a'), True)
        self.assertEquals(StrictType.validate_string(StrictType, 'b'), False)
Esempio n. 12
0
    def test_max_len(self):
        StrictType = String(max_len=3)

        self.assertEquals(StrictType.validate_string(StrictType, 'a'), True)
        self.assertEquals(StrictType.validate_string(StrictType, 'aaa'), True)
        self.assertEquals(StrictType.validate_string(StrictType, 'aaaa'), False)
Esempio n. 13
0
class Preferences(ComplexModel):
    __namespace__ = 'rpclib.examples.authentication'

    language = String(max_len=2)
    time_zone = String
Esempio n. 14
0
    def test_pattern(self):
        StrictType = String(pattern='a')

        self.assertEquals(StrictType.validate_string(StrictType, 'a'), True)
        self.assertEquals(StrictType.validate_string(StrictType, 'b'), False)
Esempio n. 15
0
 class SomeService(ServiceBase):
     @srpc(String(pattern='a'))
     def some_method(s):
         pass
Esempio n. 16
0
 class SomeService(ServiceBase):
     @srpc(String(max_occurs='unbounded'), _returns=String)
     def some_call(s):
         return '\n'.join(s)