def test_write_report_unpopulated() -> None: """ This test verifies that a None value is returned for each file when the report is unpopulated. """ # create unpopulated report instance report = ViyaDeploymentReport() # write report data_file, html_file = report.write_report() # make sure None is returned assert data_file is None assert html_file is None
def test_write_report_data_only(report: ViyaDeploymentReport) -> None: """ This test verifies that only the JSON data file is written to disk when requested from a completed report. :param report: The populated ViyaDeploymentReport returned by the report() fixture. """ # write data file only data_file, html_file = report.write_report(data_file_only=True) # make sure HTML report is None assert html_file is None # check for expected file assert os.path.exists(data_file) assert os.path.isfile(data_file) # clean up file os.remove(data_file)
def test_write_report(report: ViyaDeploymentReport) -> None: """ This test verifies that a completed report is correctly written to disk as both an HTML report and a JSON data file. :param report: The populated ViyaDeploymentReport returned by the report() fixture. """ # write the report and data file data_file, html_file = report.write_report() # check for expected files assert os.path.exists(data_file) assert os.path.isfile(data_file) assert os.path.exists(html_file) assert os.path.exists(html_file) # clean up files os.remove(data_file) os.remove(html_file)