Skip to content

Commit

Permalink
Added tests for changing picture frame mats in art mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Farzad E committed May 28, 2022
1 parent 8867c7a commit a0a9963
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion example/art_remove_mats.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# List available mats for displaying art
matte_types = [matte_type for elem in tv.art().get_matte_list() for matte_type in elem.values()]
if target_matte_type not in matte_types:
logging.error('Invalid matte type: {}'.format(target_matte_type))
logging.error('Invalid mat type: {}\nSupported mat types are: %s'.format(target_matte_type), matte_types)
sys.exit(1)

# List the art available on the device
Expand Down
18 changes: 18 additions & 0 deletions tests/test_art.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,21 @@ def test_set_available(connection: Mock) -> None:
connection.send.assert_called_once_with(
'{"method": "ms.channel.emit", "params": {"event": "art_app_request", "to": "host", "data": "{\\"request\\": \\"get_content_list\\", \\"category\\": null, \\"id\\": \\"07e72228-7110-4655-aaa6-d81b5188c219\\"}"}}'
)


def test_change_matte(connection: Mock) -> None:
with patch(
"samsungtvws.art.uuid.uuid4",
return_value="07e72228-7110-4655-aaa6-d81b5188c219",
):
connection.recv.side_effect = [
MS_CHANNEL_CONNECT_SAMPLE,
MS_CHANNEL_READY_SAMPLE,
D2D_SERVICE_MESSAGE_AVAILABLE_SAMPLE,
]
tv_art = SamsungTVArt("127.0.0.1")
tv_art.change_matte("test", "none")

connection.send.assert_called_once_with(
'{"method": "ms.channel.emit", "params": {"event": "art_app_request", "to": "host", "data": "{\\"request\\": \\"change_matte\\", \\"content_id\\": \\"test\\", \\"matte_id\\": \\"none\\", \\"id\\": \\"07e72228-7110-4655-aaa6-d81b5188c219\\"}"}}'
)

0 comments on commit a0a9963

Please sign in to comment.