Esempio n. 1
0
 def test_mower_information(self):
     mower = Mower(
         smart_system=SmartSystemFixture.get_smart_system_fixture(),
         location=LocationFixture.get_location_fixture(),
     )
     mower.update_information(device_mower_return)
     assert mower.id == device_mower_return["id"]
     assert mower.name == device_mower_return["name"]
     # XXX : no description for mower ?
     # assert mower.description == device_mower_return["description"]
     assert mower.category == device_mower_return["category"]
     assert (
         mower.is_configuration_synchronized
         == device_mower_return["configuration_synchronized"]
     )
     assert mower.serial_number == "12345678"
     assert mower.version == "3-2.4.7-1.2.0-4380-MODIFIED-ICD1.16_1.2.0"
     assert mower.last_time_online == "2016-07-21T13:28:48Z"
     assert mower.battery_level == 100
     assert mower.battery_status == "ok"
     assert not mower.battery_charging
     assert mower.radio_quality == 50
     assert mower.radio_connection_status == "status_device_unreachable"
     assert mower.radio_state == "good"
     assert mower.internal_temperature == 32
     assert mower.mower_status == "off_disabled"
     assert not mower.mower_manual_operation
     assert mower.mower_timestamp_next_start == "2016-07-22T08:00:00.000000001Z"
     assert mower.sgtin == "3034F8EE90060080000020F6"
     assert mower.manufacturer == "Gardena"
 def test_water_control_information(self):
     water_control = WaterControl(
         smart_system=SmartSystemFixture.get_smart_system_fixture(),
         location=LocationFixture.get_location_fixture(),
     )
     water_control.update_information(device_water_control_return)
     assert water_control.id == device_water_control_return["id"]
     assert water_control.name == device_water_control_return["name"]
     # XXX : no description for water_control ?
     # assert water_control.description == device_water_control_return["description"]
     assert water_control.category == device_water_control_return[
         "category"]
     assert (water_control.is_configuration_synchronized ==
             device_water_control_return["configuration_synchronized"])
     assert water_control.serial_number == "12345678"
     assert water_control.version == "0.3.5-2.5.2-1.2.5-ICD1.17_1.0.20"
     assert water_control.last_time_online == "2019-01-03T23:25:56.050Z"
     assert water_control.device_state == "ok"
     assert water_control.battery_level == 97
     assert water_control.battery_status == "ok"
     assert water_control.radio_quality == 100
     assert water_control.radio_connection_status == "unknown"
     assert water_control.radio_state == "good"
     assert water_control.ambient_temperature == 22
     assert water_control.frost_warning == "no_frost"
     assert water_control.firmware_status == "up_to_date"
     assert water_control.firmware_upload_progress == 0
     assert water_control.firmware_update_start
     assert not water_control.watering_valve_open
     assert water_control.watering_manual_override == "inactive"
     assert water_control.sgtin == "3034F8EE90126D4000004D54"
     assert water_control.manufacturer == "Gardena"
     assert water_control.firmware_available_version == ""
Esempio n. 3
0
 def test_sensor_get_all_info(self):
     sensor = Sensor(
         smart_system=SmartSystemFixture.get_smart_system_fixture(),
         location=LocationFixture.get_location_fixture(),
     )
     sensor.update_information(device_sensor_return)
     info = sensor.get_all_info()
     assert info["id"] == device_sensor_return["id"]
     assert info["name"] == device_sensor_return["name"]
     # XXX : no description for sensor ?
     # assert info["description"] == device_sensor_return["description"]
     assert info["category"] == device_sensor_return["category"]
     assert (info["is_configuration_synchronized"] ==
             device_sensor_return["configuration_synchronized"])
     assert info["serial_number"] == "12345678"
     assert info["version"] == "1.0.3-2.5.2-1.2.5-ICD1.17_1.0.18"
     assert info["last_time_online"] == "2019-01-03T23:57:34.549Z"
     assert info["device_state"] == "ok"
     assert info["battery_level"] == 97
     assert info["battery_status"] == "ok"
     assert info["radio_quality"] == 90
     assert info["radio_connection_status"] == "unknown"
     assert info["radio_state"] == "good"
     assert info["ambient_temperature"] == 22
     assert info["frost_warning"] == "no_frost"
     assert info["sensor_soil_temperature"] == 22
     assert info["sensor_soil_humidity"] == 0
     assert info["sensor_light"] == 0
     assert info["firmware_status"] == "up_to_date"
     assert info["firmware_upload_progress"] == 0
     assert info["firmware_update_start"]
     assert info["sgtin"] == "3034F8EE9012674000006F2E"
     assert info["manufacturer"] == "Gardena"
     assert info["firmware_available_version"] == ""
