- api: id: get_token name: get token variables: - user_agent: XXX - device_sn: API_XXX - os_platform: XXX - app_version: XXX request: url: /api/get-token method: POST headers: user_agent: $user_agent device_sn: $device_sn os_platform: $os_platform app_version: $app_version Content-Type: "application/json" device_sn: $device_sn json: sign: ${get_sign($user_agent, $device_sn, $os_platform, $app_version)} validate: - eq: ["status_code", 0] - len_eq: ["content.token", 12] - contains: [{"a": 1, "b": 2}, "a"] - api: id: create_user variables: - user_name: user0 - user_password: "000000" - uid: 9000 - token: XXX request: url: /api/users/$uid method: POST headers: Content-Type: "application/json" device_sn: $device_sn token: $token json: name: $user_name password: $user_password validate: - eq: ["status_code", 201] - api: id: get_user variables: - uid: 9000 - token: XXX request: url: /api/users/$uid method: GET headers: Content-Type: "application/json" device_sn: $device_sn token: $token validate: - eq: ["status_code", 200] - api: id: update_user variables: - user_name: user0 - user_password: "000000" - uid: 9000 - token: XXX request: url: /api/users/$uid method: PUT headers: Content-Type: "application/json" device_sn: $device_sn token: $token json: name: $user_name password: $user_password validate: - eq: ["status_code", 200] - api: id: delete_user variables: - uid: 9000 - token: XXX request: url: /api/users/$uid method: DELETE headers: Content-Type: "application/json" device_sn: $device_sn token: $token validate: - eq: ["status_code", 200] - api: id: get_users variables: - token: XXX request: url: /api/users method: GET headers: Content-Type: "application/json" device_sn: $device_sn token: $token validate: - eq: ["status_code", 200] - api: id: reset_all variables: - token: XXX request: url: /api/reset-all method: GET headers: Content-Type: "application/json" device_sn: $device_sn token: $token validate: - eq: ["status_code", 200] - eq: ["content.success", true] - api: id: get_headers variables: - n_secs: 1 request: url: /headers headers: Content-Type: "application/json" device_sn: $device_sn method: GET setup_hooks: - ${setup_hook_add_kwargs($request)} - ${setup_hook_remove_kwargs($request)} teardown_hooks: - ${teardown_hook_sleep_N_secs($response, $n_secs)} validate: - eq: ["status_code", 200] - contained_by: [content.headers.Host, "${get_httpbin_server()}"]