def test_get_details_devices(): user_manager = Users() user_data = user_manager.get_user_details("3") assert type(user_data) == dict assert user_data["name"] == "Lucas Fernandez" assert 'alerts' in user_data assert 'devices' in user_data
def test_update_status_user(): new_status = 1 user_id = "3" user_manager = Users() user_data = user_manager.get_user_details(user_id) old_status = user_data['status'] ok = user_manager.update_user_status(user_id, new_status) assert ok user_new_data = user_manager.get_user_details(user_id) assert str(user_new_data['status']) == str(new_status) ok = user_manager.update_user_status(user_id, old_status) assert ok
def update_status_user(id_user): status = request.args.get('status') user_endpoint = Users() ok = user_endpoint.update_user_status(id_user, status) return jsonify({"status": ok})
def get_info_user(id_user): user_endpoint = Users() user_data = user_endpoint.get_user_details(id_user) return jsonify(user_data)
def get_users(): max_count = request.args.get('number') users_endpoint = Users() users_data = users_endpoint.get_list_users(max_count) return jsonify(users_data)
def test_get_all_users_limit(): user_manager = Users() list_data = user_manager.get_list_users(max_count=1) assert len(list_data) == 1 assert type(list_data[0]["_source"]) == dict
def test_get_all_users(): user_manager = Users() list_data = user_manager.get_list_users() assert len(list_data) > 0 assert type(list_data[0]["_source"]) == dict