예제 #1
0
 def test_throws_on_string(self):
     with self.assertRaises(CLIError) as cm:
         validators.validate_max_surge(MaxSurgeNamespace("foobar"))
     self.assertTrue('int or percentage' in str(cm.exception), msg=str(cm.exception))
예제 #2
0
 def test_throws_on_negative(self):
     with self.assertRaises(CLIError) as cm:
         validators.validate_max_surge(MaxSurgeNamespace("-3"))
     self.assertTrue('positive' in str(cm.exception), msg=str(cm.exception))
예제 #3
0
 def test_valid_cases(self):
     valid = ["5", "33%", "1", "100%"]
     for v in valid:
         validators.validate_max_surge(MaxSurgeNamespace(v))