@@ -1123,13 +1123,36 @@ def test_options_afunix_no_file(self):
1123
1123
self .assertEqual (exc .args [0 ],
1124
1124
"section [unix_http_server] has no file value" )
1125
1125
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
+
1126
1148
def test_options_afunix_password_without_username (self ):
1127
1149
instance = self ._makeOne ()
1128
1150
text = lstrip ("""\
1129
1151
[supervisord]
1130
1152
1131
1153
[unix_http_server]
1132
1154
file=/tmp/supvtest.sock
1155
+ ;no username=
1133
1156
password=passwordhere
1134
1157
chmod=0755
1135
1158
""" )
@@ -1139,8 +1162,10 @@ def test_options_afunix_password_without_username(self):
1139
1162
self .fail ("nothing raised" )
1140
1163
except ValueError , exc :
1141
1164
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' )
1144
1169
1145
1170
def test_options_afunix_file_expands_here (self ):
1146
1171
instance = self ._makeOne ()
@@ -1167,6 +1192,28 @@ def test_options_afunix_file_expands_here(self):
1167
1192
finally :
1168
1193
shutil .rmtree (here , ignore_errors = True )
1169
1194
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
+
1170
1217
def test_options_afinet_password_without_username (self ):
1171
1218
instance = self ._makeOne ()
1172
1219
text = lstrip ("""\
@@ -1182,8 +1229,10 @@ def test_options_afinet_password_without_username(self):
1182
1229
self .fail ("nothing raised" )
1183
1230
except ValueError , exc :
1184
1231
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' )
1187
1236
1188
1237
def test_options_afinet_no_port (self ):
1189
1238
instance = self ._makeOne ()
0 commit comments