Beispiel #1
0
 def test_invalid_type(self):
     with self.assertRaises(ConfigurationException) as cm:
         msg_config.validate_queues([])
     self.assertEqual(
         "Configuration error: 'queues' must be a dictionary mapping queue names to settings.",
         str(cm.exception),
     )
Beispiel #2
0
 def test_missing_keys(self):
     with self.assertRaises(ConfigurationException) as cm:
         msg_config.validate_queues({"q1": {}})
     self.assertIn(
         "Configuration error: the q1 queue is missing the following keys from its settings",
         str(cm.exception),
     )
     self.assertIn("durable", str(cm.exception))
     self.assertIn("auto_delete", str(cm.exception))
     self.assertIn("exclusive", str(cm.exception))
     self.assertIn("arguments", str(cm.exception))
Beispiel #3
0
 def test_settings_invalid_type(self):
     with self.assertRaises(ConfigurationException) as cm:
         msg_config.validate_queues({"q1": TestObj()})
     self.assertEqual(
         "Configuration error: the q1 queue in the 'queues' setting has a value of type "
         "<class 'fedora_messaging.tests.unit.test_config.TestObj'>, but it should be a "
         "dictionary of settings.",
         str(cm.exception),
     )
     self.assertIn("it should be a dictionary of settings.",
                   str(cm.exception))
Beispiel #4
0
    def test_valid(self):
        """Assert no exception is raised with a valid configuration."""
        queues = {
            "q1": {
                "durable": True,
                "auto_delete": False,
                "exclusive": False,
                "arguments": {},
            }
        }

        msg_config.validate_queues(queues)