예제 #1
0
 def test_parse_config(self):
     """An example configuration file can be parsed"""
     # Case 1: File does not exist
     with mock.patch('recore.start_logging'):
         with self.assertRaises(SystemExit):
             cfg = recore.parse_config(self.config_file_dne)
     # Case 2: File is not valid json
     with mock.patch('recore.start_logging'):
         with self.assertRaises(SystemExit):
             cfg = recore.parse_config(self.config_file_invalid)
     # Case 3: File exists and is valid json
     with mock.patch('recore.start_logging'):
         cfg = recore.parse_config(self.config_file_valid)
예제 #2
0
    def test_parse_config(self):
        """An example configuration file can be parsed"""
        # Case 1: File does not exist
        # with mock.patch('recore.start_logging'):
        with self.assertRaises(SystemExit):
            cfg = recore.parse_config(self.config_file_dne)
            assert recore.amq.MQ_CONF is {}

        # Case 2: File is not valid json
        # with mock.patch('recore.start_logging'):
        with self.assertRaises(SystemExit):
            cfg = recore.parse_config(self.config_file_invalid)
            assert recore.amq.CONF is {}
            assert recore.amq.MQ_CONF is {}

        # Case 3: File exists and is valid json
        # with mock.patch('recore.start_logging'):
        cfg = recore.parse_config(self.config_file_valid)
        assert recore.amqp.CONF is cfg
        assert recore.amqp.MQ_CONF is cfg['MQ']
예제 #3
0
 def test_parse_config_triggers_good(self):
     """We can configure the FSM with triggers when they're defined"""
     cfg = recore.parse_config(self.config_file_good_triggers)
     assert recore.fsm.TRIGGERS != []
예제 #4
0
 def test_parse_config_per_release_log_dir(self):
     """The FSM is configured if RELEASE_LOG_DIR is set"""
     cfg = recore.parse_config(self.config_file_per_release_logging)
     self.assertEqual(recore.fsm.RELEASE_LOG_DIR, '/tmp/fsm')
예제 #5
0
 def test_parse_config_file_triggers_points_to_bad_triggers_file(self):
     """We gracefully exit if the main config file points to a bad triggers file"""
     with self.assertRaises(SystemExit):
         cfg = recore.parse_config(self.config_file_points_to_bad_trigger_file)
예제 #6
0
 def test_parse_config_triggers_done_exist(self):
     """We gracefully exit if a specified trigger file doesn't exist"""
     with self.assertRaises(SystemExit):
         cfg = recore.parse_config(self.config_file_triggers_dne)
예제 #7
0
 def test_parse_config_triggers_invalid_json(self):
     """We gracefully exit if a trigger file is invalid"""
     with self.assertRaises(SystemExit):
         cfg = recore.parse_config(self.config_file_invalid_json_triggers)