Exemplo n.º 1
0
 def test_get_all_powers(self):
     smart_system = SmartSystem(email="*****@*****.**", password="******")
     api_mock = GardenaApiMock()
     api_mock.register_sessions()
     api_mock.register_two_locations()
     m_devices = api_mock.register_devices()
     m_devices_2 = api_mock.register_second_location_devices()
     api_mock.mount(smart_system)
     smart_system.authenticate()
     smart_system.update_locations()
     smart_system.update_all_devices()
     assert len(smart_system.get_all_powers()) == 2
     assert (smart_system.locations["1c8b301f-22c8-423d-1b4d-ec25315d1377"].
             id == location_return["id"])
     assert (smart_system.locations["1c8b301f-22c8-423d-1b4d-ec25315d1377"].
             powers["c6e981e9-8ec6-438f-b400-c720d7f313c8"].name == "Power")
     assert (smart_system.locations["1c8b301f-22c8-423d-1b4d-ec25315d1378"].
             id == location_return_two["id"])
     assert (
         smart_system.locations["1c8b301f-22c8-423d-1b4d-ec25315d1378"].
         powers["c6e981e9-8ec6-438f-b400-c720d7f313c9"].name == "Power 2")
     assert m_devices.call_count == 1
     assert m_devices_2.call_count == 1
Exemplo n.º 2
0
 def test_get_all_mowers(self):
     smart_system = SmartSystem(email="*****@*****.**", password="******")
     api_mock = GardenaApiMock()
     api_mock.register_sessions()
     api_mock.register_two_locations()
     m_devices = api_mock.register_devices()
     m_devices_2 = api_mock.register_second_location_devices()
     api_mock.mount(smart_system)
     smart_system.authenticate()
     smart_system.update_locations()
     smart_system.update_all_devices()
     assert len(smart_system.get_all_mowers()) == 2
     assert (smart_system.locations["1c8b301f-22c8-423d-1b4d-ec25315d1377"].
             id == location_return["id"])
     assert (smart_system.locations["1c8b301f-22c8-423d-1b4d-ec25315d1377"].
             mowers["e3c1b615-7351-25fc-a551-1908254a2b3e"].name == "Rosi")
     assert (smart_system.locations["1c8b301f-22c8-423d-1b4d-ec25315d1378"].
             id == location_return_two["id"])
     assert (
         smart_system.locations["1c8b301f-22c8-423d-1b4d-ec25315d1378"].
         mowers["e3c1b615-7351-25fc-a551-1908254a2b3f"].name == "Rosi 2")
     assert m_devices.call_count == 1
     assert m_devices_2.call_count == 1
Exemplo n.º 3
0
 def test_get_all_water_controls(self):
     smart_system = SmartSystem(email="*****@*****.**", password="******")
     api_mock = GardenaApiMock()
     api_mock.register_sessions()
     api_mock.register_two_locations()
     m_devices = api_mock.register_devices()
     m_devices_2 = api_mock.register_second_location_devices()
     api_mock.mount(smart_system)
     smart_system.authenticate()
     smart_system.update_locations()
     smart_system.update_all_devices()
     assert len(smart_system.get_all_water_controls()) == 2
     assert (smart_system.locations["1c8b301f-22c8-423d-1b4d-ec25315d1377"].
             id == location_return["id"])
     assert (smart_system.locations["1c8b301f-22c8-423d-1b4d-ec25315d1377"].
             water_controls["d6259669-3241-488c-a88e-bcf3a07a58bf"].name ==
             "Water Control")
     assert (smart_system.locations["1c8b301f-22c8-423d-1b4d-ec25315d1378"].
             id == location_return_two["id"])
     assert (smart_system.locations["1c8b301f-22c8-423d-1b4d-ec25315d1378"].
             water_controls["d6259669-3241-488c-a88e-bcf3a07a58c0"].name ==
             "Water Control 2")
     assert m_devices.call_count == 1
     assert m_devices_2.call_count == 1
Exemplo n.º 4
0
 def test_get_all_sensors(self):
     smart_system = SmartSystem(email="*****@*****.**", password="******")
     api_mock = GardenaApiMock()
     api_mock.register_sessions()
     api_mock.register_two_locations()
     m_devices = api_mock.register_devices()
     m_devices_2 = api_mock.register_second_location_devices()
     api_mock.mount(smart_system)
     smart_system.authenticate()
     smart_system.update_locations()
     smart_system.update_all_devices()
     assert len(smart_system.get_all_sensors()) == 2
     assert (smart_system.locations["1c8b301f-22c8-423d-1b4d-ec25315d1377"].
             id == location_return["id"])
     assert (
         smart_system.locations["1c8b301f-22c8-423d-1b4d-ec25315d1377"].
         sensors["a130596e-6627-4030-aea5-b6d2f24d0e03"].name == "Sensor")
     assert (smart_system.locations["1c8b301f-22c8-423d-1b4d-ec25315d1378"].
             id == location_return_two["id"])
     assert (
         smart_system.locations["1c8b301f-22c8-423d-1b4d-ec25315d1378"].
         sensors["a130596e-6627-4030-aea5-b6d2f24d0e04"].name == "Sensor 2")
     assert m_devices.call_count == 1
     assert m_devices_2.call_count == 1
Exemplo n.º 5
0
 def test_get_all_gateways(self):
     smart_system = SmartSystem(email="*****@*****.**", password="******")
     api_mock = GardenaApiMock()
     api_mock.register_sessions()
     api_mock.register_two_locations()
     m_devices = api_mock.register_devices()
     m_devices_2 = api_mock.register_second_location_devices()
     api_mock.mount(smart_system)
     smart_system.authenticate()
     smart_system.update_locations()
     smart_system.update_all_devices()
     assert len(smart_system.get_all_gateways()) == 2
     assert (smart_system.locations["1c8b301f-22c8-423d-1b4d-ec25315d1377"].
             id == location_return["id"])
     assert (smart_system.locations["1c8b301f-22c8-423d-1b4d-ec25315d1377"].
             gateways["75cfc1f8-a20c-51d6-c5ea-1b5ecdde80c1"].name ==
             "Gardena Zentrale")
     assert (smart_system.locations["1c8b301f-22c8-423d-1b4d-ec25315d1378"].
             id == location_return_two["id"])
     assert (smart_system.locations["1c8b301f-22c8-423d-1b4d-ec25315d1378"].
             gateways["75cfc1f8-a20c-51d6-c5ea-1b5ecdde80c2"].name ==
             "Gardena Zentrale 2")
     assert m_devices.call_count == 1
     assert m_devices_2.call_count == 1