def test_validate_app_int_descriptor(self): """ Test whether custom validate_app_int_descriptor method raises a ValidationError when the descriptor cannot be converted to a non-negative integer. """ with self.assertRaises(serializers.ValidationError): PluginSerializer.validate_app_int_descriptor('one') with self.assertRaises(serializers.ValidationError): PluginSerializer.validate_app_int_descriptor(-1)
def test_validate_app_int_descriptor(self): """ Test whether custom validate_app_int_descriptor method raises a ValidationError when the descriptor cannot be converted to a non-negative integer. """ error_msg = "This field must be a non-negative integer." with self.assertRaises(serializers.ValidationError): descriptor_dict = {'name': 'field_name', 'value': 'one'} PluginSerializer.validate_app_int_descriptor(descriptor_dict, error_msg) with self.assertRaises(serializers.ValidationError): descriptor_dict = {'name': 'field_name', 'value': -1} PluginSerializer.validate_app_int_descriptor(descriptor_dict, error_msg)
def test_validate_app_int_descriptor(self): """ Test whether custom validate_app_int_descriptor method raises a ValidationError when the descriptor cannot be converted to a non-negative integer. """ error_msg = "This field must be a non-negative integer." with self.assertRaises(serializers.ValidationError): descriptor_dict = {'name': 'field_name', 'value': 'one'} PluginSerializer.validate_app_int_descriptor( descriptor_dict, error_msg) with self.assertRaises(serializers.ValidationError): descriptor_dict = {'name': 'field_name', 'value': -1} PluginSerializer.validate_app_int_descriptor( descriptor_dict, error_msg)