def test_get_cursor_empty_schema(self, mock_keyring_get_password: MagicMock, mock_user_config_dir: MagicMock) -> None: redshift_connector = RedshiftConnector() mock_user_config_dir.assert_called_once_with('pypandasql') mock_keyring_get_password.assert_called_once_with( 'pypandasql-redshift', 'test') with self.assertRaises(AssertionError): redshift_connector.get_cursor(schema='')
def test_get_cursor(self, mock_connect: MagicMock, mock_keyring_get_password: MagicMock, mock_user_config_dir: MagicMock) -> None: redshift_connector = RedshiftConnector() redshift_connector.get_cursor(schema='test-schema') mock_user_config_dir.assert_called_once_with('pypandasql') mock_keyring_get_password.assert_called_once_with( 'pypandasql-redshift', 'test') mock_connect.assert_called_once_with(dbname='test-schema', host='test-host', port=1234, user='******', password='******')