def test_invalid3(self): e = ( "'filter' key in definition dictionary must be a \[<type 'dict'>\]" ", you supplied a <type 'list'>!" ) with self.assertRaisesRegexp(DefinitionParserError, e): kwargs = {'sensor_defs': [{'name': 'test1', 'filter': [{}]}]} utils.val_sensor_defs(**kwargs)
def test_valid2(self): kwargs = {'sensor_defs': [ { 'name': 'Sensor1', 'filter': { 'operator': 'RegexMatch', 'not_flag': 0, 'value': '.*' }, } ]} utils.val_sensor_defs(**kwargs)
def test_valid3(self): kwargs = {'sensor_defs': [ { 'name': 'Sensor1', 'filter': { 'operator': 'RegexMatch', 'not_flag': 0, 'value': '.*' }, 'options': { 'all_values_flag': 0, 'ignore_case_flag': 1, 'max_age_seconds': '3600', 'value_type': 'string', 'all_times_flag': 0 }, } ]} utils.val_sensor_defs(**kwargs)
def test_invalid4(self): e = "Sensor definition.*has more than one of id, name, hash!" with self.assertRaisesRegexp(DefinitionParserError, e): kwargs = {'sensor_defs': [{'name': 'test1', 'id': '2'}]} utils.val_sensor_defs(**kwargs)
def test_invalid2(self): e = "Sensor definition.*missing one of id, name, hash!" with self.assertRaisesRegexp(DefinitionParserError, e): kwargs = {'sensor_defs': [{}]} utils.val_sensor_defs(**kwargs)
def test_valid4(self): kwargs = {'sensor_defs': [{'name': 'test1', 'filter': {'n': 'k'}}]} utils.val_sensor_defs(**kwargs)
def test_valid1(self): kwargs = {'sensor_defs': [{'name': 'Sensor1'}]} utils.val_sensor_defs(**kwargs)