示例#1
0
 def test_missing_schema_field(self, client):
     """Tests failure when provided schema is missing a field from layout"""
     schema = Structure({
         'test_field1': Text(required=True),
         'test_field2': Integer(required=True),
     })
     layout = [{
         'title':
         'Test Section 1',
         'elements': [
             {
                 'type': 'textbox',
                 'field': 'test_field1',
                 'label': 'Test Field #1',
                 'options': {
                     'multiline': True
                 },
             },
             {
                 'type': 'textbox',
                 'field': 'test_field2',
                 'label': 'Test Field #2',
             },
             {
                 'type': 'checkbox',
                 'field': 'test_field3',
                 'label': 'Test Field #3',
             },
         ],
     }]
     with self.assertRaises(OperationError):
         WorkflowElement._verify_layout(layout, schema)
示例#2
0
 def test_missing_schema_field(self, client):
     """Tests failure when provided schema is missing a field from layout"""
     schema = Structure({
         'test_field1': Text(required=True),
         'test_field2': Integer(required=True),
     })
     layout = [{
         'title': 'Test Section 1',
         'elements': [
             {
                 'type': 'textbox',
                 'field': 'test_field1',
                 'label': 'Test Field #1',
                 'options': {'multiline': True},
             },
             {
                 'type': 'textbox',
                 'field': 'test_field2',
                 'label': 'Test Field #2',
             },
             {
                 'type': 'checkbox',
                 'field': 'test_field3',
                 'label': 'Test Field #3',
             },
         ],
     }]
     with self.assertRaises(OperationError):
         WorkflowElement._verify_layout(layout, schema)
示例#3
0
 def test_parse_valid_layout(self, client):
     """Tests verification of a valid layout"""
     schema = Structure({'test_field1': Text(required=True)})
     layout = [{
         'title': 'Test Section 1',
         'elements': [{
             'type': 'textbox',
             'field': 'test_field1',
             'label': 'Test Field #1',
             'options': {'multiline': True},
         }],
     }]
     WorkflowElement._verify_layout(layout, schema)
示例#4
0
 def test_parse_valid_layout(self, client):
     """Tests verification of a valid layout"""
     schema = Structure({'test_field1': Text(required=True)})
     layout = [{
         'title':
         'Test Section 1',
         'elements': [{
             'type': 'textbox',
             'field': 'test_field1',
             'label': 'Test Field #1',
             'options': {
                 'multiline': True
             },
         }],
     }]
     WorkflowElement._verify_layout(layout, schema)
示例#5
0
文件: workflow.py 项目: siq/flux
 def instantiate(self, workflow):
     element = WorkflowElement.unserialize(workflow.specification)
     self.cache[workflow.id] = (workflow.modified, element)
     return element
示例#6
0
文件: workflow.py 项目: siq/flux
    def _verify_specification(cls, specification):
        if specification is None:
            return

        schema = WorkflowElement.unserialize(specification)
        schema.verify()
示例#7
0
    def _verify_specification(cls, specification):
        if specification is None:
            return

        schema = WorkflowElement.unserialize(specification)
        schema.verify()
示例#8
0
 def instantiate(self, workflow):
     element = WorkflowElement.unserialize(workflow.specification)
     self.cache[workflow.id] = (workflow.modified, element)
     return element