def test_no_backends_available(self): self.mock_filewatcher.get_data.side_effect = WatchedFileNotAvailableError("", None) with self.assertRaises(service_discovery.NoBackendsAvailableError): self.inventory.get_backend() self.assertEqual(self.inventory.get_backends(), []) self.mock_filewatcher.get_data.side_effect = None self._set_inventory_contents("[]") with self.assertRaises(service_discovery.NoBackendsAvailableError): self.inventory.get_backend()
def test_that_bucketing_events_not_sent_if_cant_load_config(self): self.mock_filewatcher.get_data.side_effect = WatchedFileNotAvailableError("path", None) # noqa experiments = Experiments( config_watcher=self.mock_filewatcher, event_queue=self.event_queue, server_span=self.mock_span, context_name="test", ) self.assertEqual(self.event_queue.put.call_count, 0) experiments.variant("test", user=self.user) self.assertEqual(self.event_queue.put.call_count, 0) experiments.variant("test", user=self.user) self.assertEqual(self.event_queue.put.call_count, 0)
def test_file_not_found(self): self.mock_filewatcher.get_data.side_effect = WatchedFileNotAvailableError( "path", None) with self.assertRaises(store.SecretsNotAvailableError): self.store.get_raw("test")