diff --git a/tests/unit/connector/test_dummy_input.py b/tests/unit/connector/test_dummy_input.py index 6196d4a4d..85973e656 100644 --- a/tests/unit/connector/test_dummy_input.py +++ b/tests/unit/connector/test_dummy_input.py @@ -24,13 +24,17 @@ def test_fails_with_disconnected_error_if_input_was_empty(self): self.object.get_next(self.timeout) def test_returns_documents_in_order_provided(self): - self.object._config.documents = [{"order": 0}, {"order": 1}, {"order": 2}] + config = copy.deepcopy(self.CONFIG) + config["documents"] = [{"order": 0}, {"order": 1}, {"order": 2}] + self.object = Factory.create({"Test Instance Name": config}) for order in range(0, 3): event, _ = self.object.get_next(self.timeout) assert event.get("order") == order def test_raises_exceptions_instead_of_returning_them_in_document(self): - self.object._config.documents = [{"order": 0}, DummyError, {"order": 1}] + config = copy.deepcopy(self.CONFIG) + config["documents"] = [{"order": 0}, DummyError, {"order": 1}] + self.object = Factory.create({"Test Instance Name": config}) event, _ = self.object.get_next(self.timeout) assert event.get("order") == 0 with raises(DummyError): @@ -39,15 +43,17 @@ def test_raises_exceptions_instead_of_returning_them_in_document(self): assert event.get("order") == 1 def test_raises_exceptions_instead_of_returning_them(self): - self.object._config.documents = [BaseException] + config = copy.deepcopy(self.CONFIG) + config["documents"] = [BaseException] + self.object = Factory.create({"Test Instance Name": config}) with raises(BaseException): self.object.get_next(self.timeout) def test_repeat_documents_repeats_documents(self): config = copy.deepcopy(self.CONFIG) config["repeat_documents"] = True + config["documents"] = [{"order": 0}, {"order": 1}, {"order": 2}] connector = Factory.create(configuration={"Test Instance Name": config}) - connector._config.documents = [{"order": 0}, {"order": 1}, {"order": 2}] for order in range(0, 9): event, _ = connector.get_next(self.timeout)