def test_no_errors(self): """ Test case for a valid field name. """ try: field_name_validator('good_field_name') except ValidationError: self.fail('Field name raised ValidationError unexpectedly')
def test_at_sign(self): """ Test case for a field name with an 'at' sign. """ try: field_name_validator('@timestamp') except ValidationError: self.fail('Name raised ValidationError unexpectedly')
def test_ends_with_dollar_sign(self): """ Test case for a field name that ends with '$'. """ try: field_name_validator('id$') except ValidationError: self.fail('Field name raised ValidationError unexpectedly')
def test_nonreserved_name(self): """ Test case for a nonreserved field name. """ try: field_name_validator('_identifier') except ValidationError: self.fail('Field name raised ValidationError unexpectedly')
def test_white_space(self): """ Test case for a field name with a space. """ with self.assertRaises(ValidationError): field_name_validator('user id')
def test_asterisk(self): """ Test case for a field name with an asterisk. """ with self.assertRaises(ValidationError): field_name_validator('logstash*')
def test_starts_with_dollar_sign(self): """ Test case for a field name that starts with '$'. """ with self.assertRaises(ValidationError): field_name_validator('$id')
def test_reserved_name(self): """ Test case for a reserved field name. """ with self.assertRaises(ValidationError): field_name_validator('_id')