NotifyBlueSky() Attachment Checks - Basic
(
mock_get,
mock_post,
bluesky_url,
good_message_response,
good_media_response,
)
| 480 | @patch("requests.post") |
| 481 | @patch("requests.get") |
| 482 | def test_plugin_bluesky_attachments_basic( |
| 483 | mock_get, |
| 484 | mock_post, |
| 485 | bluesky_url, |
| 486 | good_message_response, |
| 487 | good_media_response, |
| 488 | ): |
| 489 | """ |
| 490 | NotifyBlueSky() Attachment Checks - Basic |
| 491 | """ |
| 492 | |
| 493 | mock_get.return_value = good_message_response |
| 494 | mock_post.side_effect = [ |
| 495 | good_message_response, |
| 496 | good_media_response, |
| 497 | good_message_response, |
| 498 | ] |
| 499 | |
| 500 | # Create application objects. |
| 501 | obj = Apprise.instantiate(bluesky_url) |
| 502 | attach = AppriseAttachment(os.path.join(TEST_VAR_DIR, "apprise-test.gif")) |
| 503 | |
| 504 | # Send our notification |
| 505 | assert ( |
| 506 | obj.notify( |
| 507 | body="body", |
| 508 | title="title", |
| 509 | notify_type=NotifyType.INFO, |
| 510 | attach=attach, |
| 511 | ) |
| 512 | is True |
| 513 | ) |
| 514 | |
| 515 | # Verify API calls. |
| 516 | assert mock_get.call_count == 2 |
| 517 | assert ( |
| 518 | mock_get.call_args_list[0][0][0] |
| 519 | == "https://public.api.bsky.app/xrpc/com.atproto.identity.resolveHandle" |
| 520 | ) |
| 521 | assert ( |
| 522 | mock_get.call_args_list[1][0][0] |
| 523 | == "https://plc.directory/did:plc:1234" |
| 524 | ) |
| 525 | |
| 526 | assert mock_post.call_count == 3 |
| 527 | assert ( |
| 528 | mock_post.call_args_list[0][0][0] |
| 529 | == "https://example.pds.io/xrpc/com.atproto.server.createSession" |
| 530 | ) |
| 531 | assert ( |
| 532 | mock_post.call_args_list[1][0][0] |
| 533 | == "https://example.pds.io/xrpc/com.atproto.repo.uploadBlob" |
| 534 | ) |
| 535 | assert ( |
| 536 | mock_post.call_args_list[2][0][0] |
| 537 | == "https://example.pds.io/xrpc/com.atproto.repo.createRecord" |
| 538 | ) |
| 539 |
nothing calls this directly
no test coverage detected
searching dependent graphs…