浏览代码

Add test for [unix_http_server] with no file= option

Mike Naberezny 10 年之前
父节点
当前提交
4c8005996e
共有 1 个文件被更改,包括 16 次插入4 次删除
  1. 16 4
      supervisor/tests/test_options.py

+ 16 - 4
supervisor/tests/test_options.py

@@ -941,6 +941,22 @@ class ServerOptionsTests(unittest.TestCase):
         self.assertEqual(options.server_configs[0]['file'], '/tmp/supvtest.sock')
         self.assertEqual(options.server_configs[0]['chmod'], 493)
 
+    def test_options_afunix_no_file(self):
+        instance = self._makeOne()
+        text = lstrip("""\
+        [supervisord]
+
+        [unix_http_server]
+        ;no file=
+        """)
+        instance.configfile = StringIO(text)
+        try:
+            instance.read_config(StringIO(text))
+            self.fail("nothing raised")
+        except ValueError as exc:
+            self.assertEqual(exc.args[0],
+                "section [unix_http_server] has no file value")
+
     def test_options_afunix_password_without_username(self):
         instance = self._makeOne()
         text = lstrip("""\
@@ -951,8 +967,6 @@ class ServerOptionsTests(unittest.TestCase):
         password=passwordhere
         chmod=0755
         """)
-        from supervisor.options import UnhosedConfigParser
-        config = UnhosedConfigParser()
         instance.configfile = StringIO(text)
         try:
             instance.read_config(StringIO(text))
@@ -970,8 +984,6 @@ class ServerOptionsTests(unittest.TestCase):
         [inet_http_server]
         password=passwordhere
         """)
-        from supervisor.options import UnhosedConfigParser
-        config = UnhosedConfigParser()
         instance.configfile = StringIO(text)
         try:
             instance.read_config(StringIO(text))