def test_run(self): verificator = RangeVerificator() verificator.get_value = mock.Mock(return_value=1) verificator.lower_bound = 0 verificator.upper_bound = 2 verificator.run() self.assertTrue(verificator.get_value.called)
def test_value_over_upper_bound_raises_verification_error(self): verificator = RangeVerificator() verificator.get_value = mock.Mock(return_value=100) verificator.upper_bound = 99 self.assertRaises(errors.VerificationFailure, verificator.run)
def test_value_below_lower_bound_raises_verification_error(self): verificator = RangeVerificator() verificator.get_value = mock.Mock(return_value=99) verificator.lower_bound = 100 self.assertRaises(errors.VerificationFailure, verificator.run)
def test_bad_bounds_raises_bad_configuration(self): verificator = RangeVerificator() verificator.lower_bound = 1 verificator.upper_bound = 0 self.assertRaises(errors.BadConfigurationError, verificator.run)
def test_lack_of_bounds_raises_bad_configuration(self): verificator = RangeVerificator() self.assertRaises(errors.BadConfigurationError, verificator.run)