phanikumv commented on code in PR #68913:
URL: https://github.com/apache/airflow/pull/68913#discussion_r3466200019
##########
airflow-core/tests/unit/cli/commands/test_db_command.py:
##########
@@ -534,6 +534,15 @@ def test_cli_shell_invalid_ppg3(self):
with pytest.raises(AirflowException, match=r"Unknown driver:
invalid\+psycopg"):
db_command.shell(self.parser.parse_args(["db", "shell"]))
+ @mock.patch(
+ "airflow.cli.commands.db_command.settings.engine.url",
+ make_url("postgresql+psycopg2://postgres:airflow@postgres/"),
+ )
+ def test_db_shell_missing_database_name(self):
+ """Assert that an explicit ValueError is raised when the database name
is missing."""
+ with pytest.raises(ValueError, match="The metadata database name is
missing"):
+ db_command.shell(self.parser.parse_args(["db", "shell"]))
+
Review Comment:
```suggestion
@pytest.mark.parametrize(
"conn_uri",
[
pytest.param("postgresql://postgres:postgres@postgres:5432",
id="db-name-none"),
pytest.param("postgresql://postgres:postgres@postgres:5432/",
id="db-name-empty"),
],
)
def test_db_shell_missing_database_name(self, conn_uri):
"""Assert that an explicit ValueError is raised when the database
name is missing."""
with
mock.patch("airflow.cli.commands.db_command.settings.engine.url",
make_url(conn_uri)):
with pytest.raises(ValueError, match="The metadata database
name is missing"):
db_command.shell(self.parser.parse_args(["db", "shell"]))
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]