Skip to content

Commit

Permalink
activate mock again
Browse files Browse the repository at this point in the history
  • Loading branch information
dtrai2 committed Dec 6, 2024
1 parent e37c274 commit 80270f4
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/unit/connector/test_http_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,6 @@ def create_credentials(tmp_path):

class TestHttpConnector(BaseInputTestCase):

def setup_method(self):
# ThreadingHTTPServer.start = mock.MagicMock()
HttpInput.messages = ThrottlingQueue(
ctx=multiprocessing.get_context(), maxsize=self.CONFIG.get("message_backlog_size")
)
super().setup_method()
self.object.pipeline_index = 1
self.object.setup()
self.target = self.object.target
self.client = testing.TestClient(self.object.app)

CONFIG: dict = {
"type": "http_input",
"message_backlog_size": 100,
Expand All @@ -90,11 +79,22 @@ def setup_method(self):
"logprep_number_of_http_requests",
]

def setup_method(self):
ThreadingHTTPServer.start = mock.MagicMock()
HttpInput.messages = ThrottlingQueue(
ctx=multiprocessing.get_context(), maxsize=self.CONFIG.get("message_backlog_size")
)
super().setup_method()
self.object.pipeline_index = 1
self.object.setup()
self.target = self.object.target
self.client = testing.TestClient(self.object.app)

def teardown_method(self):
while not self.object.messages.empty():
self.object.messages.get(timeout=0.001)
self.object.shut_down()
# ThreadingHTTPServer.start = original_thread_start
ThreadingHTTPServer.start = original_thread_start

def test_create_connector(self):
assert isinstance(self.object, HttpInput)
Expand Down

0 comments on commit 80270f4

Please sign in to comment.