307514e3a7115c1ce1eb3b2a343607fa5688b8bb,tests/components/notify/test_apns.py,TestApns,test_send_with_state,#TestApns#Any#,314
Before Change
Test updating an existing device.
send = mock_client.return_value.send_notification
devices_path = self.hass.config.path("test_app_apns.yaml")
with open(devices_path, "w+") as out:
out.write("1234: {name: test device 1, "
"tracking_device_id: tracking123}\n")
out.write("5678: {name: test device 2, "
"tracking_device_id: tracking456}\n")
notify_service = apns.ApnsNotificationService(
self.hass,
"test_app",
"testapp.appname",
False,
"test_app.pem"
)
notify_service.device_state_changed_listener(
"device_tracker.tracking456",
State("device_tracker.tracking456", None),
State("device_tracker.tracking456", "home"))
self.hass.block_till_done()
notify_service.send_message(message="Hello", target="home")
After Change
Test updating an existing device.
send = mock_client.return_value.send_notification
yaml_file = {
1234: {
"name": "test device 1",
"tracking_device_id": "tracking123",
},
5678: {
"name": "test device 2",
"tracking_device_id": "tracking456",
},
}
with patch(
"homeassistant.components.notify.apns.load_yaml_config_file",
Mock(return_value=yaml_file)), \
patch("os.path.isfile", Mock(return_value=True)):
notify_service = apns.ApnsNotificationService(
self.hass,
"test_app",
"testapp.appname",
False,
"test_app.pem"
)
notify_service.device_state_changed_listener(
"device_tracker.tracking456",
State("device_tracker.tracking456", None),
State("device_tracker.tracking456", "home"))
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 10
Instances
Project Name: home-assistant/home-assistant
Commit Name: 307514e3a7115c1ce1eb3b2a343607fa5688b8bb
Time: 2017-03-04
Author: paulus@paulusschoutsen.nl
File Name: tests/components/notify/test_apns.py
Class Name: TestApns
Method Name: test_send_with_state
Project Name: home-assistant/home-assistant
Commit Name: 272539105f949ac28e37adac0474ac28d65256e0
Time: 2016-10-17
Author: rob.capellini@gmail.com
File Name: tests/components/test_init.py
Class Name: TestComponentsCore
Method Name: test_reload_core_with_wrong_conf
Project Name: home-assistant/home-assistant
Commit Name: 272539105f949ac28e37adac0474ac28d65256e0
Time: 2016-10-17
Author: rob.capellini@gmail.com
File Name: tests/components/test_init.py
Class Name: TestComponentsCore
Method Name: test_reload_core_conf