Esempio n. 4
0
 def setup_method(self, method):
     self.smart_system_test_info = SmartSystemFixture.get_smart_system_fixture()
     api_mock = GardenaApiMock()
     self.m_sessions = api_mock.register_sessions()
     self.m_locations = api_mock.register_locations()
     self.m_devices = api_mock.register_devices()
     api_mock.mount(self.smart_system_test_info)
     self.smart_system_test_info.authenticate()
Esempio n. 5
0
 def test_start_override_timer(self):
     smart_system = SmartSystemFixture.get_smart_system_fixture()
     mock = self.create_mock(smart_system)
     smart_system.authenticate()
     smart_system.update_locations()
     location = smart_system.locations["1c8b301f-22c8-423d-1b4d-ec25315d1377"]
     m_result = mock.register_mower_command(
         "e3c1b615-7351-25fc-a551-1908254a2b3e",
         "1c8b301f-22c8-423d-1b4d-ec25315d1377",
     )
     mower = Mower(smart_system=smart_system, location=location)
     mower.update_information(device_mower_return)
     mower.start_override_timer()
     assert m_result.call_count == 1
Esempio n. 6
0
 def test_refresh_soil_moisture(self):
     smart_system = SmartSystemFixture.get_smart_system_fixture()
     mock = self.create_mock(smart_system)
     smart_system.authenticate()
     smart_system.update_locations()
     location = smart_system.locations[
         "1c8b301f-22c8-423d-1b4d-ec25315d1377"]
     m_result = mock.register_device_sensor_humidity_refresh_command(
         "a130596e-6627-4030-aea5-b6d2f24d0e03",
         "1c8b301f-22c8-423d-1b4d-ec25315d1377",
     )
     sensor = Sensor(smart_system=smart_system, location=location)
     sensor.update_information(device_sensor_return)
     sensor.refresh_soil_moisture()
     assert m_result.call_count == 1
Esempio n. 7
0
 def test_power_off(self):
     smart_system = SmartSystemFixture.get_smart_system_fixture()
     mock = self.create_mock(smart_system)
     smart_system.authenticate()
     smart_system.update_locations()
     location = smart_system.locations[
         "1c8b301f-22c8-423d-1b4d-ec25315d1377"]
     m_result = mock.register_power_command(
         "c6e981e9-8ec6-438f-b400-c720d7f313c8",
         "1c8b301f-22c8-423d-1b4d-ec25315d1377",
     )
     power = Power(smart_system=smart_system, location=location)
     power.update_information(device_power_return)
     power.power_off()
     assert m_result.call_count == 1
 def test_close_valve(self):
     smart_system = SmartSystemFixture.get_smart_system_fixture()
     mock = self.create_mock(smart_system)
     smart_system.authenticate()
     smart_system.update_locations()
     location = smart_system.locations[
         "1c8b301f-22c8-423d-1b4d-ec25315d1377"]
     m_result = mock.register_device_water_control_open__close_valve_command(
         "d6259669-3241-488c-a88e-bcf3a07a58bf",
         "1c8b301f-22c8-423d-1b4d-ec25315d1377",
     )
     water_control = WaterControl(smart_system=smart_system,
                                  location=location)
     water_control.update_information(device_water_control_return)
     water_control.close_valve()
     assert m_result.call_count == 1
