File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -937,6 +937,26 @@ def run(self, text: str) -> Iterator[SQLResult]:
937937 assert any ('reconnection failed' in msg for msg in cli .echo_calls )
938938
939939
940+ def test_one_iteration_enters_sandbox_mode_on_must_change_password_error (monkeypatch : pytest .MonkeyPatch ) -> None :
941+ patch_repl_runtime_defaults (monkeypatch )
942+
943+ class FakeSQLExecute :
944+ dbname = 'db'
945+ connection_id = 0
946+
947+ def run (self , text : str ) -> Iterator [SQLResult ]:
948+ raise pymysql .OperationalError (repl_mode .ER_MUST_CHANGE_PASSWORD , 'must change password' )
949+
950+ cli = make_repl_cli (FakeSQLExecute ())
951+
952+ repl_mode ._one_iteration (cli , repl_mode .ReplState (), 'SELECT 1' )
953+
954+ assert cli .sandbox_mode is True
955+ assert any ('ERROR 1820' in msg for msg in cli .echo_calls )
956+ assert cli .query_history [- 1 ].query == 'SELECT 1'
957+ assert cli .query_history [- 1 ].successful is False
958+
959+
940960def test_one_iteration_covers_redirect_destructive_success_refresh_and_logfile (monkeypatch : pytest .MonkeyPatch ) -> None :
941961 patch_repl_runtime_defaults (monkeypatch )
942962
You can’t perform that action at this time.
0 commit comments