"""Test exceptions.""" import pytest from vector_utils.connections import exceptions @pytest.mark.parametrize( 'exception_msg,expected', [ (None, 'Could not connect to SFTP server'), ('test', 'test') ] ) def test_ssh_exception(exception_msg, expected): """Test FTP connection class.""" with pytest.raises(exceptions.SSHException) as excinfo: if exception_msg: raise exceptions.SSHException(exception_msg) raise exceptions.SSHException() assert expected in str(excinfo.value) @pytest.mark.parametrize( 'exception_msg,expected', [ (None, 'Connection timed out'), ('test', 'test') ] ) def test_timeout_exception(exception_msg, expected): """Test FTP connection class.""" with pytest.raises(exceptions.ConnectionTimeout) as excinfo: if exception_msg: raise exceptions.ConnectionTimeout(exception_msg) raise exceptions.ConnectionTimeout() assert expected in str(excinfo.value)