Ejemplo n.º 1
0
    def test_parse_workflows(self):
        """Test parsing WORKFLOWS."""
        from pinball_ext.workflow.parser import PyWorkflowParser
        params =\
            {'workflows_config':
                 'tests.pinball_ext.workflow.parser_test.WORKFLOWS'}
        py_workflow_parser = PyWorkflowParser(params)
        py_workflow_parser.parse_workflows()
        self.assertEquals(3, len(py_workflow_parser.workflows))
        self.assertEquals(2, len(
            py_workflow_parser.workflows['some_workflow'].jobs))
        self.assertEquals(3, len(
            py_workflow_parser.workflows['some_other_workflow'].jobs))
        self.assertEquals(3, len(
            py_workflow_parser.workflows['another_workflow'].jobs))

        self.assertEquals(24 * 60 * 60,
                          py_workflow_parser.workflows['some_workflow'].
                          schedule.recurrence_seconds)
        self.assertEquals(60 * 60,
                          py_workflow_parser.workflows['some_other_workflow'].
                          schedule.recurrence_seconds)
        self.assertEquals(60 * 60,
                          py_workflow_parser.workflows['another_workflow'].
                          schedule.recurrence_seconds)
        self.assertEquals(py_workflow_parser.workflows_config_str,
                          'tests.pinball_ext.workflow.parser_test.WORKFLOWS')
Ejemplo n.º 2
0
    def test_parse_workflows(self):
        """Test parsing WORKFLOWS."""
        from pinball_ext.workflow.parser import PyWorkflowParser
        params =\
            {'workflows_config':
                 'tests.pinball_ext.workflow.parser_test.WORKFLOWS'}
        py_workflow_parser = PyWorkflowParser(params)
        py_workflow_parser.parse_workflows()
        self.assertEquals(3, len(py_workflow_parser.workflows))
        self.assertEquals(
            2, len(py_workflow_parser.workflows['some_workflow'].jobs))
        self.assertEquals(
            3, len(py_workflow_parser.workflows['some_other_workflow'].jobs))
        self.assertEquals(
            3, len(py_workflow_parser.workflows['another_workflow'].jobs))

        self.assertEquals(
            24 * 60 * 60, py_workflow_parser.workflows['some_workflow'].
            schedule.recurrence_seconds)
        self.assertEquals(
            60 * 60, py_workflow_parser.workflows['some_other_workflow'].
            schedule.recurrence_seconds)
        self.assertEquals(
            60 * 60, py_workflow_parser.workflows['another_workflow'].schedule.
            recurrence_seconds)
        self.assertEquals(py_workflow_parser.workflows_config_str,
                          'tests.pinball_ext.workflow.parser_test.WORKFLOWS')
Ejemplo n.º 3
0
 def test_get_workflow_tokens(self):
     from pinball_ext.workflow.parser import PyWorkflowParser
     params =\
         {'workflows_config':
              'tests.pinball_ext.workflow.parser_test.WORKFLOWS'}
     py_workflow_parser = PyWorkflowParser(params)
     workflow_tokens = py_workflow_parser.get_workflow_tokens(
         'some_workflow')
     # Two job tokens and one event token.
     self.assertEqual(3, len(workflow_tokens))
Ejemplo n.º 4
0
 def test_get_workflow_tokens(self):
     from pinball_ext.workflow.parser import PyWorkflowParser
     params =\
         {'workflows_config':
              'tests.pinball_ext.workflow.parser_test.WORKFLOWS'}
     py_workflow_parser = PyWorkflowParser(params)
     workflow_tokens = py_workflow_parser.get_workflow_tokens(
         'some_workflow')
     # Two job tokens and one event token.
     self.assertEqual(3, len(workflow_tokens))
Ejemplo n.º 5
0
 def test_get_schedule_token(self):
     # Due to a wired interaction between tests caused by dynamic module
     # imports, the following import statement cannot be placed at the top
     # level.  E.g., see
     # http://stackoverflow.com/questions/9722343/python-super-behavior-not-dependable
     from pinball_ext.workflow.parser import PyWorkflowParser
     params =\
         {'workflows_config':
              'tests.pinball_ext.workflow.parser_test.WORKFLOWS'}
     py_workflow_parser = PyWorkflowParser(params)
     schedule_token = py_workflow_parser.get_schedule_token('some_workflow')
     self.assertEqual('/schedule/workflow/some_workflow',
                      schedule_token.name)
Ejemplo n.º 6
0
 def test_get_schedule_token(self):
     # Due to a wired interaction between tests caused by dynamic module
     # imports, the following import statement cannot be placed at the top
     # level.  E.g., see
     # http://stackoverflow.com/questions/9722343/python-super-behavior-not-dependable
     from pinball_ext.workflow.parser import PyWorkflowParser
     params =\
         {'workflows_config':
              'tests.pinball_ext.workflow.parser_test.WORKFLOWS'}
     py_workflow_parser = PyWorkflowParser(params)
     schedule_token = py_workflow_parser.get_schedule_token('some_workflow')
     self.assertEqual('/schedule/workflow/some_workflow',
                      schedule_token.name)
Ejemplo n.º 7
0
 def test_pinball_config_parses(self):
     from pinball_ext.workflow.parser import PyWorkflowParser
     params =\
         {'workflows_config': 'pinball_ext.examples.workflows.WORKFLOWS'}
     py_workflow_parser = PyWorkflowParser(params)
     py_workflow_parser.parse_workflows()
Ejemplo n.º 8
0
 def test_pinball_config_parses(self):
     from pinball_ext.workflow.parser import PyWorkflowParser
     params =\
         {'workflows_config': 'pinball_ext.examples.workflows.WORKFLOWS'}
     py_workflow_parser = PyWorkflowParser(params)
     py_workflow_parser.parse_workflows()