Example #1
0
 def test_str(self):
     """Test that the string representation contains all information."""
     report = ValidationReport([self.ERROR_1])
     report.increment_total_checks()
     report.increment_total_checks()
     report.increment_total_checks()
     report.add_raised_warning(ImportWarning("wrong import"))
     report.add_raised_warning(ImportWarning("right import"))
     report.add_raised_error(self.ERROR_1)
     report.add_raised_error(self.ERROR_2)
Example #2
0
    def test_str(self):
        """Test that the string representation contains all information."""
        report = ValidationReport([self.ERROR_1])
        report.increment_total_checks()
        report.increment_total_checks()
        report.increment_total_checks()
        report.add_raised_warning(ImportWarning("wrong import"))
        report.add_raised_warning(ImportWarning("right import"))
        report.add_raised_error(self.ERROR_1)
        report.add_raised_error(self.ERROR_2)

        assert report.summary() ==\
            "3 checks run\n1 checks failed\n1 checks suppressed\n2 warnings\n"
Example #3
0
    def test_log(self, mock_logger):
        """Test that the logs contain all failures and warnings."""
        report = ValidationReport([self.ERROR_1])
        report.increment_total_checks()
        report.increment_total_checks()
        report.increment_total_checks()
        report.add_raised_warning(ImportWarning("wrong import"))
        report.add_raised_warning(ImportWarning("right import"))
        report.add_raised_error(self.ERROR_1)
        report.add_raised_error(self.ERROR_2)

        report.log()
        mock_logger.critical.assert_called_once_with(
            "bad failed for sig2 at resolution county on 2020-11-07: msg 2")
        mock_logger.warning.assert_has_calls([mock.call("wrong import"), mock.call("right import")])