Skip to content

Commit

Permalink
remove duplicate method
Browse files Browse the repository at this point in the history
  • Loading branch information
shemogumbe committed Sep 10, 2024
1 parent 333d168 commit 69dd264
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
16 changes: 8 additions & 8 deletions src/msgraph_core/requests/batch_response_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ def response(self, request_id: str) -> 'BatchResponseItem':
return response
raise KeyError(f"Response with request ID {request_id} not found.")

def get_response_by_id(self, request_id: str) -> 'BatchResponseItem':
if self._responses is None:
raise ValueError("Responses list is not initialized.")
for response in self._responses:
if response.request_id == request_id:
return response
raise KeyError(f"Response with request ID {request_id} not found.")
# def get_response_by_id(self, request_id: str) -> 'BatchResponseItem':
# if self._responses is None:
# raise ValueError("Responses list is not initialized.")
# for response in self._responses:
# if response.request_id == request_id:
# return response
# raise KeyError(f"Response with request ID {request_id} not found.")

def response_body(self, request_id: str, type: Type[T]) -> Optional[T]:
"""
Expand All @@ -82,7 +82,7 @@ def response_body(self, request_id: str, type: Type[T]) -> Optional[T]:
if not issubclass(type, Parsable):
raise ValueError("Type passed must implement the Parsable interface")

response = self.get_response_by_id(request_id)
response = self.response(request_id)
content_type = response.content_type
if not content_type:
raise RuntimeError("Unable to get content-type header in response item")
Expand Down
7 changes: 0 additions & 7 deletions tests/requests/test_batch_response_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ def test_response_method(batch_response_content):
assert batch_response_content.response("12345") == response_item


def test_get_response_by_id_method(batch_response_content):
response_item = Mock(spec=BatchResponseItem)
response_item.request_id = "12345"
batch_response_content.responses = [response_item]
assert batch_response_content.get_response_by_id("12345") == response_item


def test_response_body_method(batch_response_content):
response_item = Mock(spec=BatchResponseItem)
response_item.request_id = "12345"
Expand Down

0 comments on commit 69dd264

Please sign in to comment.