Skip to content

Commit

Permalink
update test to properly test add_attachment_content method (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
mochic authored Jul 25, 2024
1 parent 621991f commit 172a667
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2
8 changes: 5 additions & 3 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class TestSlimsClient(unittest.TestCase):
example_fetch_mouse_response: list[Record]
example_fetch_user_response: list[Record]
example_fetch_attachment_response: list[Record]
example_add_attachments_response_text = str
example_add_attachments_response_text: str

@classmethod
def setUpClass(cls):
Expand Down Expand Up @@ -284,17 +284,19 @@ def test_fetch_attachment_content(self, mock_get: MagicMock):
def test_add_attachment_content(self, mock_post: MagicMock):
"""Tests add_attachment_content method success."""
mock_response = MagicMock()
mock_response.text.return_value = self.example_add_attachments_response_text
mock_response.text = self.example_add_attachments_response_text
mock_post.return_value = mock_response
unit_pk = 1
self.example_client.add_attachment_content(
result = self.example_client.add_attachment_content(
SlimsUnit(
unit_name="test",
unit_pk=unit_pk,
),
"test",
"some test content",
)
self.assertEqual(
result, int(self.example_add_attachments_response_text))
self.assertEqual(mock_post.call_count, 1)
self.assertEqual(
mock_post.mock_calls[0].kwargs["body"]["atln_recordPk"], unit_pk
Expand Down

0 comments on commit 172a667

Please sign in to comment.