예제 #1
0
 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' )
예제 #2
0
 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')
예제 #3
0
 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)
예제 #4
0
 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 )