This directory contains integration tests that run against a running UCP Merchant Server instance. These tests are language-agnostic regarding the server implementation (Python, Node.js, etc.) and verify adherence to the UCP specification.
The tests assume a UCP Merchant Server is running and accessible via HTTP. The
server must be started with databases initialized using data from
test_data/flower_shop directory. Instructions to start the servers follow.
NOTE: These instructions assume the commands are executed from the directory containing this README.
uv sync
uv sync --directory ../samples/rest/python/server/
uv sync --directory ../sdk/python/DATABASE_PATH=/tmp/ucp_test
rm -rf ${DATABASE_PATH}
mkdir ${DATABASE_PATH}
uv run --directory ../samples/rest/python/server import_csv.py \
--products_db_path=${DATABASE_PATH}/products.db \
--transactions_db_path=${DATABASE_PATH}/transactions.db \
--data_dir=../../../../conformance/test_data/flower_shopStarting the server:
SIMULATION_SECRET=super-secret-sim-key
MERCHANT_SERVER_PORT=8182
uv run --directory ../samples/rest/python/server server.py \
--products_db_path=${DATABASE_PATH}/products.db \
--transactions_db_path=${DATABASE_PATH}/transactions.db \
--port=${MERCHANT_SERVER_PORT} \
--simulation_secret=${SIMULATION_SECRET} &
MERCHANT_SERVER_PID=$!for test_file in *_test.py; do
uv run ${test_file} \
--server_url=http://localhost:${MERCHANT_SERVER_PORT} \
--simulation_secret=${SIMULATION_SECRET} \
--conformance_input=test_data/flower_shop/conformance_input.json
doneTerminate the server using:
kill ${MERCHANT_SERVER_PID}After running tests, one can examine the database state using the
dump_transactions and dump_log tools:
uv run --directory ../samples/rest/python/server dump_transactions.py \
--transactions_db_path=${DATABASE_PATH}/transactions.dbuv run --directory ../samples/rest/python/server dump_log.py \
--transactions_db_path=${DATABASE_PATH}/transactions.db