Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_mutating_name(self):
with self.recorder:
with self.assertRaises(InvalidValue):
self.team.name = 'a' * 513
original_name = self.team.name
self.team.name = 'valid_name'
self.assertEqual(self.team.name, 'valid_name')
self.team.name = original_name
self.assertEqual(self.team.name, original_name)
def name(self, value):
"""Update the name of the project.
Returns:
None:
"""
max_characters = 512
conditions = [validate_max_length(value, max_characters)]
if all(conditions):
self._update_values('name', value)
else:
raise InvalidValue('{value} is invalid. Condition max_characters must be less than or equal to '
'{max_characters}'.format(value=value, max_characters=max_characters))
def instance_id(self, value):
"""Update the instance_id of the host.
Returns:
None:
"""
max_characters = 1024
conditions = [validate_max_length(value, max_characters)]
if all(conditions):
self._update_values('instance_id', value)
else:
raise InvalidValue('{value} is invalid. Condition max_characters must be less than or equal to '
'{max_characters}'.format(value=value, max_characters=max_characters))
def email(self, value):
"""Update the email address of the user.
Returns:
None:
"""
max_characters = 254
conditions = [validate_max_length(value, max_characters)]
if all(conditions):
self._update_values('email', value)
else:
raise InvalidValue('{value} is invalid. Condition max_characters must be less or equal to '
'{max_characters}'.format(value=value, max_characters=max_characters))
def inputs(self, value):
"""Update the inputs of the credential type.
Returns:
None:
"""
if isinstance(value, dict):
self._update_values('inputs', value)
else:
raise InvalidValue('Value is not valid dictionary received: {value}'.format(value=value))
def variables(self, value):
"""Update the variables on the host.
Returns:
None:
"""
conditions = [validate_json(value)]
if all(conditions):
self._update_values('variables', value)
else:
raise InvalidValue(
'{value} is not valid json.'.format(value=value))
def name(self, value):
"""Update the name of the organization.
Returns:
None:
"""
max_characters = 512
conditions = [validate_max_length(value, max_characters)]
if all(conditions):
self._update_values('name', value)
else:
raise InvalidValue('{value} is invalid. Condition max_characters must be less than or equal to '
'{max_characters}'.format(value=value, max_characters=max_characters))
def last_name(self, value):
"""Update the last name of the user.
Returns:
None:
"""
max_characters = 30
conditions = [validate_max_length(value, max_characters)]
if all(conditions):
self._update_values('last_name', value)
else:
raise InvalidValue(value)
def local_path(self, value):
"""Update the internal local path of the project.
Returns:
None:
"""
max_characters = 1024
conditions = [validate_max_length(value, max_characters)]
if all(conditions):
self._update_values('local_path', value)
else:
raise InvalidValue('{value} is invalid. Condition max_characters must be less than or equal to '
'{max_characters}'.format(value=value, max_characters=max_characters))
def scm_update_cache_timeout(self, value):
"""Update the scm_update_cache_timeout of the project.
Returns:
None:
"""
minimum = 0
maximum = 2147483647
conditions = [validate_range(value, minimum, maximum)]
if all(conditions):
self._update_values('scm_update_cache_timeout', value)
else:
raise InvalidValue('{value} is invalid, must be between {minimum} and {maximum}'.format(value=value,
minimum=minimum,
maximum=maximum))