Browse Source

Add test for [inet_http_server] with no port= option

Mike Naberezny 10 years ago
parent
commit
5dcea345c2
1 changed files with 17 additions and 0 deletions
  1. 17 0
      supervisor/tests/test_options.py

+ 17 - 0
supervisor/tests/test_options.py

@@ -983,6 +983,7 @@ class ServerOptionsTests(unittest.TestCase):
 
         [inet_http_server]
         password=passwordhere
+        ;no username=
         """)
         instance.configfile = StringIO(text)
         try:
@@ -993,6 +994,22 @@ class ServerOptionsTests(unittest.TestCase):
                 "Must specify username if password is specified "
                 "in [inet_http_server]")
 
+    def test_options_afinet_no_port(self):
+        instance = self._makeOne()
+        text = lstrip("""\
+        [supervisord]
+
+        [inet_http_server]
+        ;no port=
+        """)
+        instance.configfile = StringIO(text)
+        try:
+            instance.read_config(StringIO(text))
+            self.fail("nothing raised")
+        except ValueError as exc:
+            self.assertEqual(exc.args[0],
+                "section [inet_http_server] has no port value")
+
     def test_cleanup_afunix_unlink(self):
         fn = tempfile.mktemp()
         with open(fn, 'w') as f: