def test_sensor_initialization(self): ''' Initialize the sensor and verify that the attributes get populated correctly ''' test_sensor = Sensor(1, 'test_sensor', 'text', False) self.assertEqual(test_sensor.get_sensor_id(), 1) self.assertEqual(test_sensor.get_sensor_name(), 'test_sensor') self.assertEqual(test_sensor.get_data_type(), 'text') self.assertEqual(test_sensor.get_binary_type(), False)
def test_noblank_binarytype(self): ''' The binary type should not be blank when initializing a sensor ''' test_sensor = Sensor(1, 'test_sensor', 'test', '') with self.assertRaises(Exception): test_sensor.get_binary_type()
def test_noblank_datatype(self): ''' The data type should not be blank when initializing a sensor ''' test_sensor = Sensor(1, 'test_sensor', None, False) with self.assertRaises(Exception): test_sensor.get_data_type()
def test_noblank_name(self): ''' The ID should not be blank when initializing a sensor ''' test_sensor = Sensor(1, '', 'text', False) with self.assertRaises(Exception): test_sensor.get_sensor_name()
def test_nonone_name(self): ''' The name should not be None when initializing a sensor ''' test_sensor = Sensor(1, None, 'text', False) with self.assertRaises(Exception): test_sensor.get_sensor_name()