Ejemplo n.º 1
0
 def test_adapter_put_raises_400(self):
     adapter_params = {
         'detector_fems': '192.168.0.1:6969, 192.168.0.2:6969',
         'chip_enable_mask': '0xff, 0x3f',
     }
     adapter = ExcaliburAdapter(**adapter_params)
     adapter.detector.put = Mock()
     adapter.detector.put.side_effect = ExcaliburDetectorError(
         'detector error')
     response = adapter.put(self.path, self.request)
     assert_equal(response.status_code, 400)
Ejemplo n.º 2
0
 def test_adapter_bad_chip_mask(self):
     adapter_params = {
         'detector_fems': '192.168.0.1:6969, 192.168.0.2:6969',
         'chip_enable_mask': '0xff, 0x3f, 1.235',
     }
     adapter = ExcaliburAdapter(**adapter_params)
     assert_equal(adapter.detector.chip_enable_mask, None)
Ejemplo n.º 3
0
 def test_adapter_bad_powercard_idx(self):
     adapter_params = {
         'detector_fems': '192.168.0.1:6969, 192.168.0.2:6969',
         'powercard_fem_idx': 'nonsense'
     }
     adapter = ExcaliburAdapter(**adapter_params)
     assert_equal(adapter.detector.powercard_fem_idx, None)
Ejemplo n.º 4
0
 def setup_class(cls, **adapter_params):
     cls.adapter = ExcaliburAdapter(**adapter_params)
     cls.path = 'status/fem'
     cls.request = Mock()
     cls.request.headers = {
         'Accept': 'application/json',
         'Content-Type': 'application/json'
     }
Ejemplo n.º 5
0
 def setup_class(cls, **adapter_params):
     ExcaliburFem.use_stub_api = True
     ExcaliburAdapter.use_raw_detector = True
     cls.adapter = ExcaliburAdapter(**adapter_params)
     cls.path = 'status/fem'
     cls.request = Mock()
     cls.request.headers = {
         'Accept': 'application/json',
         'Content-Type': 'application/json'
     }
Ejemplo n.º 6
0
 def test_adapter_bad_fem_config(self):
     adapter_params = {
         'detector_fems': '192.168.0.1 6969, 192.168.0.2:6969'
     }
     adapter = ExcaliburAdapter(**adapter_params)
     assert_equal(adapter.detector, None)
Ejemplo n.º 7
0
 def test_adapter_single_fem(self):
     adapter_params = {'detector_fems': '192.168.0.1:6969'}
     adapter = ExcaliburAdapter(**adapter_params)
     assert_equal(len(adapter.detector.fems), 1)