def test_zone_list_get_with_sensor_filter(self, api_root): excluded_zone = Zone(name='Test Zone Excluded', notes='Zone notes.', key=uuid4()) excluded_zone.save() excluded_sensor = Sensor(guid=uuid4(), name='Test Sensor Excluded', notes='Sensor notes.', zone=excluded_zone, min_value=20, max_value=25, min_value_operator='>=', max_value_operator='<=', state=True, state_last_change_date=datetime.utcnow()) excluded_sensor.save() suffix = 'zones/?sensor_ids={}&format=json'.format(self.sensor.id) response = requests.get(api_root + suffix) data = response.json() assert len(data) > 0 excluded_zone_json = [ x for x in data if x['id'] == str(excluded_zone.id) ] assert len(excluded_zone_json) == 0 excluded_sensor.delete() excluded_zone.delete() zone_json = [x for x in data if int(x['id']) == self.zone.id][0] self._compare_zone_json(self.zone, zone_json)
def test_zone_list_get_with_sensor_filter(self, api_root): excluded_zone = Zone( name='Test Zone Excluded', notes='Zone notes.', key=uuid4() ) excluded_zone.save() excluded_sensor = Sensor( guid=uuid4(), name='Test Sensor Excluded', notes='Sensor notes.', zone=excluded_zone, min_value=20, max_value=25, min_value_operator='>=', max_value_operator='<=', state=True, state_last_change_date=datetime.utcnow() ) excluded_sensor.save() suffix = 'zones/?sensor_ids={}&format=json'.format(self.sensor.id) response = requests.get(api_root + suffix) data = response.json() assert len(data) > 0 excluded_zone_json = [x for x in data if x['id'] == str(excluded_zone.id)] assert len(excluded_zone_json) == 0 excluded_sensor.delete() excluded_zone.delete() zone_json = [x for x in data if int(x['id']) == self.zone.id][0] self._compare_zone_json(self.zone, zone_json)
def test_zone_list_get_with_zone_filter(self, api_root): excluded_zone = Zone(name='Test Zone Excluded', notes='Zone notes.', key=uuid4()) excluded_zone.save() suffix = 'zones/?zone_ids={}&format=json'.format(self.zone.id) response = requests.get(api_root + suffix) data = response.json() assert len(data) > 0 excluded_zone_json = [ x for x in data if x['id'] == str(excluded_zone.id) ] assert len(excluded_zone_json) == 0 excluded_zone.delete() zone_json = [x for x in data if int(x['id']) == self.zone.id][0] self._compare_zone_json(self.zone, zone_json)
def test_zone_list_get_with_zone_filter(self, api_root): excluded_zone = Zone( name='Test Zone Excluded', notes='Zone notes.', key=uuid4() ) excluded_zone.save() suffix = 'zones/?zone_ids={}&format=json'.format(self.zone.id) response = requests.get(api_root + suffix) data = response.json() assert len(data) > 0 excluded_zone_json = [x for x in data if x['id'] == str(excluded_zone.id)] assert len(excluded_zone_json) == 0 excluded_zone.delete() zone_json = [x for x in data if int(x['id']) == self.zone.id][0] self._compare_zone_json(self.zone, zone_json)