Example #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))
Example #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))
Example #3
0
 def test_valid_cases(self):
     valid = ["5", "33%", "1", "100%"]
     for v in valid:
         validators.validate_max_surge(MaxSurgeNamespace(v))