Esempio n. 9
0
 def test_power_information(self):
     smart_system_fixture = SmartSystemFixture.get_smart_system_fixture()
     power = Power(
         smart_system=smart_system_fixture,
         location=LocationFixture.get_location_fixture(),
     )
     power.update_information(device_power_return)
     assert power.id == device_power_return["id"]
     assert power.name == device_power_return["name"]
     assert power.category == device_power_return["category"]
     assert (power.is_configuration_synchronized ==
             device_power_return["configuration_synchronized"])
     assert power.serial_number == "87654321"
     assert power.version == "0.0.1-2.5.2-1.2.6-ICD1.17_1.0.1"
     assert power.last_time_online == "2019-01-15T23:49:04.331Z"
     assert power.device_state == "ok"
     assert power.sgtin == "3034F8EE902273C000000A52"
     assert power.manufacturer == "Gardena"
     assert power.power_timer == "off"
     assert power.power_error == "ok"
Esempio n. 10
0
 def test_power_get_all_info(self):
     smart_system_fixture = SmartSystemFixture.get_smart_system_fixture()
     power = Power(
         smart_system=smart_system_fixture,
         location=LocationFixture.get_location_fixture(),
     )
     power.update_information(device_power_return)
     info = power.get_all_info()
     assert info["id"] == device_power_return["id"]
     assert info["name"] == device_power_return["name"]
     assert info["category"] == device_power_return["category"]
     assert (info["is_configuration_synchronized"] ==
             device_power_return["configuration_synchronized"])
     assert info["serial_number"] == "87654321"
     assert info["version"] == "0.0.1-2.5.2-1.2.6-ICD1.17_1.0.1"
     assert info["last_time_online"] == "2019-01-15T23:49:04.331Z"
     assert info["device_state"] == "ok"
     assert info["sgtin"] == "3034F8EE902273C000000A52"
     assert info["manufacturer"] == "Gardena"
     assert info["power_timer"] == "off"
     assert info["power_error"] == "ok"
Esempio n. 11
0
 def test_gateway_information(self):
     smart_system_fixture = SmartSystemFixture.get_smart_system_fixture()
     gateway = Gateway(
         smart_system=smart_system_fixture,
         location=LocationFixture.get_location_fixture(),
     )
     gateway.update_information(device_gateway_return)
     assert gateway.id == device_gateway_return["id"]
     assert gateway.name == device_gateway_return["name"]
     assert gateway.description == device_gateway_return["description"]
     assert gateway.category == device_gateway_return["category"]
     assert (gateway.is_configuration_synchronized ==
             device_gateway_return["configuration_synchronized"])
     assert gateway.serial_number == "12345678"
     assert gateway.version == "1.2.1"
     assert gateway.last_time_online == "N/A"
     assert gateway.ip_address == "192.168.1.217"
     assert gateway.timezone == "Europe/Vienna (CEST, +0200)"
     assert gateway.device_state == "ok"
     assert gateway.sgtin == "N/A"
     assert gateway.manufacturer == "Seluxit"
Esempio n. 12
0
 def test_gateway_get_all_info(self):
     smart_system_fixture = SmartSystemFixture.get_smart_system_fixture()
     gateway = Gateway(
         smart_system=smart_system_fixture,
         location=LocationFixture.get_location_fixture(),
     )
     gateway.update_information(device_gateway_return)
     info = gateway.get_all_info()
     assert info["id"] == device_gateway_return["id"]
     assert info["name"] == device_gateway_return["name"]
     assert info["description"] == device_gateway_return["description"]
     assert info["category"] == device_gateway_return["category"]
     assert (info["is_configuration_synchronized"] ==
             device_gateway_return["configuration_synchronized"])
     assert info["serial_number"] == "12345678"
     assert info["version"] == "1.2.1"
     assert info["last_time_online"] == "N/A"
     assert info["ip_address"] == "192.168.1.217"
     assert info["timezone"] == "Europe/Vienna (CEST, +0200)"
     assert info["device_state"] == "ok"
     assert info["sgtin"] == "N/A"
     assert info["manufacturer"] == "Seluxit"
Esempio n. 13
0
def get_location_fixture(
        smart_system=SmartSystemFixture.get_smart_system_fixture()):
    return Location(smart_system=smart_system)