@@ -1123,13 +1123,36 @@ def test_options_afunix_no_file(self):
11231123 self .assertEqual (exc .args [0 ],
11241124 "section [unix_http_server] has no file value" )
11251125
1126+ def test_options_afunix_username_without_password (self ):
1127+ instance = self ._makeOne ()
1128+ text = lstrip ("""\
1129+ [supervisord]
1130+
1131+ [unix_http_server]
1132+ file=/tmp/supvtest.sock
1133+ username=usernamehere
1134+ ;no password=
1135+ chmod=0755
1136+ """ )
1137+ instance .configfile = StringIO (text )
1138+ try :
1139+ instance .read_config (StringIO (text ))
1140+ self .fail ("nothing raised" )
1141+ except ValueError as exc :
1142+ self .assertEqual (exc .args [0 ],
1143+ 'Section [unix_http_server] contains incomplete '
1144+ 'authentication: If a username or a password is '
1145+ 'specified, both the username and password must '
1146+ 'be specified' )
1147+
11261148 def test_options_afunix_password_without_username (self ):
11271149 instance = self ._makeOne ()
11281150 text = lstrip ("""\
11291151 [supervisord]
11301152
11311153 [unix_http_server]
11321154 file=/tmp/supvtest.sock
1155+ ;no username=
11331156 password=passwordhere
11341157 chmod=0755
11351158 """ )
@@ -1139,8 +1162,10 @@ def test_options_afunix_password_without_username(self):
11391162 self .fail ("nothing raised" )
11401163 except ValueError , exc :
11411164 self .assertEqual (exc .args [0 ],
1142- "Must specify username if password is specified "
1143- "in [unix_http_server]" )
1165+ 'Section [unix_http_server] contains incomplete '
1166+ 'authentication: If a username or a password is '
1167+ 'specified, both the username and password must '
1168+ 'be specified' )
11441169
11451170 def test_options_afunix_file_expands_here (self ):
11461171 instance = self ._makeOne ()
@@ -1167,6 +1192,28 @@ def test_options_afunix_file_expands_here(self):
11671192 finally :
11681193 shutil .rmtree (here , ignore_errors = True )
11691194
1195+ def test_options_afinet_username_without_password (self ):
1196+ instance = self ._makeOne ()
1197+ text = lstrip ("""\
1198+ [supervisord]
1199+
1200+ [inet_http_server]
1201+ file=/tmp/supvtest.sock
1202+ username=usernamehere
1203+ ;no password=
1204+ chmod=0755
1205+ """ )
1206+ instance .configfile = StringIO (text )
1207+ try :
1208+ instance .read_config (StringIO (text ))
1209+ self .fail ("nothing raised" )
1210+ except ValueError as exc :
1211+ self .assertEqual (exc .args [0 ],
1212+ 'Section [inet_http_server] contains incomplete '
1213+ 'authentication: If a username or a password is '
1214+ 'specified, both the username and password must '
1215+ 'be specified' )
1216+
11701217 def test_options_afinet_password_without_username (self ):
11711218 instance = self ._makeOne ()
11721219 text = lstrip ("""\
@@ -1182,8 +1229,10 @@ def test_options_afinet_password_without_username(self):
11821229 self .fail ("nothing raised" )
11831230 except ValueError , exc :
11841231 self .assertEqual (exc .args [0 ],
1185- "Must specify username if password is specified "
1186- "in [inet_http_server]" )
1232+ 'Section [inet_http_server] contains incomplete '
1233+ 'authentication: If a username or a password is '
1234+ 'specified, both the username and password must '
1235+ 'be specified' )
11871236
11881237 def test_options_afinet_no_port (self ):
11891238 instance = self ._makeOne ()
0 commit comments