def testRunAllChecksWithEmptyMetrics(self): result = check_model_consistency._runAllChecks(engineMetrics=(), dynamodbMetrics=(), verbose=False) self.assertEqual(result, ([], [])) # Repeat with verbose=True result = check_model_consistency._runAllChecks(engineMetrics=(), dynamodbMetrics=(), verbose=True) self.assertEqual(result, ([], []))
def testRunAllChecksAggregatesErrorsAndWarnigs(self, checkModelAttributeParity, checkModelParityMock, checkFailedModelssMock): checkModelAttributeParity.return_value = ( [("w-caption1", "w-details1"), ("w-caption2", "w-details2")], [("e-caption1", "e-details1"), ("e-caption2", "e-details2")], ) checkModelParityMock.return_value = ( [("w-caption3", "w-details3"), ("w-caption4", "details4")], [("e-caption3", "e-details3"), ("e-caption4", "e-details4")], ) checkFailedModelssMock.return_value = ( [("w-caption5", "w-details5"), ("w-caption6", "w-details6")], [("e-caption5", "e-details5"), ("e-caption6", "e-details6")], ) allExpectedWarnings = (checkModelAttributeParity.return_value[0] + checkModelParityMock.return_value[0] + checkFailedModelssMock.return_value[0]) allExpectedErrors = (checkModelAttributeParity.return_value[1] + checkModelParityMock.return_value[1] + checkFailedModelssMock.return_value[1]) warnings, errors = check_model_consistency._runAllChecks( engineMetrics=(), dynamodbMetrics=(), verbose=False) self.assertItemsEqual(warnings, allExpectedWarnings) self.assertItemsEqual(errors, allExpectedErrors)
def testRunAllChecksAggregatesErrorsAndWarnigs(self, checkModelAttributeParity, checkModelParityMock, checkFailedModelssMock): checkModelAttributeParity.return_value = ( [("w-caption1", "w-details1"), ("w-caption2", "w-details2")], [("e-caption1", "e-details1"), ("e-caption2", "e-details2")], ) checkModelParityMock.return_value = ( [("w-caption3", "w-details3"), ("w-caption4", "details4")], [("e-caption3", "e-details3"), ("e-caption4", "e-details4")], ) checkFailedModelssMock.return_value = ( [("w-caption5", "w-details5"), ("w-caption6", "w-details6")], [("e-caption5", "e-details5"), ("e-caption6", "e-details6")], ) allExpectedWarnings = ( checkModelAttributeParity.return_value[0] + checkModelParityMock.return_value[0] + checkFailedModelssMock.return_value[0] ) allExpectedErrors = ( checkModelAttributeParity.return_value[1] + checkModelParityMock.return_value[1] + checkFailedModelssMock.return_value[1] ) warnings, errors = check_model_consistency._runAllChecks(engineMetrics=(), dynamodbMetrics=(), verbose=False) self.assertItemsEqual(warnings, allExpectedWarnings) self.assertItemsEqual(errors, allExpectedErrors)