def test_no_source(self): class FakeStorageDestination(object): def __init__(self, config, quit_check_callback): self.store = DotDict() self.dumps = DotDict() def save_raw_crash(self, raw_crash, dump, crash_id): self.store[crash_id] = raw_crash self.dumps[crash_id] = dump logger = get_logger() config = DotDict({ 'logger': logger, 'number_of_threads': 2, 'maximum_queue_size': 2, 'number_of_submissions': 'forever', 'source': DotDict({'crashstorage_class': None}), 'destination': DotDict({'crashstorage_class': FakeStorageDestination}), 'producer_consumer': DotDict({ 'producer_consumer_class': ThreadedTaskManager, 'logger': logger, 'number_of_threads': 1, 'maximum_queue_size': 1 }) }) fts_app = FetchTransformSaveApp(config) with pytest.raises(TypeError): fts_app.main()
def test_no_source(self): class FakeStorageDestination(object): def __init__(self, config, quit_check_callback): self.store = DotDict() self.dumps = DotDict() def save_raw_crash(self, raw_crash, dump, crash_id): self.store[crash_id] = raw_crash self.dumps[crash_id] = dump config = DotDict({ 'logger': MagicMock(), 'number_of_threads': 2, 'maximum_queue_size': 2, 'number_of_submissions': 'forever', 'source': DotDict({'crashstorage_class': None}), 'destination': DotDict({'crashstorage_class': FakeStorageDestination}), 'producer_consumer': DotDict({ 'producer_consumer_class': ThreadedTaskManager, 'logger': MagicMock(), 'number_of_threads': 1, 'maximum_queue_size': 1 }) }) fts_app = FetchTransformSaveApp(config) with pytest.raises(TypeError): fts_app.main()
def test_no_destination(self): class FakeStorageSource(object): def __init__(self, config, quit_check_callback): self.store = DotDict({ '1234': DotDict({ 'ooid': '1234', 'Product': 'FireSquid', 'Version': '1.0' }), '1235': DotDict({ 'ooid': '1235', 'Product': 'ThunderRat', 'Version': '1.0' }), '1236': DotDict({ 'ooid': '1236', 'Product': 'Caminimal', 'Version': '1.0' }), '1237': DotDict({ 'ooid': '1237', 'Product': 'Fennicky', 'Version': '1.0' }), }) def get_raw_crash(self, ooid): return self.store[ooid] def get_raw_dump(self, ooid): return 'this is a fake dump' def new_ooids(self): for k in self.store.keys(): yield k logger = get_logger() config = DotDict({ 'logger': logger, 'number_of_threads': 2, 'maximum_queue_size': 2, 'number_of_submissions': 'forever', 'source': DotDict({'crashstorage_class': FakeStorageSource}), 'destination': DotDict({'crashstorage_class': None}), 'producer_consumer': DotDict({ 'producer_consumer_class': ThreadedTaskManager, 'logger': logger, 'number_of_threads': 1, 'maximum_queue_size': 1 }) }) fts_app = FetchTransformSaveApp(config) with pytest.raises(TypeError): fts_app.main()
def test_no_destination(self): class FakeStorageSource(object): def __init__(self, config, quit_check_callback): self.store = DotDict({ '1234': DotDict({ 'ooid': '1234', 'Product': 'FireSquid', 'Version': '1.0' }), '1235': DotDict({ 'ooid': '1235', 'Product': 'ThunderRat', 'Version': '1.0' }), '1236': DotDict({ 'ooid': '1236', 'Product': 'Caminimal', 'Version': '1.0' }), '1237': DotDict({ 'ooid': '1237', 'Product': 'Fennicky', 'Version': '1.0' }), }) def get_raw_crash(self, ooid): return self.store[ooid] def get_raw_dump(self, ooid): return 'this is a fake dump' def new_ooids(self): for k in self.store.keys(): yield k config = DotDict({ 'logger': MagicMock(), 'number_of_threads': 2, 'maximum_queue_size': 2, 'number_of_submissions': 'forever', 'source': DotDict({'crashstorage_class': FakeStorageSource}), 'destination': DotDict({'crashstorage_class': None}), 'producer_consumer': DotDict({ 'producer_consumer_class': ThreadedTaskManager, 'logger': MagicMock(), 'number_of_threads': 1, 'maximum_queue_size': 1 }) }) fts_app = FetchTransformSaveApp(config) with pytest.raises(TypeError): fts_app.main()
def test_no_source(self): class FakeStorageDestination(object): def __init__(self, config): self.store = DotDict() self.dumps = DotDict() def save_raw_crash(self, raw_crash, dump, crash_id): self.store[crash_id] = raw_crash self.dumps[crash_id] = dump config = DotDict({ "logger": MagicMock(), "number_of_threads": 2, "maximum_queue_size": 2, "queue": DotDict({"crashqueue_class": None}), "source": DotDict({"crashstorage_class": None}), "destination": DotDict({"crashstorage_class": FakeStorageDestination}), "producer_consumer": DotDict({ "producer_consumer_class": ThreadedTaskManager, "logger": MagicMock(), "number_of_threads": 1, "maximum_queue_size": 1, }), }) fts_app = FetchTransformSaveApp(config) with pytest.raises(TypeError): fts_app.main()
def test_no_destination(self): class FakeStorageSource(object): def __init__(self, config): self.store = DotDict({ "1234": DotDict({ "ooid": "1234", "Product": "FireSquid", "Version": "1.0" }), "1235": DotDict({ "ooid": "1235", "Product": "ThunderRat", "Version": "1.0" }), "1236": DotDict({ "ooid": "1236", "Product": "Caminimal", "Version": "1.0" }), "1237": DotDict({ "ooid": "1237", "Product": "Fennicky", "Version": "1.0" }), }) def get_raw_crash(self, ooid): return self.store[ooid] def get_raw_dump(self, ooid): return "this is a fake dump" def new_ooids(self): for k in self.store.keys(): yield k config = DotDict({ "logger": MagicMock(), "number_of_threads": 2, "maximum_queue_size": 2, "queue": DotDict({"crashqueue_class": None}), "source": DotDict({"crashstorage_class": FakeStorageSource}), "destination": DotDict({"crashstorage_class": None}), "producer_consumer": DotDict({ "producer_consumer_class": ThreadedTaskManager, "logger": MagicMock(), "number_of_threads": 1, "maximum_queue_size": 1, }), }) fts_app = FetchTransformSaveApp(config) with pytest.raises(TypeError): fts_app.main()