def check_time_index(input_index, expected_index=None): expected_index = expected_index or input_index n0 = get_notification('Room', 'Room0', 0, input_index[0]) n1 = get_notification('Room', 'Room0', 1, input_index[1]) n2 = get_notification('Room', 'Room0', 2, input_index[2]) send_notifications([n0, n1, n2]) time.sleep(1) # Query r = requests.get(query_1T1E1A(), params={'type': 'Room'}) assert r.status_code == 200, r.text obtained = r.json() # Check Response expected = { 'data': { 'entityId': 'Room0', 'attrName': 'temperature', 'index': expected_index, 'values': [0, 1, 2], } } assert_1T1E1A_response(obtained, expected)
def check_time_index(service, input_index, expected_index=None): expected_index = expected_index or input_index entity_type, entity_id = 'Room', 'Room0' n0 = get_notification(entity_type, entity_id, 0, input_index[0]) n1 = get_notification(entity_type, entity_id, 1, input_index[1]) n2 = get_notification(entity_type, entity_id, 2, input_index[2]) send_notifications(service='', notifications=[n0, n1, n2]) wait_for_insert([entity_type], None, 3) # Query r = requests.get(query_1T1E1A(), params={'type': 'Room'}) assert r.status_code == 200, r.text obtained = r.json() # Check Response expected = { 'entityId': 'Room0', 'entityType': 'Room', 'attrName': 'temperature', 'index': expected_index, 'values': [0, 1, 2] } assert_1T1E1A_response(obtained, expected) delete_entity_type('', 'Room')