def test_createLocation_with_bad_port( self, config ): options = None cs = COSMSend( options ) config.assert_called_once_with() cs.config = self.config_data with self.assertRaisesRegexp( KeyError, 'Port is not in cosm configuration file: port 2' ): cs.createLocation( 'device 1', 'port 2' )
def test_createLocation_with_bad_port(self, config): options = None cs = COSMSend(options) config.assert_called_once_with() cs.config = self.config_data with self.assertRaisesRegexp( KeyError, 'Port is not in cosm configuration file: port 2'): cs.createLocation('device 1', 'port 2')
def test_createLocation(self, config): options = None cs = COSMSend(options) device = 'device 1' port = 'port 1' config.assert_called_once_with() cs.config = self.config_data data = { 'device': device, 'port': port, Constants.DataPacket.arrival_time: '12:12:12 12/12/15', Constants.DataPacket.current_value: 10 } location = cs.createLocation(device, port) self.assertEqual(location[Constants.Cosm.location.exposure], Constants.Cosm.location.exposure) self.assertEqual(location[Constants.Cosm.location.domain], Constants.Cosm.location.domain) self.assertEqual(location[Constants.Cosm.location.disposition], Constants.Cosm.location.disposition) self.assertEqual(location[Constants.Cosm.location.latitude], Constants.Cosm.location.latitude) self.assertEqual(location[Constants.Cosm.location.longitude], Constants.Cosm.location.longitude) self.assertEqual(location[Constants.Cosm.location.private], Constants.Cosm.location.private)
def test_createLocation( self, config ): options = None cs = COSMSend( options ) device = 'device 1' port = 'port 1' config.assert_called_once_with() cs.config = self.config_data data = {'device': device, 'port': port, Constants.DataPacket.arrival_time: '12:12:12 12/12/15', Constants.DataPacket.current_value: 10} location = cs.createLocation( device, port ) self.assertEqual( location[Constants.Cosm.location.exposure], Constants.Cosm.location.exposure ) self.assertEqual( location[Constants.Cosm.location.domain], Constants.Cosm.location.domain ) self.assertEqual( location[Constants.Cosm.location.disposition], Constants.Cosm.location.disposition ) self.assertEqual( location[Constants.Cosm.location.latitude], Constants.Cosm.location.latitude ) self.assertEqual( location[Constants.Cosm.location.longitude], Constants.Cosm.location.longitude ) self.assertEqual( location[Constants.Cosm.location.private], Constants.Cosm.location.private )