예제 #1
0
 def test_apply_data_capability():
     """Test apply data."""
     # Arrange
     data = get_json("subscription_capability_get_response.json")
     sub = Subscription()
     # Act
     sub.apply_data(data)
     # Assert
     assert sub.subscription_id == "7bdf5909-57c4-41f3-9089-e520513bd92a"
     assert sub.installed_app_id == INSTALLED_APP_ID
     assert sub.source_type == SourceType.CAPABILITY
     assert sub.location_id == "397678e5-9995-4a39-9d9f-ae6ba310236b"
     assert sub.capability == "switchLevel"
     assert sub.attribute == "*"
     assert sub.value == "*"
     assert sub.state_change_only
     assert sub.subscription_name == "switchLevel_sub"
예제 #2
0
 def test_apply_data_device():
     """Test apply data."""
     # Arrange
     data = get_json("subscription_device_get_response.json")
     sub = Subscription()
     # Act
     sub.apply_data(data)
     # Assert
     assert sub.subscription_id == "498752fd-db87-4a5e-95f5-25a0e412838d"
     assert sub.installed_app_id == INSTALLED_APP_ID
     assert sub.source_type == SourceType.DEVICE
     assert sub.device_id == "64e7f664-5b99-4573-b76d-03be3021dc78"
     assert sub.component_id == "*"
     assert sub.capability == "*"
     assert sub.attribute == "*"
     assert sub.value == "*"
     assert sub.state_change_only
     assert not sub.subscription_name