Exemplo n.º 1
0
 def test_failure_invalid_range(self):
     # The validation fails if the value is not in range.
     error = self.error.format('arg1', *self.value_range)
     for value in (-50, 0, 11, 100):
         with mock.patch('guiserver.manage.options', {'arg1': value}):
             with self.assert_sysexit(error):
                 manage._validate_range('arg1', *self.value_range)
Exemplo n.º 2
0
 def test_failure_invalid_range(self):
     # The validation fails if the value is not in range.
     error = self.error.format('arg1', *self.value_range)
     for value in (-50, 0, 11, 100):
         with mock.patch('guiserver.manage.options', {'arg1': value}):
             with self.assert_sysexit(error):
                 manage._validate_range('arg1', *self.value_range)
Exemplo n.º 3
0
 def test_success_missing(self):
     # The validation succeeds if the value is missing.
     with mock.patch('guiserver.manage.options', {'arg1': None}):
         manage._validate_range('arg1', *self.value_range)
Exemplo n.º 4
0
 def test_success(self):
     # The validation passes if the value is included in the range.
     for value in range(1, 11):
         with mock.patch('guiserver.manage.options', {'arg1': value}):
             manage._validate_range('arg1', *self.value_range)
Exemplo n.º 5
0
 def test_success_missing(self):
     # The validation succeeds if the value is missing.
     with mock.patch('guiserver.manage.options', {'arg1': None}):
         manage._validate_range('arg1', *self.value_range)
Exemplo n.º 6
0
 def test_success(self):
     # The validation passes if the value is included in the range.
     for value in range(1, 11):
         with mock.patch('guiserver.manage.options', {'arg1': value}):
             manage._validate_range('arg1', *self.value_range)