|
36 | 36 | DEFAULT_HOST, |
37 | 37 | DEFAULT_PORT, |
38 | 38 | DEFAULT_USER, |
| 39 | + EMPTY_PASSWORD_FLAG_SENTINEL, |
39 | 40 | ER_MUST_CHANGE_PASSWORD_LOGIN, |
40 | 41 | TEST_DATABASE, |
41 | 42 | ) |
42 | 43 | from mycli.main import ( |
43 | | - EMPTY_PASSWORD_FLAG_SENTINEL, |
44 | 44 | INT_OR_STRING_CLICK_TYPE, |
45 | 45 | CliArgs, |
46 | 46 | MyCli, |
@@ -1199,63 +1199,6 @@ def run_query(self, query, new_line=True): |
1199 | 1199 | ) |
1200 | 1200 |
|
1201 | 1201 |
|
1202 | | -def test_password_flag_uses_sentinel(monkeypatch): |
1203 | | - class Formatter: |
1204 | | - format_name = None |
1205 | | - |
1206 | | - class Logger: |
1207 | | - def debug(self, *args, **args_dict): |
1208 | | - pass |
1209 | | - |
1210 | | - def warning(self, *args, **args_dict): |
1211 | | - pass |
1212 | | - |
1213 | | - class MockMyCli: |
1214 | | - config = { |
1215 | | - 'main': {}, |
1216 | | - 'alias_dsn': {}, |
1217 | | - 'connection': { |
1218 | | - 'default_keepalive_ticks': 0, |
1219 | | - }, |
1220 | | - } |
1221 | | - |
1222 | | - def __init__(self, **_args): |
1223 | | - self.logger = Logger() |
1224 | | - self.destructive_warning = False |
1225 | | - self.main_formatter = Formatter() |
1226 | | - self.redirect_formatter = Formatter() |
1227 | | - self.ssl_mode = 'auto' |
1228 | | - self.default_keepalive_ticks = 0 |
1229 | | - |
1230 | | - def connect(self, **args): |
1231 | | - MockMyCli.connect_args = args |
1232 | | - |
1233 | | - def run_query(self, query, new_line=True): |
1234 | | - pass |
1235 | | - |
1236 | | - import mycli.main |
1237 | | - |
1238 | | - monkeypatch.setattr(mycli.main, 'MyCli', MockMyCli) |
1239 | | - runner = CliRunner() |
1240 | | - |
1241 | | - result = runner.invoke( |
1242 | | - mycli.main.click_entrypoint, |
1243 | | - args=[ |
1244 | | - '--user', |
1245 | | - 'user', |
1246 | | - '--host', |
1247 | | - DEFAULT_HOST, |
1248 | | - '--port', |
1249 | | - f'{DEFAULT_PORT}', |
1250 | | - '--database', |
1251 | | - 'database', |
1252 | | - '--password', |
1253 | | - ], |
1254 | | - ) |
1255 | | - assert result.exit_code == 0, result.output + ' ' + str(result.exception) |
1256 | | - assert MockMyCli.connect_args['passwd'] == EMPTY_PASSWORD_FLAG_SENTINEL |
1257 | | - |
1258 | | - |
1259 | 1202 | def test_password_option_uses_cleartext_value(monkeypatch): |
1260 | 1203 | class Formatter: |
1261 | 1204 | format_name = None |
|
0 commit comments