def test_show_info(self): with contextlib.redirect_stdout(io.StringIO()) as stdout: info_command.show_info(self.parser.parse_args(["info"])) output = stdout.getvalue() assert f"Apache Airflow: {airflow_version}" in output assert "postgresql+psycopg2://postgres:airflow@postgres/airflow" in output
def test_show_info_anonymize_fileio(self, mock_requests): with contextlib.redirect_stdout(io.StringIO()) as stdout: info_command.show_info(self.parser.parse_args(["info", "--file-io"])) self.assertIn("https://file.io/TEST", stdout.getvalue()) content = mock_requests.post.call_args[1]["files"]["file"][1] self.assertIn("postgresql+psycopg2://p...s:PASSWORD@postgres/airflow", content)
def test_show_info(self): with contextlib.redirect_stdout(io.StringIO()) as stdout: info_command.show_info(self.parser.parse_args(["info"])) output = stdout.getvalue() self.assertIn("Apache Airflow [{}]".format(airflow_version), output) self.assertIn("postgresql+psycopg2://postgres:airflow@postgres/airflow", output)
def test_show_info_anonymize(self): with contextlib.redirect_stdout(io.StringIO()) as stdout: info_command.show_info(self.parser.parse_args(["info", "--anonymize"])) output = stdout.getvalue() self.assertIn(f"Apache Airflow [{airflow_version}]", output) self.assertIn("postgresql+psycopg2://p...s:PASSWORD@postgres/airflow", output)
def test_show_info_anonymize_fileio(self, httpx_mock, setup_parser): httpx_mock.add_response( url="https://file.io", method="post", json={ "success": True, "key": "f9U3zs3I", "link": "https://file.io/TEST", "expiry": "14 days", }, status_code=200, ) with contextlib.redirect_stdout(io.StringIO()) as stdout: info_command.show_info( setup_parser.parse_args(["info", "--file-io"])) assert "https://file.io/TEST" in stdout.getvalue()