android13/external/autotest/client/common_lib/cros/fake_device_server
liiir1985 7f62dcda9f initial 2024-06-22 20:45:49 +08:00
..
client_lib initial 2024-06-22 20:45:49 +08:00
README initial 2024-06-22 20:45:49 +08:00
__init__.py initial 2024-06-22 20:45:49 +08:00
commands.py initial 2024-06-22 20:45:49 +08:00
commands_unittest.py initial 2024-06-22 20:45:49 +08:00
common.py initial 2024-06-22 20:45:49 +08:00
common_util.py initial 2024-06-22 20:45:49 +08:00
common_util_unittest.py initial 2024-06-22 20:45:49 +08:00
constants.py initial 2024-06-22 20:45:49 +08:00
devices.py initial 2024-06-22 20:45:49 +08:00
devices_unittest.py initial 2024-06-22 20:45:49 +08:00
fail_control.py initial 2024-06-22 20:45:49 +08:00
fake_gcd_helper.py initial 2024-06-22 20:45:49 +08:00
fake_oauth.py initial 2024-06-22 20:45:49 +08:00
meta_handler.py initial 2024-06-22 20:45:49 +08:00
oauth.py initial 2024-06-22 20:45:49 +08:00
registration_tickets.py initial 2024-06-22 20:45:49 +08:00
registration_tickets_unittest.py initial 2024-06-22 20:45:49 +08:00
resource_delegate.py initial 2024-06-22 20:45:49 +08:00
resource_method.py initial 2024-06-22 20:45:49 +08:00
resource_method_unittest.py initial 2024-06-22 20:45:49 +08:00
server.py initial 2024-06-22 20:45:49 +08:00
server_errors.py initial 2024-06-22 20:45:49 +08:00

README

# Copyright 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

A simple web service used by Buffet to test interactions with a
device server. Implements basic functionality for registration, device commands
and state changes.

To start the test server yourself, run server.py. Otherwise, server.py exposes
start_server/stop_server methods.

To test locally:
./server.py

# Register a device.
curl -X POST -d "" http://localhost:8080/registrationTickets
curl -X PATCH  -d '{"userEmail": "me"}' -H "Authorization: Bearer 1/TEST-ME" \
    http://localhost:8080/registrationTickets/<id>
curl -X POST -d "" \
    http://localhost:8080/registrationTickets/<id>/finalize

# List devices
curl -X GET -d "" http://localhost:8080/devices

# Send your device a command.
curl -X POST -d '{"base": { "Reboot": {}}' http://localhost:8080/devices\
  ?deviceId=<device_id>

# Update the status of your command
curl -X PATCH -d '{"state": "done"}' http://localhost:8080/devices/\
    <command_id>

# You can also use the client library avaiable @ client_lib.
# Check out client_lib_test to see how you can use the API.