diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 10041feb7..23fdcb866 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -22,7 +22,7 @@ # 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, # 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster # -# Note: this ARG is overwritten by the value in docker-compose.yml. +# Note: this ARG is overwritten by the value in compose.yaml. ARG VARIANT=3-bullseye FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT} @@ -31,7 +31,7 @@ ENV PYTHONUNBUFFERED 1 # [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 # -# Note: this ARG is overwritten by the value in docker-compose.yml. +# Note: this ARG is overwritten by the value in compose.yaml. ARG NODE_VERSION="none" RUN if [ "${NODE_VERSION}" != "none" ]; then \ su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && \ @@ -45,13 +45,12 @@ RUN if [ "${NODE_VERSION}" != "none" ]; then \ RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - - # Add the Yarn package repository to APT sources - RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list - - # Update APT package lists and install required packages - RUN sudo apt-get update && \ - sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \ - postgresql-contrib \ - default-jre \ - libasound2 libgconf-2-4 libgtk-3-dev libnotify-dev libnss3 libxss1 xvfb - +# Add the Yarn package repository to APT sources +RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list + +# Update APT package lists and install required packages +RUN sudo apt-get update && \ + sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \ + postgresql-contrib \ + default-jre \ + libasound2 libgconf-2-4 libgtk-3-dev libnotify-dev libnss3 libxss1 xvfb build-essential python3-dev cython3 chromium diff --git a/.devcontainer/config/api/dotenv b/.devcontainer/config/api/dotenv index 79ef723e9..8fd4dc7dd 100644 --- a/.devcontainer/config/api/dotenv +++ b/.devcontainer/config/api/dotenv @@ -180,3 +180,22 @@ DATABASE_NAME=postgres SQLALCHEMY_POOL_SIZE=10 SQLALCHEMY_MAX_OVERFLOW=20 SQLALCHEMY_ECHO=False + +############################# JWT Config Variables ############################ + +JWT_OIDC_AUDIENCE=theq-queue-management-api +JWT_OIDC_WELL_KNOWN_CONFIG=http://localhost:8085/auth/realms/servicebc-local/.well-known/openid-configuration + +########################## Exam Management Variables ########################## +#BCMP_BASE_URL= +#BCMP_AUTH_TOKEN= +#BCMP_USER= +#MINIO_ACCESS_KEY= +#MINIO_HOST= +#MINIO_BUCKET= +#MINIO_USE_SECURE='1' +#MINIO_SECRET_KEY= + +############################## Notifications Variables ######################## +NOTIFICATIONS_ENDPOINT=http://localhost:5002/api/v1/notifications/sms +NOTIFICATIONS_EMAIL_ENDPOINT=http://localhost:5002/api/v1/notifications/email diff --git a/.devcontainer/config/appointment-frontend/dotenv.local b/.devcontainer/config/appointment-frontend/dotenv.local new file mode 100644 index 000000000..708b567ab --- /dev/null +++ b/.devcontainer/config/appointment-frontend/dotenv.local @@ -0,0 +1,3 @@ +VUE_APP_PATH=/ +VUE_APP_GOOGLE_STATIC_MAP_API_KEY=replace_key_here +VUE_APP_ROOT_API=http://localhost:5000/api/v1 diff --git a/.devcontainer/config/appointment-frontend/public/config/configuration.json b/.devcontainer/config/appointment-frontend/public/config/configuration.json new file mode 100644 index 000000000..bf5e3a8b3 --- /dev/null +++ b/.devcontainer/config/appointment-frontend/public/config/configuration.json @@ -0,0 +1,15 @@ +{ + "KEYCLOAK_CONFIG_URL": "./public/config/kc/keycloak-public.json", + "VUE_APP_ROOT_API": "http://localhost:5000/api/v1", + "hideBCServicesCard": false, + "BCEIDRegistrationUrl": "", + "BCServicesCardUrl": "", + "disableSms": false, + "VUE_APP_FEEDBACK_API": "http://localhost:5001/api/v1", + "FEEDBACK_SERVICE_CHANNEL": "online", + "FEEDBACK_ENABLED": true, + "VUE_APP_HEADER_MSG": "Unlinked Text {link}Link 1 Text{link} Unlinked Text {link}Link 2 Text{link} Unlinked Text {link}Link 3 Text", + "VUE_APP_HEADER_LINKS": "https://example.com/link1{link}https://example.com/link2{link}https://example.com/link3", + "VUE_APP_FOOTER_MSG": "Unlinked Text {link}Link 1 Text{link} Unlinked Text {link}Link 2 Text{link} Unlinked Text {link}Link 3 Text", + "VUE_APP_FOOTER_LINKS": "https://example.com/link1{link}https://example.com/link2{link}https://example.com/link3" +} diff --git a/.devcontainer/config/appointment-frontend/public/config/kc/keycloak-public.json b/.devcontainer/config/appointment-frontend/public/config/kc/keycloak-public.json new file mode 100644 index 000000000..870b14ef5 --- /dev/null +++ b/.devcontainer/config/appointment-frontend/public/config/kc/keycloak-public.json @@ -0,0 +1,8 @@ +{ + "realm": "servicebc-local", + "auth-server-url": "http://localhost:8085/auth", + "ssl-required": "external", + "resource": "theq-appointment-frontend", + "public-client": "true", + "confidential-port": 0 +} diff --git a/.devcontainer/config/frontend/public/static/keycloak/keycloak.json b/.devcontainer/config/frontend/public/static/keycloak/keycloak.json new file mode 100644 index 000000000..51c903744 --- /dev/null +++ b/.devcontainer/config/frontend/public/static/keycloak/keycloak.json @@ -0,0 +1,8 @@ +{ + "realm": "servicebc-local", + "auth-server-url": "http://localhost:8085/auth", + "ssl-required": "external", + "resource": "theq-frontend", + "public-client": "true", + "confidential-port": 0 +} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f5f79191f..a7c7420fa 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -15,22 +15,46 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, // see the README at: // https://github.com/microsoft/vscode-dev-containers/tree/v0.202.5/containers/python-3-postgres -// Update the VARIANT arg in docker-compose.yml to pick a Python version +// Update the VARIANT arg in compose.yaml to pick a Python version { - "dockerComposeFile": "docker-compose.yml", + "dockerComposeFile": "../compose.yaml", // Add the extensions you want installed when the container is created. - "extensions": [ - "bierner.markdown-preview-github-styles", - "dbaeumer.vscode-eslint", - "github.vscode-pull-request-github", - "ms-python.python", - "ms-python.vscode-pylance", - "mtxr.sqltools", - "mtxr.sqltools-driver-pg", - "octref.vetur", - "sonarsource.sonarlint-vscode" - ], + "customizations": { + "vscode": { + "extensions": [ + "bierner.markdown-preview-github-styles", + "dbaeumer.vscode-eslint", + "github.vscode-pull-request-github", + "ms-python.python", + "ms-python.vscode-pylance", + "ms-python.debugpy", + "mtxr.sqltools", + "mtxr.sqltools-driver-pg", + "octref.vetur", + "sonarsource.sonarlint-vscode", + "charliermarsh.ruff" + ], + "settings": { + "python-envs.terminal.autoActivationType": "shellStartup", + "python.terminal.activateEnvironment": false, + "python.languageServer": "Pylance", + "sonarlint.ls.javaHome": "/usr", + "sqltools.connections": [ + { + "database": "postgres", + "driver": "PostgreSQL", + "name": "Container database", + "password": "postgres", + "port": 5432, + "previewLimit": 50, + "server": "localhost", + "username": "postgres" + } + ] + } + } + }, // Use 'forwardPorts' to make a list of ports inside the container // available locally: "forwardPorts": [ @@ -55,9 +79,13 @@ "label": "Appointments Frontend", "onAutoForward": "silent" }, + "8085": { + "label": "Keycloak", + "onAutoForward": "silent" + }, "10000": { "label": "Xpra (Cypress)", - "onAutoForward": "silent", + "onAutoForward": "silent" } }, // Use 'postCreateCommand' to run commands after the container is created. @@ -66,27 +94,5 @@ // https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode", "service": "app", - // Set *default* container specific settings.json values on container create. - "settings": { - "python.languageServer": "Pylance", - "python.linting.enabled": true, - "python.linting.pylintEnabled": true, - "xxxpython.linting.pylintPath": "/usr/local/py-utils/bin/pylint", - "python.pythonPath": "/usr/local/bin/python", - // "python.testing.pytestPath": "/usr/local/py-utils/bin/pytest", - "sonarlint.ls.javaHome": "/usr/lib/jvm/default-java", - "sqltools.connections": [ - { - "database": "postgres", - "driver": "PostgreSQL", - "name": "Container database", - "password": "postgres", - "port": 5432, - "previewLimit": 50, - "server": "localhost", - "username": "postgres" - } - ] - }, "workspaceFolder": "/workspace" } diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml deleted file mode 100644 index ffb699272..000000000 --- a/.devcontainer/docker-compose.yml +++ /dev/null @@ -1,113 +0,0 @@ -# Copyright 2022 Province of British Columbia -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. - -version: '3.7' - -services: - # The container that contains all the code in the repository, plus the - # installations of Python requirements and Node packages. - app: - build: - args: - # Update 'VARIANT' to pick a version of Python: 3, 3.10, 3.9, 3.8, - # 3.7, 3.6. Append -bullseye or -buster to pin to an OS version. Use - # -bullseye variants on local arm64/Apple Silicon. - # - # Note: Tying ourselves to Python 3.8.8 to match the runtime version - # means that we are tied to old vscode images. We should consider an - # update to the runtime version. The list of versions available is at - # https://hub.docker.com/_/microsoft-vscode-devcontainers - # https://mcr.microsoft.com/v2/vscode/devcontainers/python/tags/list - VARIANT: '0.201.2-3.8' - - # Node.js version to install - NODE_VERSION: '20.11.1' - - context: '..' - - dockerfile: '.devcontainer/Dockerfile' - - # Overrides default command so things don't shut down after the process - # ends. - command: 'sleep infinity' - - environment: - # For container "db". - DATABASE_NAME: 'postgres' - DATABASE_PASSWORD: 'postgres' - - # For container "x11" used by Cypress. - DISPLAY: ':14' - LIBGL_ALWAYS_INDIRECT: '0' - - init: true - - # Runs app on the same network as the database container, allows - # "forwardPorts" in devcontainer.json function. - network_mode: 'service:db' - - volumes: - - 'x11:/tmp/.X11-unix:rw' - - '..:/workspace:cached' - - # Run PostgreSQL as the database used by the API. Keep the version in sync - # with what is used in the runtime deployments. - db: - container_name: queue-management_devcontainer_db_1 - environment: - POSTGRES_DB: 'postgres' - POSTGRES_PASSWORD: 'postgres' - POSTGRES_USER: 'postgres' - - image: 'postgres:13.4' - - restart: 'unless-stopped' - - volumes: - - 'postgres-data:/var/lib/postgresql/data' - -# keycloak: -# environment: -# KEYCLOAK_PASSWORD: 'admin' -# KEYCLOAK_USER: 'admin' -# -# image: 'jboss/keycloak:9.0.3' -# -# ports: -# - '8085:8080' - - # Display X clients (like Cypress) on an X server that uses Xpra to forward - # the display. Set the XPRA_PASSWORD password below and use a browser outside - # Docker to view the clients: - # http://localhost:10000/index.html?encoding=rgb32&password=XPRA_PASSWORD - x11: - environment: - DISPLAY: ':14' - MODE: 'tcp' - XPRA_HTML: 'yes' - XPRA_PASSWORD: 'password' - - image: 'jare/x11-bridge' - - ports: - - '10000:10000' - - restart: 'always' - - volumes: - - 'x11:/tmp/.X11-unix:rw' - -volumes: - postgres-data: - x11: diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh index f5b0ff8c3..fbf68b37f 100644 --- a/.devcontainer/postCreateCommand.sh +++ b/.devcontainer/postCreateCommand.sh @@ -14,161 +14,156 @@ # License for the specific language governing permissions and limitations under # the License. +set -euo pipefail + ############################################################################### -# Functions +# Logging ############################################################################### -COLOR_DEFAULT='\033[0m' -COLOR_FAILURE='\033[0;31m' +LOGDIR=".devcontainer/logs" +LOGFILE="$LOGDIR/error.log" + +if [ ! -d $LOGDIR ]; then + mkdir -p $LOGDIR +fi + +touch $LOGFILE + +# Redirect stderr to both the logfile and terminal using tee +exec 2> >(tee -a $LOGFILE >&2) -# Echo a string in red. -# -# Parameter: string -# echo_failure () { - echo -e "$COLOR_FAILURE$*$COLOR_DEFAULT" + echo "$*" | tee -a "$LOGFILE" >&2 } -# If a configuration file doesn't exist then create a default file. -# -# Parameters: source_file destination_file -# -copy_config () { - SOURCE=$1 - DESTINATION=$2 - - if [ ! -f $SOURCE ]; then - echo_failure configuration source file $(pwd)/$SOURCE is missing - else - if [ -f $DESTINATION ]; then - echo Using pre-existing file $(realpath $DESTINATION) - else - SOURCE=$(realpath $SOURCE) - - DIRECTORY=$(dirname $DESTINATION) - if [ ! -d $DIRECTORY ]; then - echo Creating directory $(pwd)/$DIRECTORY - mkdir -p $DIRECTORY - fi - - echo Copying $SOURCE to $(pwd)/$DESTINATION - cp $SOURCE $DESTINATION +run_setup_local_config () { + /bin/bash scripts/setup-local-config.sh +} + +############################################################################### +# Dependency Installations +############################################################################### + +install_api_deps () { + ( + cd api + export UV_PROJECT_ENVIRONMENT="$(pwd)/.venv" + # Ensure the environment directory is owned by the current user + if [ -d .venv ]; then + sudo chown -R $(id -u):$(id -g) .venv fi - fi + python3 -m pip install --upgrade pip -q + python3 -m pip install uv -q + uv sync --group dev + ) } -# Check that a configuration value is defined in a file. As this only does a -# grep for the key, it is likely to provide false positives for comments, -# substrings of other keys, or keys defined without values. -# -# Parameters: filename key_name -# -check_setting () { - FILENAME=$1 - KEY_NAME=$2 +install_notifications_api_deps () { + ( + cd notifications-api + export UV_PROJECT_ENVIRONMENT="$(pwd)/.venv" + # Ensure the environment directory is owned by the current user + if [ -d .venv ]; then + sudo chown -R $(id -u):$(id -g) .venv + fi + python3 -m pip install --upgrade pip -q + python3 -m pip install uv -q + uv sync --group dev + ) +} - grep "$KEY_NAME" $FILENAME > /dev/null +# If NPM output is piped into a commmand, it does not display any indication of +# progress. Use "script" to make NPM think it is running on a TTY. +install_appointment_frontend_deps () { + ( + cd appointment-frontend + # Ensure the node_modules directory is owned by the current user + if [ -d node_modules ]; then + sudo chown -R $(id -u):$(id -g) node_modules + fi + npm install + npx cypress install + ) +} - if [ $? -ne 0 ]; then - echo_failure Missing configuration key $KEY_NAME in \ - $(realpath $FILENAME) - fi +install_frontend_deps () { + ( + cd frontend + # Ensure the node_modules directory is owned by the current user + if [ -d node_modules ]; then + sudo chown -R $(id -u):$(id -g) node_modules + fi + npm install + ) } -############################################################################### -# Dependency Installations -############################################################################### +get_admin_csr_count () { + local table_exists + local count -# Log the output to make it easier to find when things go wrong. -LOGDIR=.devcontainer/logs -if [ ! -d $LOGDIR ]; then - mkdir $LOGDIR -fi + table_exists=$(PGPASSWORD=postgres psql -h localhost -U postgres -d postgres \ + -tA -c "SELECT to_regclass('public.csr') IS NOT NULL;") -# To save time do the installations in parallel. + if [ "$table_exists" != "t" ]; then + echo_failure "The csr table is missing after migrations; aborting bootstrap." + return 1 + fi -( - cd api - rm -rf env - python -m venv env - source env/bin/activate - python -m pip install --upgrade pip -q - pip install -r requirements_dev.txt --progress-bar off + count=$(PGPASSWORD=postgres psql -h localhost -U postgres -d postgres \ + -tA -c "SELECT COUNT(*) FROM csr WHERE username = 'admin';") - # Install newman so that the postman tests can be run on the command line. - echo Installing newman - cd postman - rm -rf node_modules - npm install newman -) |& tee $LOGDIR/api.log & + case "$count" in + ''|*[!0-9]*) + echo_failure "Unexpected csr count result: '$count'" + return 1 + ;; + esac -# If NPM output is piped into a commmand, it does not display any indication of -# progress. Use "script" to make NPM think it is running on a TTY. -script -fq -c "( - cd appointment-frontend - rm -rf node_modules - npm install - $(npm bin)/cypress install -)" |& tee $LOGDIR/appointment-frontend.log & - -#( -# cd feedback-api -# rm -rf env -# python -m venv env -# source env/bin/activate -# python -m pip install --upgrade pip -q -# pip install -r requirements.txt --progress-bar off -#) |& tee $LOGDIR/feedback-api.log & - -script -fq -c "( - cd frontend - rm -rf node_modules - npm install -)" |& tee $LOGDIR/frontend.log & - -#( -# cd notifications-api -# rm -rf env -# python -m venv env -# source env/bin/activate -# python -m pip install --upgrade pip -q -# pip install -r requirements.txt --progress-bar off -#) |& tee $LOGDIR/notifications-api.log & - -# Wait for all the above to complete. -wait + echo "$count" +} + +echo +run_setup_local_config + +install_api_deps +install_notifications_api_deps +install_appointment_frontend_deps +install_frontend_deps ############################################################################### # Database Bootstrapping and Setup ############################################################################### -( - cd api - source env/bin/activate - python manage.py db upgrade - - # If there is nothing in the CSR table, we're probably starting with a - # clean database and need to bootstrap it with default data. - COUNT=$(PGPASSWORD=postgres psql -h queue-management_devcontainer_db_1 \ - -U postgres -c "SELECT COUNT(*) FROM csr;" -t) - if [ "$COUNT" -eq 0 ]; then - python manage.py bootstrap - python manage.py adduser - fi -) +bootstrap_database () { + ( + cd api + export UV_PROJECT_ENVIRONMENT="$(pwd)/.venv" + local count + + # Bootstrap runs inside the devcontainer, so it needs + # container-reachable Keycloak metadata even though the copied + # local .env remains host-friendly for non-container use. + export JWT_OIDC_WELL_KNOWN_CONFIG="http://keycloak:8080/auth/realms/servicebc-local/.well-known/openid-configuration" + export JWT_OIDC_JWKS_URI="http://keycloak:8080/auth/realms/servicebc-local/protocol/openid-connect/certs" + export JWT_OIDC_ISSUER="http://localhost:8085/auth/realms/servicebc-local" + + uv run python manage.py db upgrade + + # If the default bootstrap admin CSR is missing, we're probably + # starting with a clean database and need to bootstrap it. + uv run python manage.py migrate_db + count=$(get_admin_csr_count) + if [ "$count" -eq 0 ]; then + uv run python manage.py bootstrap + fi + ) +} + +bootstrap_database ############################################################################### -# Configuration Files Setup and Checking +# Configuration Files Setup ############################################################################### echo - -copy_config .devcontainer/config/api/dotenv api/.env -check_setting api/.env JWT_OIDC_AUDIENCE -check_setting api/.env JWT_OIDC_WELL_KNOWN_CONFIG - -copy_config .devcontainer/config/api/client_secrets/secrets.json \ - api/client_secrets/secrets.json - -copy_config .devcontainer/config/frontend/public/config/configuration.json \ - frontend/public/config/configuration.json +run_setup_local_config diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 2dd05100e..0d7a10abe 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,4 +1,2 @@ -# As a security feature, add these people as reviewers if a PR is created for -# anything under .github, including GitHub Actions and this file itself. # Define code owners for the entire repository -* @chrsamp @josekudiyirippil @Rajandeep98 \ No newline at end of file +* @chrsamp @josekudiyirippil @veenupunyani diff --git a/.github/workflows/appointment-booking-ci.yaml b/.github/workflows/appointment-booking-ci.yaml new file mode 100644 index 000000000..dafd400a8 --- /dev/null +++ b/.github/workflows/appointment-booking-ci.yaml @@ -0,0 +1,34 @@ +name: Appointment Booking CI + +on: + workflow_dispatch: + pull_request: + paths: + - 'appointment-booking/**' + - '.github/workflows/appointment-booking-ci.yaml' + +jobs: + quality-checks: + name: Quality Checks + runs-on: ubuntu-latest + + defaults: + run: + working-directory: appointment-booking + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: '22' + cache: 'npm' + cache-dependency-path: appointment-booking/package-lock.json + + - name: Install dependencies + run: npm ci + + - name: Run quality gates + run: npm run ci:check diff --git a/.github/workflows/pull-request-api.yaml b/.github/workflows/pull-request-api.yaml new file mode 100644 index 000000000..7c20cd64b --- /dev/null +++ b/.github/workflows/pull-request-api.yaml @@ -0,0 +1,143 @@ +name: Pull Request Deploy API + +on: + workflow_dispatch: + inputs: + pr-number: + description: "Pull Request Number:" + type: string + required: true + namespace: + description: "Deploy To:" + type: choice + required: true + options: + - The Q Dev + - QMS Dev + - The Q Test + +jobs: + ##### SETUP ################################################################## + + parse-inputs: + name: Prepare deployment inputs + runs-on: ubuntu-latest + outputs: + environment: ${{ steps.parse.outputs.environment }} + image-tag: ${{ steps.parse.outputs.image-tag }} + push-qms: ${{ steps.parse.outputs.push-qms }} + push-theq: ${{ steps.parse.outputs.push-theq }} + ref: ${{ steps.parse.outputs.ref }} + + steps: + - name: Parse Inputs + id: parse + shell: bash + env: + DISPATCH_PR_NUMBER: ${{ inputs['pr-number'] }} + DISPATCH_NAMESPACE: ${{ inputs.namespace }} + run: | + set -euo pipefail + + if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then + TARGET_NAMESPACE="${DISPATCH_NAMESPACE}" + REF="refs/pull/${DISPATCH_PR_NUMBER}/head" + IMAGE_TAG="pr${DISPATCH_PR_NUMBER}" + else + # A push to develop deploys the exact commit that triggered the run. + TARGET_NAMESPACE="The Q Dev" + REF="${GITHUB_SHA}" + IMAGE_TAG="develop-${GITHUB_RUN_NUMBER}" + fi + + ENVIRONMENT=$( + echo "${TARGET_NAMESPACE}" | + awk -F' ' '{print $NF}' | + tr '[:upper:]' '[:lower:]' + ) + + if [[ "${GITHUB_REPOSITORY_OWNER}" != "bcgov" ]]; then + # Never push from forks. + PUSH_QMS=false + PUSH_THEQ=false + elif [[ "${TARGET_NAMESPACE}" == QMS* ]]; then + PUSH_QMS=true + PUSH_THEQ=false + else + PUSH_QMS=false + PUSH_THEQ=true + fi + + echo "Event: ${GITHUB_EVENT_NAME}" + echo "Target namespace: ${TARGET_NAMESPACE}" + echo "Environment: ${ENVIRONMENT}" + echo "Image tag: ${IMAGE_TAG}" + echo "Git ref: ${REF}" + echo "Push QMS: ${PUSH_QMS}" + echo "Push The Q: ${PUSH_THEQ}" + + echo "environment=${ENVIRONMENT}" >> "${GITHUB_OUTPUT}" + echo "image-tag=${IMAGE_TAG}" >> "${GITHUB_OUTPUT}" + echo "push-qms=${PUSH_QMS}" >> "${GITHUB_OUTPUT}" + echo "push-theq=${PUSH_THEQ}" >> "${GITHUB_OUTPUT}" + echo "ref=${REF}" >> "${GITHUB_OUTPUT}" + + ##### BUILD ################################################################## + + queue-management-api: + name: queue-management-api + needs: + - parse-inputs + uses: ./.github/workflows/reusable-build-dockerfile.yaml + secrets: + artifactory-password: ${{ secrets.ARTIFACTORY_PASSWORD }} + artifactory-registry: ${{ secrets.ARTIFACTORY_REGISTRY }} + artifactory-username: ${{ secrets.ARTIFACTORY_USERNAME }} + namespace-theq: ${{ secrets.LICENCE_PLATE_THEQ }}-tools + namespace-theq-password: ${{ secrets.SA_PASSWORD_THEQ_TOOLS }} + namespace-theq-username: ${{ secrets.SA_USERNAME }} + namespace-qms: ${{ secrets.LICENCE_PLATE_QMS }}-tools + namespace-qms-password: ${{ secrets.SA_PASSWORD_QMS_TOOLS }} + namespace-qms-username: ${{ secrets.SA_USERNAME }} + openshift-registry: ${{ secrets.OPENSHIFT_REGISTRY }} + with: + ref: ${{ needs.parse-inputs.outputs.ref }} + directory: api + image-name: queue-management-api + image-tags: ${{ needs.parse-inputs.outputs.image-tag }} + push-qms: ${{ needs.parse-inputs.outputs.push-qms == 'true' }} + push-theq: ${{ needs.parse-inputs.outputs.push-theq == 'true' }} + + ##### DEPLOY ################################################################# + + tag: + name: Tag + if: github.repository_owner == 'bcgov' + needs: + - parse-inputs + - queue-management-api + uses: ./.github/workflows/reusable-tag-image.yaml + secrets: + licence-plate: ${{ needs.parse-inputs.outputs.push-qms == 'true' && secrets.LICENCE_PLATE_QMS || secrets.LICENCE_PLATE_THEQ }} + openshift-api: ${{ secrets.OPENSHIFT_API }} + token: ${{ needs.parse-inputs.outputs.push-qms == 'true' && secrets.SA_PASSWORD_QMS_TOOLS || secrets.SA_PASSWORD_THEQ_TOOLS }} + with: + image-names: queue-management-api + tag-from: ${{ needs.parse-inputs.outputs.image-tag }} + tag-to: ${{ needs.parse-inputs.outputs.environment }} + + wait-for-rollouts: + name: Wait for Rollouts + if: github.repository_owner == 'bcgov' + needs: + - parse-inputs + - tag + uses: ./.github/workflows/reusable-wait-for-rollouts.yaml + secrets: + licence-plate: ${{ needs.parse-inputs.outputs.push-qms == 'true' && secrets.LICENCE_PLATE_QMS || secrets.LICENCE_PLATE_THEQ }} + openshift-api: ${{ secrets.OPENSHIFT_API }} + token: ${{ needs.parse-inputs.outputs.push-qms == 'true' && secrets.SA_PASSWORD_QMS_DEV || (needs.parse-inputs.outputs.environment == 'dev' && secrets.SA_PASSWORD_THEQ_DEV || secrets.SA_PASSWORD_THEQ_TEST) }} + with: + # Kubernetes Deployment name; do not append "-dev" or "-test". + image-names: queue-management-api + tag-to: ${{ needs.parse-inputs.outputs.environment }} diff --git a/.github/workflows/pull-request-appointment.yml b/.github/workflows/pull-request-appointment.yml index bafbf5f08..0e4c86251 100644 --- a/.github/workflows/pull-request-appointment.yml +++ b/.github/workflows/pull-request-appointment.yml @@ -67,29 +67,11 @@ jobs: echo "ref=$REF" >> $GITHUB_OUTPUT - ##### TEST ################################################################### - - appointment-frontend-cypress: - name: Appointment Frontend Cypress - needs: parse-inputs - uses: ./.github/workflows/tyu-reusable-appointment-frontend-cypress.yaml - secrets: - bceid-endpoint: ${{ secrets.CYPRESS_BCEID_ENDPOINT }} - bceid-password: ${{ secrets.CYPRESS_BCEID_PASSWORD }} - bceid-username: ${{ secrets.CYPRESS_BCEID_USERNAME }} - cypress-project-id: ${{ secrets.CYPRESS_PROJECT_ID }} - cypress-record-key: ${{ secrets.CYPRESS_RECORD_KEY }} - keycloak-auth-url: ${{ secrets.KEYCLOAK_AUTH_URL_DEV }}/auth/ - keycloak-client: ${{ secrets.KEYCLOAK_APPOINTMENTS_FRONTEND_CLIENT }} - keycloak-realm: ${{ secrets.KEYCLOAK_REALM }} - with: - ref: ${{ needs.parse-inputs.outputs.ref }} - ##### BUILD ################################################################## appointment-frontend: name: appointment-frontend - needs: [parse-inputs, appointment-frontend-cypress] + needs: [parse-inputs] uses: ./.github/workflows/reusable-build-dockerfile.yaml secrets: artifactory-password: ${{ secrets.ARTIFACTORY_PASSWORD }} diff --git a/.github/workflows/pull-request-deploy-frontend.yaml b/.github/workflows/pull-request-deploy-frontend.yaml index 09fd89c67..be1a93b87 100644 --- a/.github/workflows/pull-request-deploy-frontend.yaml +++ b/.github/workflows/pull-request-deploy-frontend.yaml @@ -111,39 +111,15 @@ jobs: tag-from: ${{ needs.parse-inputs.outputs.image-tag }} tag-to: ${{ needs.parse-inputs.outputs.environment }} - ##### TEST ################################################################### - - # Only run Newman for The Q dev - other environments will fail due to data. - newman-theq-dev: - name: Newman Tests - if: github.event.inputs.namespace == 'The Q Dev' - needs: [parse-inputs,tag] - runs-on: ubuntu-latest - - steps: - - name: Check out - uses: actions/checkout@v2 - - - name: NPM Install - run: | - cd api/postman - npm install newman - - - name: Run Newman Tests - run: | - cd api/postman - node_modules/newman/bin/newman.js run API_Test_TheQ_Booking.json \ - -e postman_env.json \ - --delay-request 250 \ - --global-var 'auth_url=${{ vars.POSTMAN_AUTH_URL_DEV }}' \ - --global-var 'client_secret=${{ secrets.POSTMAN_CLIENT_SECRET_DEV }}' \ - --global-var 'clientid=${{ vars.POSTMAN_CLIENTID_DEV }}' \ - --global-var 'password=${{ secrets.POSTMAN_PASSWORD }}' \ - --global-var 'password_nonqtxn=${{ secrets.POSTMAN_PASSWORD_NONQTXN }}' \ - --global-var 'public_url=${{ vars.POSTMAN_PUBLIC_API_URL_THEQ_DEV }}' \ - --global-var 'public_user_id=${{ vars.POSTMAN_PUBLIC_USERID }}' \ - --global-var 'public_user_password=${{ secrets.POSTMAN_PASSWORD_PUBLIC_USER }}' \ - --global-var 'realm=${{ vars.POSTMAN_REALM }}' \ - --global-var 'url=${{ vars.POSTMAN_API_URL_THEQ_DEV }}' \ - --global-var 'userid=${{ vars.POSTMAN_USERID }}' \ - --global-var 'userid_nonqtxn=${{ vars.POSTMAN_USERID_NONQTXN }}' + wait-for-rollouts: + name: Wait for Rollouts + if: github.repository_owner == 'bcgov' + needs: [parse-inputs, tag] + uses: ./.github/workflows/reusable-wait-for-rollouts.yaml + secrets: + licence-plate: ${{ needs.parse-inputs.outputs.push-qms == 'true' && secrets.LICENCE_PLATE_QMS || secrets.LICENCE_PLATE_THEQ }} + openshift-api: ${{ secrets.OPENSHIFT_API }} + token: ${{ needs.parse-inputs.outputs.push-qms == 'true' && secrets.SA_PASSWORD_QMS_DEV || ( needs.parse-inputs.outputs.environment == 'dev' && secrets.SA_PASSWORD_THEQ_DEV || secrets.SA_PASSWORD_THEQ_TEST ) }} + with: + image-names: appointment-nginx-frontend-${{ needs.parse-inputs.outputs.environment }} + tag-to: ${{ needs.parse-inputs.outputs.environment }} diff --git a/.github/workflows/reusable-tag-image.yaml b/.github/workflows/reusable-tag-image.yaml index 2f0922622..d9e24b6a8 100644 --- a/.github/workflows/reusable-tag-image.yaml +++ b/.github/workflows/reusable-tag-image.yaml @@ -25,6 +25,13 @@ jobs: runs-on: ubuntu-latest steps: + - name: Install OpenShift CLI + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4" + - name: Verify OpenShift CLI + run: oc version --client + - name: Log in to OpenShift tools uses: redhat-actions/oc-login@v1 with: diff --git a/.github/workflows/reusable-wait-for-rollouts.yaml b/.github/workflows/reusable-wait-for-rollouts.yaml index d6287556a..f370816ac 100644 --- a/.github/workflows/reusable-wait-for-rollouts.yaml +++ b/.github/workflows/reusable-wait-for-rollouts.yaml @@ -1,11 +1,14 @@ name: Wait for Rollouts + on: workflow_call: inputs: image-names: + description: Space-separated list of OpenShift Deployment names required: true type: string tag-to: + description: Target environment suffix, such as dev, test, or prod required: true type: string secrets: @@ -22,33 +25,65 @@ jobs: runs-on: ubuntu-latest steps: - - name: Log in to OpenShift ${{ inputs.tag-to }} - uses: redhat-actions/oc-login@v1 - with: - namespace: ${{ secrets.licence-plate }}-${{ inputs.tag-to }} - openshift_server_url: ${{ secrets.openshift-api }} - openshift_token: ${{ secrets.token }} - - - name: Wait for Rollouts - run: | - # - # Parameters: namespace deployment-config - # - wait_for_rollout () { - NAMESPACE_DEPLOY=$1 - DEPLOYMENT_CONFIG=$2 - - STATUS= - while [ "$STATUS" != "Complete" ]; do - VERSION=$(oc -n $NAMESPACE_DEPLOY get deploymentconfig $DEPLOYMENT_CONFIG -o json | jq '.status.latestVersion') - STATUS=$(oc -n $NAMESPACE_DEPLOY rollout history dc/$DEPLOYMENT_CONFIG | grep ^$VERSION | awk '{ print $2 }') - WHEN=$(oc -n $NAMESPACE_DEPLOY get replicationcontroller $DEPLOYMENT_CONFIG-$VERSION --no-headers | awk '{ print $5 }') - - echo "Rollout #$VERSION of $DEPLOYMENT_CONFIG is \"$STATUS\" $WHEN ago" - sleep 1 - done - } + - name: Install OpenShift CLI + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4" + + - name: Verify OpenShift CLI + run: oc version --client + + - name: Log in to OpenShift ${{ inputs.tag-to }} + uses: redhat-actions/oc-login@v1 + with: + namespace: ${{ secrets.licence-plate }}-${{ inputs.tag-to }} + openshift_server_url: ${{ secrets.openshift-api }} + openshift_token: ${{ secrets.token }} + + - name: Wait for Deployment rollouts + shell: bash + run: | + set -euo pipefail + + NAMESPACE_DEPLOY="${{ secrets.licence-plate }}-${{ inputs.tag-to }}" + TAG_TO="${{ inputs.tag-to }}" - for image in ${{ inputs.image-names }}; do - wait_for_rollout ${{ secrets.licence-plate }}-${{ inputs.tag-to }} $image - done + if ! oc auth can-i get deployments.apps -n "${NAMESPACE_DEPLOY}" | grep -qx "yes"; then + echo "ERROR: The logged-in service account cannot get Deployments in ${NAMESPACE_DEPLOY}." + echo "Grant the github-actions service account a suitable role, for example:" + echo "oc adm policy add-role-to-user view -z github-actions -n ${NAMESPACE_DEPLOY}" + exit 1 + fi + + wait_for_rollout() { + local requested_name="$1" + local deployment_name="${requested_name}" + local normalized_name="${requested_name%-${TAG_TO}}" + + # Prefer the supplied name. For backward compatibility, if the + # caller passes a name such as appointment-nginx-frontend-dev, + # also try appointment-nginx-frontend. + if ! oc get deployment "${deployment_name}" \ + -n "${NAMESPACE_DEPLOY}" >/dev/null 2>&1; then + if [[ "${normalized_name}" != "${requested_name}" ]] && \ + oc get deployment "${normalized_name}" \ + -n "${NAMESPACE_DEPLOY}" >/dev/null 2>&1; then + echo "Using Deployment '${normalized_name}' instead of '${requested_name}'." + deployment_name="${normalized_name}" + else + echo "ERROR: Deployment '${requested_name}' was not found in ${NAMESPACE_DEPLOY}." + echo "Available Deployments:" + oc get deployments -n "${NAMESPACE_DEPLOY}" -o name + exit 1 + fi + fi + + echo "Waiting for deployment/${deployment_name} in ${NAMESPACE_DEPLOY}..." + oc rollout status "deployment/${deployment_name}" \ + -n "${NAMESPACE_DEPLOY}" \ + --timeout=10m + } + + for deployment in ${{ inputs.image-names }}; do + wait_for_rollout "${deployment}" + done diff --git a/.gitignore b/.gitignore index a5b6d5e95..7403da480 100644 --- a/.gitignore +++ b/.gitignore @@ -149,7 +149,6 @@ version.GENERATED.ts # Docker -api/Dockerfile frontend/Dockerfile api/init.sh api/wait-for-it.sh @@ -179,4 +178,4 @@ keys-generated # new config stuff /frontend/public/config/configuration.json -/appointment-frontend/public/config/configuration.json \ No newline at end of file +/appointment-frontend/public/config/configuration.json diff --git a/.vscode/launch.json b/.vscode/launch.json index 7c8e5c52c..379618233 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -20,13 +20,33 @@ // Run the components used for the Queue Management system. "name": "Queue Management", "configurations": [ + "appointment_booking_front_end", "appointment_front_end", "queue_management_api", - "queue_management_front_end" + "queue_management_front_end", + "notifications_api" ] } ], "configurations": [ + { + // Run the React SSR front end for the new Appointment Booking application. + "cwd": "${workspaceFolder}/appointment-booking", + "env": { + "API_PROXY_TARGET": "http://localhost:5000" + }, + "name": "appointment_booking_front_end", + "request": "launch", + "runtimeArgs": [ + "run", + "dev" + ], + "runtimeExecutable": "npm", + "skipFiles": [ + "/**" + ], + "type": "node" + }, { // Run the Vue.js front end for the Appointment application. "cwd": "${workspaceFolder}/appointment-frontend", @@ -52,23 +72,21 @@ "type": "node" }, { - // Run the Queue Management API Python gunicorn process. - "args": [ - "wsgi", - "--bind=0.0.0.0:5000", - "--access-logfile=-", - "--config=gunicorn_config.py", - "--reload", - "--timeout=0" // Disable timeout; don't die at breakpoints - ], + // Run the Queue Management API in a single process for reliable debugging. "cwd": "${workspaceFolder}/api", + "env": { + "WSGI_DEBUG": "1", + "WSGI_HOST": "0.0.0.0", + "WSGI_PORT": "5000", + "WSGI_USE_RELOADER": "0" + }, "gevent": true, "name": "queue_management_api", "preLaunchTask": "alembic: upgrade - api", - "program": "env/bin/gunicorn", - "python": "${workspaceFolder}/api/env/bin/python", + "program": "${workspaceFolder}/api/wsgi.py", + "python": "${workspaceFolder}/api/.venv/bin/python", "request": "launch", - "type": "python" + "type": "debugpy" }, { // Run the Vue.js front end for the Queue Management application. @@ -91,6 +109,22 @@ "/**" ], "type": "node" + }, + { + // Run the Notifications API in a single process for reliable debugging. + "cwd": "${workspaceFolder}/notifications-api", + "env": { + "WSGI_DEBUG": "1", + "WSGI_HOST": "0.0.0.0", + "WSGI_PORT": "5002", + "WSGI_USE_RELOADER": "0" + }, + "envFile": "${workspaceFolder}/notifications-api/.env", + "name": "notifications_api", + "program": "${workspaceFolder}/notifications-api/wsgi.py", + "python": "${workspaceFolder}/notifications-api/.venv/bin/python", + "request": "launch", + "type": "debugpy" } ], "version": "0.2.0" diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 07c083ef8..fd6ec9d7d 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -3,7 +3,7 @@ { "args": [ "-c", - "cd ${workspaceFolder}/api; source env/bin/activate; python manage.py db upgrade" + "cd ${workspaceFolder}/api; source .venv/bin/activate; python manage.py db upgrade" ], "command": "bash", "detail": "python manage.py db upgrade", @@ -15,6 +15,36 @@ "reveal": "always", }, "type": "shell" + }, + { + "args": [ + "-c", + "cd ${workspaceFolder}/api; uv run gunicorn wsgi --bind=0.0.0.0:5000 --access-logfile=- --config=gunicorn_config.py --reload --timeout=0" + ], + "command": "bash", + "detail": "uv run gunicorn wsgi --bind=0.0.0.0:5000 --access-logfile=- --config=gunicorn_config.py --reload --timeout=0", + "label": "api: gunicorn hot reload", + "presentation": { + "close": false, + "panel": "new", + "reveal": "always" + }, + "type": "shell" + }, + { + "args": [ + "-c", + "cd ${workspaceFolder}/notifications-api; uv run gunicorn wsgi:application --bind=0.0.0.0:5002 --access-logfile=- --config=gunicorn_config.py --reload --timeout=0" + ], + "command": "bash", + "detail": "uv run gunicorn wsgi:application --bind=0.0.0.0:5002 --access-logfile=- --config=gunicorn_config.py --reload --timeout=0", + "label": "notifications-api: gunicorn hot reload", + "presentation": { + "close": false, + "panel": "new", + "reveal": "always" + }, + "type": "shell" } ], "version": "2.0.0" diff --git a/README.md b/README.md index e8324b673..a2ed0c375 100644 --- a/README.md +++ b/README.md @@ -1,183 +1,348 @@ -[![img](https://img.shields.io/badge/Lifecycle-Stable-97ca00)] -## Queue Managment System - About +# The Q -The Queue Managment System will be used to manage the citizen flow and provide analtyics for our Service BC locations. This system is designed to be used for government offices with a large number of services. +The Q is the Service BC platform for managing in-person office flow, appointments, smartboard and digital signage displays, outbound notifications, and related service delivery workflows. The application is used by Service BC as well as other B.C. government ministries. -## Technology Stack Used +Service BC connects people with services offered by the B.C. provincial government. This application supports the day-to-day operations of Service BC locations by helping staff manage queues, appointments, exams, walk-ins, and communications across the province. -Single Signon using KeyCloak. This is used so that we don't need to manage the security concerns of passwords within the application. This also integrates to internal authentication model. +## Applications and Services -Designed for use in an application platform buld for containers specifically OpenShift: +### `api` -- VueJS & BootStrap for Front End -- Flask & Python for API Backend -- EDB (Postgres) -- Redis -- Ngnix +The primary backend service for the platform. It serves the main REST API under `/api/v1` plus Socket.IO endpoints used by the staff and public frontends. -## Features +Key responsibilities include: -Designed to accomodate multiple locations. -Designed for both reception based offices and direct counter offices. +- Queue and citizen service flows: create and manage citizens, service requests, queue state transitions, invite and serve flows, hold flows, and completion flows. +- Office and reference data: offices, services, categories, channels, CSR state, user context, and related administrative data. +- Appointments, bookings, and walk-ins: appointment slots, appointment creation and updates, recurring bookings, walk-in queue support, and reminder-related workflows. +- Exams, rooms, and invigilators: exam scheduling, uploads, exports, room management, and invigilator management. +- Smartboard and real-time updates: smartboard data endpoints plus Socket.IO events for queue changes and office-specific live updates. +- Health endpoints: readiness and health checks for operational monitoring. -Additional features for Reception offices: +### `frontend` -- Waiting queue displayed -- Citizens are called by name -- Digital Signage includes Current number of people waiting -- Handles a Quick Transaction Counter -- Ability to invite next citizen or pick from the waiting queue +The internal staff-facing Vue 2 application. Staff use it for queue management, office administration, appointments, exams, uploads, smartboard support, and optional service-flow integrations. -Basic Digital Signage URLs per office +### `appointment-frontend` -- Date and Time based on TimeZone -- MP4 to display messageing +The public-facing Vue 2 application for booking appointments, viewing booked appointments, managing account settings, handling sign-in flows, and viewing walk-in queue status. -Hold Queue +### `appointment-booking` -- Allows staff to place citizen tickets on hold +The new under development public-facing React 19 + TypeScript application for booking appointments at Service BC locations. It will eventually replace `appointment-frontend`. See [`appointment-booking/README.md`](./appointment-booking/README.md) for setup instructions. -Track Channels of an interaction from In Person, Phone, etc. +### `notifications-api` -Service Listings +A separate Flask service for outbound notifications. It exposes authenticated `POST /api/v1/notifications/sms` and `POST /api/v1/notifications/email` endpoints and supports pluggable delivery providers, including GC Notify, CHES, and logging/custom implementations. -- Sorted by category -- Searching service listings includes descriptions -- Hovering over a service listing displays descriptions -- Ability to customize service listing per Office -- Ability to hide Services from Digital Signage display -- Ability to add multiple services in one interaction +### `feedback-api` -Office Status Panel +> [!WARNING] +> `feedback-api` is deprecated, retained only for legacy compatibility, and will be removed in a future version. -- Provides a manager the ability to see counter interaction details +This legacy Flask service accepts feedback submissions and forwards them to the older Camunda-based feedback flow. -Service Appointments (Optional) +## Technology Stack -- Calendar for booking appointments -- Ability to Checkin clients and place them at the top of the queue +- Backend: Python, Flask, Flask-RESTX, SQLAlchemy, Flask-Migrate, Flask-SocketIO, Marshmallow, Gunicorn, and Gevent. +- Frontend: Vue 2 , React 19 + TypeScript + Vite , Vue Router, Vuex, Vuetify, BootstrapVue, Buefy, and Axios. +- Data and integrations: PostgreSQL, Redis-backed real-time/message queue usage, MinIO for object storage, Keycloak/OIDC authentication, optional Snowplow analytics, and GC Notify/CHES/custom notification providers. +- Serving/runtime: Nginx serves built frontend assets in containerized deployments. -Room Booking and Exam Invigilation (Optional) +Older references to RabbitMQ remain in the repository, but they are not part of the current development guidance in this README. -- Manage Industry Trade Authority Group and Individual Exams -- Manage Other (Basic Exams) -- Manage General Room Booking -- Report on Exams +## Development Options -Basic Administration Panels to add, update and delete: +This repository supports two local development workflows: -- Offices -- Customer Service Reps -- Service Listing -- Channels -- Roles -- Invigilators -- Exam Types -- Rooms -- Counter Types +- Using a [development container](https://containers.dev/) +- Developing locally on your host machine -Feedback +### Dev Container Workflow -- Sends to Teams and / or Service Now and / or Rocket Chat +#### Prerequisites -Analytics +- Podman or another compatible Docker engine +- Visual Studio Code (or another editor with Dev Container support) +- The Dev Containers extension for VS Code -- Key timing events are sent to snowplow for analysis and reporting -- Data is also stored in the Patroni Postgres database as an alternative method to extract analytics +#### Steps -## Requirements +1. Open the repository in an editor with dev container support +2. Use the editor to reopen the project in the devcontainer + - For example, in VS Code, click the popup prompt or use the Command Palette to select "Dev Containers: Reopen in Container" +3. Let the container build from the root `compose.yaml` definition and finish running the post-create script +4. Confirm that the container has provisioned PostgreSQL and Keycloak, and forwarded the main ports -Requires KeyCloak and additional Openshift / Kubernetes Config Maps +The devcontainer now prepares local config files before API migrations/bootstrap and waits for PostgreSQL and Keycloak readiness before the post-create flow continues. +It also provisions project-local Python environments for both `api` and `notifications-api`, so the checked-in VS Code debug configurations work without extra manual setup. -- keycloak.json is required in Front End Container in the following location: /var/www/html/static/keycloak +#### Expected Ports - { - "realm": "", - "auth-server-url": "" , - "ssl-required": "", - "resource": "", - "credentials": { - "secret": "" - } - } +- `5000`: queue management API +- `5002`: notifications API +- `5173`: appointment booking frontend (React) +- `8080`: staff frontend +- `8081`: appointment frontend +- `8085`: Keycloak auth server +- `5432`: PostgreSQL -- secrets.json is required in API Container in the following location: /opt/app-root/src/client_secrets +The devcontainer installs dependencies automatically for `api`, `notifications-api`, `frontend`, and `appointment-frontend`, applies database migrations, and may initialize seed data depending on the current database state. - { - "web": { - "realm_public_key": "", - "issuer": "" , - "auth_uri": "" , - "client_id": "", - "client_secret": "", - "redirect_urls": [ - "" - ], - "userinfo_uri": "" , - "token_uri": "" , - "token_introspection_uri": "" - } - } +### Local Host Workflow -- Digital Signage video (with the name of sbc.mp4) needs to be manually placed in /var/www/html/static/videos +#### Prerequisites -The openshift templates are used for build configs and deployment configs +- Python 3.14 with `uv` +- Node.js 20 with `npm` +- PostgreSQL 16 -Additional Enviornment Variables for API pods are used: +#### Setup -TEAMS_URL - to integrate feedback to Teams -THEQ_SNOWPLOW_ENDPOINT - where snowplow events are sent -THEQ_SNOWPLOW_APPID - Application ID for snowplow -THEQ_SNOWPLOW_NAMESPACE - Snowplow events namespace -THEQ_SNOWPLOW_CALLFLAG - disable/enable snowplow (Value: True or False) +1. Install backend dependencies: -## [Installation](documentation/Readme.md) + ```bash + cd ./api + uv sync --group dev -Additional information can be found in the [documention](documentation/Readme.md) folder. + cd ./notifications-api + uv sync --group dev + ``` -## Getting Help or Reporting an Issue +2. Install frontend dependencies: -To report bugs/issues/feature requests, please file an [issue](../../issues). + ```bash + cd ./frontend + npm install -## How to Contribute + cd ./appointment-frontend + npm install -_If you are including a Code of Conduct, make sure that you have a [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) file, and include the following text in here in the README:_ -"Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms." + cd ./appointment-booking + npm install + ``` -## License +3. Create the required local config files: + + ```bash + ./scripts/setup-local-config.sh + ``` + + This script copies the checked-in local config defaults from `.devcontainer/config`, creates missing destination directories, validates required API auth keys, and leaves any existing local files untouched. + +4. Start the local auth server: + + ```bash + docker compose up -d keycloak + ``` + + Local Keycloak details: + + - Realm: `servicebc-local` + - Base URL: `http://localhost:8085/auth` + - Admin console: `http://localhost:8085/auth/admin/` + - Admin credentials: `admin` / `password` + - Demo users: `democsr@idir`, `demoga@idir`, `admin@idir`, `citizen@bceidboth`, `citizen2@bceidboth` + - Demo user password: `password` + - Confidential client id: `theq-queue-management-api` + - Confidential client secret: `theq-local-dev-secret` + +5. Make sure the database settings in `api/.env` point to your local PostgreSQL instance. + +6. Run database migrations: + + ```bash + cd ./api + uv run python manage.py db upgrade + ``` + +#### Run Commands + +Start the services in separate terminals. + +Queue management API using the local Python environment: + +```bash +cd ./api +uv run gunicorn wsgi --bind=0.0.0.0:5000 --access-logfile=- --config=gunicorn_config.py --reload --timeout=0 +``` + +Queue management API using the production Dockerfile through Compose: + +```bash +docker compose --profile api up --build api +``` + +The root `compose.yaml` is the single source of truth for local Docker services and the devcontainer. The optional `api` Compose service still serves the application on `http://localhost:5000`. It reads `api/.env`, then overrides container-only settings so it can reach the host PostgreSQL and host-run notifications API while continuing to use the local Keycloak on `http://localhost:8085/auth`. + +Notifications API: + +```bash +cd ./notifications-api +uv run gunicorn wsgi:application --bind=0.0.0.0:5002 --access-logfile=- --config=gunicorn_config.py --reload --timeout=0 +``` + +Staff frontend: + +```bash +cd ./frontend +npm run serve +``` + +Appointment frontend: + +```bash +cd ./appointment-frontend +npm run serve -- --port 8081 +``` + +Appointment booking frontend (React): + +```bash +cd ./appointment-booking +npm run dev +``` + +Opens at `http://localhost:5173`. See [`appointment-booking/README.md`](./appointment-booking/README.md) for Docker and environment variable details. + +#### Local Config Files + +These are the main local files you should expect to have in place when running the application locally: + +- `api/.env` +- `api/client_secrets/secrets.json` +- `frontend/public/static/keycloak/keycloak.json` +- `frontend/public/config/configuration.json` +- `appointment-frontend/.env.local` +- `appointment-frontend/public/config/kc/keycloak-public.json` +- `appointment-frontend/public/config/configuration.json` -Detailed guidance around licenses is available -[here](/BC-Open-Source-Development-Employee-Guide/Licenses.md) +The checked-in local auth defaults now target the local Keycloak realm on `http://localhost:8085/auth`. If you need to switch back to the shared dev Keycloak server, update the copied local config files before starting the apps. -Attach the appropriate LICENSE file directly into your repository before you do anything else! +## Testing -The default license For code repositories is: Apache 2.0 +This repository includes Python/pytest suites, Artillery-based load tests, and Postman/Newman collections. The commands below assume you already completed the local setup for the relevant service and, for API-backed tests, have the local stack running. -Here is the boiler-plate you should put into the comments header of every source code file as well as the bottom of your README.md: +### Pytest Suites - Copyright 2015 Province of British Columbia +The main application test suite lives in `api/app/tests` and is split into a DB-free `smoke` slice and a Postgres-backed `integration` slice. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at +From `api`: - http://www.apache.org/licenses/LICENSE-2.0 +```bash +./scripts/run_api_smoke_tests.sh +./scripts/run_api_integration_tests.sh +./scripts/run_api_full_tests.sh +``` - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +Equivalent direct pytest commands: -For repos that are made up of docs, wikis and non-code stuff it's Creative Commons Attribution 4.0 International, and should look like this at the bottom of your README.md: +```bash +uv run pytest app/tests -m smoke -q --override-ini "addopts=--strict-markers" +uv run pytest app/tests -m integration -q --override-ini "addopts=--strict-markers" --require-integration-db +uv run pytest app/tests -q --require-integration-db +``` -Creative Commons Licence
YOUR REPO NAME HERE by the Province of Britich Columbia is licensed under a Creative Commons Attribution 4.0 International License. +Additional pytest suites: -and the code for the cc 4.0 footer looks like this: +```bash +cd ./notifications-api +uv sync --group dev +uv run pytest +``` + +```bash +cd ./feedback-api +make setup +make test +``` + +### Load Tests + +Load testing lives in `tests/loadtesting` and uses Artillery against the local API stack. + +Initial setup: + +```bash +cd ./tests/loadtesting +npm install +cp envs.example.sh envs.sh +chmod +x envs.sh profile-python.sh +``` + +Before running the load tests locally, start the local Keycloak realm and seed the API data: + +```bash +docker compose up -d keycloak + +cd ./api +uv run python manage.py db upgrade +uv run python manage.py bootstrap +``` + +Run the load suites from `tests/loadtesting`: + +```bash +npm run tests:all +npm run tests:http +npm run tests:socket +``` + +Optional Python profiling commands are also available there: + +```bash +npm run python:profile +npm run python:top +``` + +### Newman Tests + +Postman collections live in `api/postman`. They target the local API and local Keycloak realm, and the checked-in local setup expects the demo users from `keycloak-local/servicebc-local-realm.json`. + +Before running Newman locally, make sure the API database is migrated and bootstrapped: + +```bash +cd ./api +uv run python manage.py db upgrade +uv run python manage.py bootstrap +``` + +Then install Newman and run the main collection from `api/postman`: + +```bash +cd ./api/postman +npm install +./node_modules/newman/bin/newman.js run API_Test_TheQ_Booking.json -e postman_env.json --bail failure \ + --global-var userid=cfms-postman-operator \ + --global-var password=password \ + --global-var userid_nonqtxn=cfms-postman-non-operator \ + --global-var password_nonqtxn=password \ + --global-var client_secret=theq-local-dev-secret \ + --global-var url=http://localhost:5000/api/v1/ \ + --global-var auth_url=http://localhost:8085 \ + --global-var clientid=theq-queue-management-api \ + --global-var realm=servicebc-local \ + --global-var public_url=http://localhost:5000/api/v1/ \ + --global-var public_user_id=cfms-postman-public-user \ + --global-var public_user_password=password +``` + +See `api/postman/README-local-auth.md` for local auth troubleshooting details. + +## Deployment + +For deployment within the B.C. government, this project can be hosted on the [B.C. government Private Cloud](https://digital.gov.bc.ca/technology/cloud/private/). The platform is the B.C. Government Private Cloud PaaS, powered by Red Hat OpenShift, and is designed for hosting government applications in a managed private-cloud environment. + +This repository still includes deployment artifacts under [`openshift/templates`](./openshift/templates) for platform-specific builds and deployments. + +## Getting Help or Reporting an Issue + +To report bugs/issues/feature requests, please file an [issue](../../issues). + +## How to Contribute + +Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms. + +## License - Creative Commons Licence
YOUR REPO NAME HERE by the Province of Britich Columbia - is licensed under a - Creative Commons Attribution 4.0 International License. \ No newline at end of file +This project is licensed under the Apache License, Version 2.0. See the root [`LICENSE`](./LICENSE) file for the full license text. diff --git a/api/Dockerfile b/api/Dockerfile new file mode 100644 index 000000000..65fdc8786 --- /dev/null +++ b/api/Dockerfile @@ -0,0 +1,26 @@ +FROM python:3.14-slim + +ENV PYTHONDONTWRITEBYTECODE=1 \ + PYTHONUNBUFFERED=1 \ + PIP_NO_CACHE_DIR=1 + +WORKDIR /opt/app-root/src + +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + gcc \ + libpq-dev \ + libmagic1 \ + libmagic-dev \ + && rm -rf /var/lib/apt/lists/* + +COPY requirements.txt . +RUN pip install --upgrade pip setuptools wheel && \ + pip install -r requirements.txt && \ + pip uninstall -y rsa ecdsa pyasn1 + +COPY . . + +EXPOSE 8080 + +CMD ["gunicorn", "wsgi", "--bind", "0.0.0.0:8080", "--access-logfile=-", "--no-control-socket", "--config=gunicorn_config.py"] diff --git a/api/app/README.md b/api/app/README.md index da35b8fa2..bd2ef99ea 100644 --- a/api/app/README.md +++ b/api/app/README.md @@ -1,8 +1,14 @@ # Back-end Development Guide -Generate new migrations +Sync the project environment ``` -python3 manage.py db migrate -python3 manage.py db upgrade +uv sync --group dev +``` + +Generate new migrations + +```bash +uv run python manage.py db migrate +uv run python manage.py db upgrade ``` diff --git a/api/app/admin/base.py b/api/app/admin/base.py index 97ebe6b6f..4caaa879a 100644 --- a/api/app/admin/base.py +++ b/api/app/admin/base.py @@ -12,7 +12,9 @@ See the License for the specific language governing permissions and limitations under the License.''' +from flask import has_request_context from flask_admin.contrib.sqla import ModelView +from flask_login import current_user from qsystem import application @@ -22,3 +24,24 @@ class Base(ModelView): def get_url(self, endpoint, **kwargs): new_kwargs = dict(kwargs, _external=True, _scheme=application.config['PREFERRED_URL_SCHEME']) return super(ModelView, self).get_url(endpoint, **new_kwargs) + + def get_current_user(self): + if not has_request_context(): + return None + + try: + if not current_user.is_authenticated: + return None + except Exception: + return None + + return current_user + + def get_current_role_code(self): + user = self.get_current_user() + role = getattr(user, 'role', None) + return getattr(role, 'role_code', None) + + def get_current_office_id(self): + user = self.get_current_user() + return getattr(user, 'office_id', None) diff --git a/api/app/admin/csr.py b/api/app/admin/csr.py index 10fbe1176..ec04e32e4 100644 --- a/api/app/admin/csr.py +++ b/api/app/admin/csr.py @@ -31,14 +31,14 @@ class CSRConfig(Base): roles_allowed = ['GA', 'HELPDESK', 'SUPPORT'] def is_accessible(self): - return current_user.is_authenticated and current_user.role.role_code in self.roles_allowed + return self.get_current_role_code() in self.roles_allowed create_modal = False edit_modal = False @property def can_create(self): - return current_user.role.role_code != 'GA' + return self.get_current_role_code() != 'GA' can_delete = False # Defining String constants to appease SonarQube @@ -125,7 +125,7 @@ def validate_model(self): model = self.get_one(identifier) allowed_ga_edit_roles = ['GA', 'CSR'] - if model and current_user.role.role_code == 'GA' and model.role.role_code not in allowed_ga_edit_roles: + if model and self.get_current_role_code() == 'GA' and model.role.role_code not in allowed_ga_edit_roles: flash(gettext('You are not allowed to edit a '+ model.role.role_code +' role.'), 'error') return False diff --git a/api/app/admin/index.py b/api/app/admin/index.py index 3b59e9bf9..c1d110270 100644 --- a/api/app/admin/index.py +++ b/api/app/admin/index.py @@ -20,7 +20,7 @@ class HomeView(AdminIndexView): @expose('/') def index(self): - return self.render('admin/base.html') + return self.render('admin/home.html') def get_url(self, endpoint, **kwargs): new_kwargs = dict(kwargs, _external=True, _scheme=application.config['PREFERRED_URL_SCHEME']) diff --git a/api/app/admin/invigilator.py b/api/app/admin/invigilator.py index f59bc5cad..656a6eb9f 100644 --- a/api/app/admin/invigilator.py +++ b/api/app/admin/invigilator.py @@ -26,13 +26,15 @@ class InvigilatorConfig(Base): office_name_const = 'office.office_name' def is_accessible(self): - return current_user.is_authenticated and current_user.role.role_code in self.roles_allowed + return self.get_current_role_code() in self.roles_allowed def get_query(self): - if current_user.role.role_code == 'SUPPORT': + role_code = self.get_current_role_code() + if role_code == 'GA': + return self.session.query(self.model).filter_by(office_id=self.get_current_office_id()) + if role_code == 'SUPPORT' or role_code is None: return self.session.query(self.model) - elif current_user.role.role_code == 'GA': - return self.session.query(self.model).filter_by(office_id=current_user.office_id) + return self.session.query(self.model) create_modal = False edit_modal = False diff --git a/api/app/admin/office.py b/api/app/admin/office.py index 620033a00..615022ff4 100644 --- a/api/app/admin/office.py +++ b/api/app/admin/office.py @@ -17,7 +17,7 @@ from app.models.theq import Office, Service, Counter from .base import Base from flask_login import current_user -from flask import flash, url_for, has_app_context +from flask import flash, url_for from flask_admin.babel import gettext from qsystem import db from sqlalchemy import and_ @@ -34,15 +34,15 @@ class OfficeConfig(Base): roles_allowed = ['SUPPORT', 'GA'] def is_accessible(self): - return current_user.is_authenticated and current_user.role.role_code in self.roles_allowed + return self.get_current_role_code() in self.roles_allowed @property def can_create(self): - return current_user.role.role_code != 'GA' + return self.get_current_role_code() != 'GA' @property def column_list(self): - if has_app_context() and current_user.role.role_code == 'SUPPORT': + if self.get_current_role_code() != 'GA': return self.column_list_support return self.column_list_GA @@ -55,10 +55,12 @@ def _list_columns(self, value): pass # This is empty for some reason. def get_query(self): - if current_user.role.role_code == 'SUPPORT': + role_code = self.get_current_role_code() + if role_code == 'GA': + return self.session.query(self.model).filter_by(office_id=self.get_current_office_id()) + if role_code == 'SUPPORT' or role_code is None: return self.session.query(self.model) - elif current_user.role.role_code == 'GA': - return self.session.query(self.model).filter_by(office_id=current_user.office_id) + return self.session.query(self.model) create_modal = False edit_modal = False @@ -323,7 +325,11 @@ def get_query(self): } def on_model_change(self, form, model, is_created): - csr = CSR.find_by_username(current_user.username) + user = self.get_current_user() + if user is None: + return + + csr = CSR.find_by_username(user.username) socketio.emit('clear_csr_cache', { "id": csr.csr_id}) socketio.emit('csr_update', {"csr_id": csr.csr_id, "receptionist_ind": csr.receptionist_ind}, @@ -331,12 +337,14 @@ def on_model_change(self, form, model, is_created): socketio.emit('digital_signage_msg_update') def render(self, template, **kwargs): - if current_user.role.role_code == 'SUPPORT': + role_code = self.get_current_role_code() + + if role_code == 'SUPPORT': if template == 'admin/model/edit.html': template = 'office/office_edit.html' elif template == 'admin/model/create.html': template = 'office/office_create.html' - elif current_user.role.role_code == 'GA': + elif role_code == 'GA': if template == 'admin/model/edit.html': template = 'office/officega_edit.html' elif template == 'admin/model/create.html': diff --git a/api/app/admin/room.py b/api/app/admin/room.py index 8120f9b58..48a836cdd 100644 --- a/api/app/admin/room.py +++ b/api/app/admin/room.py @@ -20,27 +20,30 @@ from flask_login import current_user from qsystem import db from datetime import datetime -import pytz + +from app.utilities.timezone_utils import as_utc class RoomConfig(Base): roles_allowed = ['SUPPORT', 'GA'] def is_accessible(self): - return current_user.is_authenticated and current_user.role.role_code in self.roles_allowed + return self.get_current_role_code() in self.roles_allowed def get_query(self): - if current_user.role.role_code == 'SUPPORT': + role_code = self.get_current_role_code() + if role_code == 'GA': + return self.session.query(self.model).filter_by(office_id=self.get_current_office_id()) + if role_code == 'SUPPORT' or role_code is None: return self.session.query(self.model) - elif current_user.role.role_code == 'GA': - return self.session.query(self.model).filter_by(office_id=current_user.office_id) + return self.session.query(self.model) def on_model_change(self, form, model, is_created): if not is_created: room_id = get_mdict_item_or_list(request.args, 'id') today = datetime.now() - today_aware = pytz.utc.localize(today) + today_aware = as_utc(today) booking_room = Booking.query.filter_by(room_id=room_id)\ .filter(Booking.start_time > today_aware).count() diff --git a/api/app/admin/timeslot.py b/api/app/admin/timeslot.py index 8dccbde09..4764600e9 100644 --- a/api/app/admin/timeslot.py +++ b/api/app/admin/timeslot.py @@ -28,10 +28,10 @@ class MultipleSelect2Field(Select2Field): def iter_choices(self): """Iterate over choices especially to check if one of the values is selected.""" if self.allow_blank: - yield (u'__None', self.blank_text, self.data is None) + yield (u'__None', self.blank_text, self.data is None, {}) for value, label in self.choices: - yield (value, label, self.coerce(value) in self.data) + yield (value, label, self.coerce(value) in self.data, {}) def process_data(self, value): """This is called when you create the form with existing data.""" @@ -69,13 +69,15 @@ class TimeslotConfig(Base): roles_allowed = ['SUPPORT', 'GA'] def is_accessible(self): - return current_user.is_authenticated and current_user.role.role_code in self.roles_allowed + return self.get_current_role_code() in self.roles_allowed def get_query(self): - if current_user.role.role_code == 'SUPPORT': + role_code = self.get_current_role_code() + if role_code == 'GA': + return self.session.query(self.model).filter_by(office_id=self.get_current_office_id()) + if role_code == 'SUPPORT' or role_code is None: return self.session.query(self.model) - elif current_user.role.role_code == 'GA': - return self.session.query(self.model).filter_by(office_id=current_user.office_id) + return self.session.query(self.model) create_modal = False edit_modal = False diff --git a/api/app/auth/__init__.py b/api/app/auth/__init__.py index dff04350e..7df638897 100644 --- a/api/app/auth/__init__.py +++ b/api/app/auth/__init__.py @@ -5,15 +5,4 @@ @login_manager.user_loader def load_user(user_id): csr = CSR.query.filter_by(csr_id=int(user_id)).filter(CSR.deleted.is_(None)).first() - if not csr: - return None - - if csr.deleted is None: - csr.is_active = True - else: - csr.is_active = False - - csr.is_authenticated = True - csr.is_anonymous = False - return csr diff --git a/api/app/models/bookings/__init__.py b/api/app/models/bookings/__init__.py index e446176fb..b1fab2b64 100644 --- a/api/app/models/bookings/__init__.py +++ b/api/app/models/bookings/__init__.py @@ -19,4 +19,5 @@ from app.models.bookings.exam_type import ExamType from app.models.bookings.invigilator import Invigilator from app.models.bookings.room import Room -from app.models.bookings.appointments import Appointment \ No newline at end of file +from app.models.bookings.versioning import appointment_version, transaction +from app.models.bookings.appointments import Appointment diff --git a/api/app/models/bookings/appointments.py b/api/app/models/bookings/appointments.py index f98bfbf80..b74d13ca3 100644 --- a/api/app/models/bookings/appointments.py +++ b/api/app/models/bookings/appointments.py @@ -14,21 +14,17 @@ from app.models.bookings import Base from qsystem import db -from sqlalchemy_utc import UtcDateTime, utcnow -from sqlalchemy import func, or_, and_ +from app.utilities.sqlalchemy_compat import UtcDateTime, utcnow +from sqlalchemy import event, func, or_, and_, text from datetime import datetime, timedelta, timezone from dateutil.parser import parse from dateutil import tz from app.utilities.date_util import current_pacific_time -from sqlalchemy.ext.declarative import declared_attr +from sqlalchemy.orm import declared_attr from flask import g class Appointment(Base): - __versioned__ = { - 'exclude': [] - } - appointment_id = db.Column(db.Integer, primary_key=True, autoincrement=True, nullable=False) office_id = db.Column(db.Integer, db.ForeignKey("office.office_id"), nullable=False) service_id = db.Column(db.Integer, db.ForeignKey("service.service_id"), nullable=True) @@ -43,9 +39,9 @@ class Appointment(Base): recurring_uuid = db.Column(db.String(255), nullable=True) online_flag = db.Column(db.Boolean(), nullable=True, default=False) is_draft = db.Column(db.Boolean(), nullable=True, default=False) - created_at = db.Column(UtcDateTime, nullable=True, default=utcnow()) + created_at = db.Column(UtcDateTime, nullable=True, default=utcnow) stat_flag = db.Column(db.Boolean, default=False, nullable=False) - updated_at = db.Column(UtcDateTime, onupdate=utcnow(), default=None) + updated_at = db.Column(UtcDateTime, onupdate=utcnow, default=None) office = db.relationship("Office") service = db.relationship("Service") @@ -175,5 +171,103 @@ def delete_expired_drafts(cls): draft_ids = [appointment.appointment_id for appointment in drafts] Appointment.delete_appointments(draft_ids) return draft_ids - + +def _record_appointment_version(connection, appointment, operation_type): + transaction_id = connection.execute( + text( + "INSERT INTO transaction (issued_at, remote_addr) " + "VALUES (:issued_at, :remote_addr) RETURNING id" + ), + {"issued_at": utcnow().replace(tzinfo=None), "remote_addr": None}, + ).scalar() + + connection.execute( + text( + """ + INSERT INTO appointment_version ( + appointment_id, + office_id, + service_id, + citizen_id, + start_time, + end_time, + checked_in_time, + comments, + citizen_name, + contact_information, + blackout_flag, + recurring_uuid, + online_flag, + is_draft, + created_at, + stat_flag, + updated_at, + updated_by, + transaction_id, + end_transaction_id, + operation_type + ) VALUES ( + :appointment_id, + :office_id, + :service_id, + :citizen_id, + :start_time, + :end_time, + :checked_in_time, + :comments, + :citizen_name, + :contact_information, + :blackout_flag, + :recurring_uuid, + :online_flag, + :is_draft, + :created_at, + :stat_flag, + :updated_at, + :updated_by, + :transaction_id, + :end_transaction_id, + :operation_type + ) + """ + ), + { + "appointment_id": appointment.appointment_id, + "office_id": appointment.office_id, + "service_id": appointment.service_id, + "citizen_id": appointment.citizen_id, + "start_time": appointment.start_time, + "end_time": appointment.end_time, + "checked_in_time": appointment.checked_in_time, + "comments": appointment.comments, + "citizen_name": appointment.citizen_name, + "contact_information": appointment.contact_information, + "blackout_flag": appointment.blackout_flag, + "recurring_uuid": appointment.recurring_uuid, + "online_flag": appointment.online_flag, + "is_draft": appointment.is_draft, + "created_at": appointment.created_at, + "stat_flag": appointment.stat_flag, + "updated_at": appointment.updated_at, + "updated_by": appointment.updated_by, + "transaction_id": transaction_id, + "end_transaction_id": None, + "operation_type": operation_type, + }, + ) + + +@event.listens_for(Appointment, "after_insert") +def _record_appointment_insert(mapper, connection, target): # pragma: no cover - SQLAlchemy hook + _record_appointment_version(connection, target, 0) + + +@event.listens_for(Appointment, "after_update") +def _record_appointment_update(mapper, connection, target): # pragma: no cover - SQLAlchemy hook + _record_appointment_version(connection, target, 1) + + +@event.listens_for(Appointment, "after_delete") +def _record_appointment_delete(mapper, connection, target): # pragma: no cover - SQLAlchemy hook + _record_appointment_version(connection, target, 2) diff --git a/api/app/models/bookings/base.py b/api/app/models/bookings/base.py index de3cfaa6b..af17f625d 100644 --- a/api/app/models/bookings/base.py +++ b/api/app/models/bookings/base.py @@ -12,7 +12,7 @@ See the License for the specific language governing permissions and limitations under the License.''' -from sqlalchemy.ext.declarative import declared_attr +from sqlalchemy.orm import declared_attr from qsystem import db diff --git a/api/app/models/bookings/booking.py b/api/app/models/bookings/booking.py index 337e91d45..13932de07 100644 --- a/api/app/models/bookings/booking.py +++ b/api/app/models/bookings/booking.py @@ -14,7 +14,7 @@ from app.models.bookings import Base from qsystem import db -from sqlalchemy_utc import UtcDateTime +from app.utilities.sqlalchemy_compat import UtcDateTime class Booking(Base): @@ -55,4 +55,3 @@ def __repr__(self): def __init__(self, **kwargs): super(Booking, self).__init__(**kwargs) - diff --git a/api/app/models/bookings/exam.py b/api/app/models/bookings/exam.py index bdfda45a7..9376e9f05 100644 --- a/api/app/models/bookings/exam.py +++ b/api/app/models/bookings/exam.py @@ -13,6 +13,7 @@ limitations under the License.''' from app.models.bookings import Base +from app.utilities.sqlalchemy_compat import UtcDateTime from qsystem import db @@ -28,14 +29,14 @@ class Exam(Base): examinee_name = db.Column(db.String(50), nullable=True) examinee_email = db.Column(db.String(400), nullable=True) examinee_phone = db.Column(db.String(400), nullable=True) - expiry_date = db.Column(db.DateTime, nullable=True) + expiry_date = db.Column(UtcDateTime, nullable=True) notes = db.Column(db.String(400), nullable=True) - exam_received_date = db.Column(db.DateTime, nullable=True) + exam_received_date = db.Column(UtcDateTime, nullable=True) session_number = db.Column(db.Integer, nullable=True) number_of_students = db.Column(db.Integer, nullable=True) exam_method = db.Column(db.String(15), nullable=False) deleted_date = db.Column(db.String(50), nullable=True) - exam_returned_date = db.Column(db.DateTime, nullable=True) + exam_returned_date = db.Column(UtcDateTime, nullable=True) exam_returned_tracking_number = db.Column(db.String(255), nullable=True) exam_written_ind = db.Column(db.Integer, nullable=False, default=0) offsite_location = db.Column(db.String(50), nullable=True) diff --git a/api/app/models/bookings/exam_type.py b/api/app/models/bookings/exam_type.py index 8574d4473..e9c725093 100644 --- a/api/app/models/bookings/exam_type.py +++ b/api/app/models/bookings/exam_type.py @@ -30,7 +30,7 @@ class ExamType(Base): deleted = db.Column(db.DateTime, nullable=True) # changed lazy=false to lazy=raise - exam = db.relationship("Exam", lazy='raise') + exam = db.relationship("Exam", lazy='raise', overlaps='exam_type') # changed lazy4-false to no lazy option #exam = db.relationship("Exam", lazy=False) diff --git a/api/app/models/bookings/room.py b/api/app/models/bookings/room.py index 2a77f7846..00b20c50d 100644 --- a/api/app/models/bookings/room.py +++ b/api/app/models/bookings/room.py @@ -25,7 +25,7 @@ class Room(Base): color = db.Column(db.String(25), nullable=False) deleted = db.Column(db.DateTime, nullable=True) - booking = db.relationship("Booking") + booking = db.relationship("Booking", overlaps='room') office = db.relationship("Office", lazy='joined') def __repr__(self): diff --git a/api/app/models/bookings/versioning.py b/api/app/models/bookings/versioning.py new file mode 100644 index 000000000..130368700 --- /dev/null +++ b/api/app/models/bookings/versioning.py @@ -0,0 +1,50 @@ +"""Metadata definitions for manual appointment versioning tables.""" + +from sqlalchemy import DateTime, Index, PrimaryKeyConstraint + +from qsystem import db + + +appointment_version = db.Table( + "appointment_version", + db.metadata, + db.Column("appointment_id", db.Integer, nullable=False), + db.Column("office_id", db.Integer, nullable=True), + db.Column("service_id", db.Integer, nullable=True), + db.Column("citizen_id", db.Integer, nullable=True), + db.Column("start_time", DateTime(timezone=True), nullable=True), + db.Column("end_time", DateTime(timezone=True), nullable=True), + db.Column("checked_in_time", DateTime(timezone=True), nullable=True), + db.Column("comments", db.String(255), nullable=True), + db.Column("citizen_name", db.String(255), nullable=True), + db.Column("contact_information", db.String(255), nullable=True), + db.Column("blackout_flag", db.String(1), nullable=True), + db.Column("recurring_uuid", db.String(255), nullable=True), + db.Column("online_flag", db.Boolean(), nullable=True), + db.Column("is_draft", db.Boolean(), nullable=True), + db.Column("created_at", DateTime(timezone=True), nullable=True), + db.Column("stat_flag", db.Boolean(), nullable=True), + db.Column("updated_at", DateTime(timezone=True), nullable=True), + db.Column("updated_by", db.String(), nullable=True), + db.Column("transaction_id", db.BigInteger, nullable=False), + db.Column("end_transaction_id", db.BigInteger, nullable=True), + db.Column("operation_type", db.SmallInteger, nullable=False), + PrimaryKeyConstraint( + "appointment_id", + "transaction_id", + name="appointment_version_pkey", + ), + Index("ix_appointment_version_transaction_id", "transaction_id"), + Index("ix_appointment_version_operation_type", "operation_type"), + Index("ix_appointment_version_end_transaction_id", "end_transaction_id"), +) + + +transaction = db.Table( + "transaction", + db.metadata, + db.Column("issued_at", DateTime(), nullable=True), + db.Column("id", db.BigInteger, autoincrement=True, nullable=False), + db.Column("remote_addr", db.String(50), nullable=True), + PrimaryKeyConstraint("id", name="transaction_pkey"), +) diff --git a/api/app/models/theq/base.py b/api/app/models/theq/base.py index 3c6840949..d58d9350d 100644 --- a/api/app/models/theq/base.py +++ b/api/app/models/theq/base.py @@ -13,7 +13,7 @@ limitations under the License.''' from qsystem import db -from sqlalchemy.ext.declarative import declared_attr +from sqlalchemy.orm import declared_attr class Base(db.Model, object): diff --git a/api/app/models/theq/citizen.py b/api/app/models/theq/citizen.py index 987a96e4a..bbff232b2 100644 --- a/api/app/models/theq/citizen.py +++ b/api/app/models/theq/citizen.py @@ -14,7 +14,7 @@ from qsystem import db from app.models.theq import Base -from sqlalchemy_utc import UtcDateTime, utcnow +from app.utilities.sqlalchemy_compat import UtcDateTime, utcnow class Citizen(Base): @@ -50,7 +50,7 @@ class Citizen(Base): start_position = db.Column(db.Integer, nullable=True) # digital signage - created_at = db.Column(UtcDateTime, nullable=True, default=utcnow()) + created_at = db.Column(UtcDateTime, nullable=True, default=utcnow) def __repr__(self): @@ -87,4 +87,4 @@ def find_citizen_by_user_id(cls, user_id, office_id): @classmethod def find_citizen_by_id(cls, citizen_id): """Find citizen record by user id.""" - return cls.query.get(citizen_id) + return db.session.get(cls, citizen_id) diff --git a/api/app/models/theq/csr.py b/api/app/models/theq/csr.py index dec923b68..21651deee 100644 --- a/api/app/models/theq/csr.py +++ b/api/app/models/theq/csr.py @@ -13,12 +13,13 @@ limitations under the License.''' import logging +from flask_login import UserMixin from qsystem import cache, db, my_print from app.models.theq import Base from sqlalchemy import func -class CSR(Base): +class CSR(UserMixin, Base): csr_id = db.Column(db.Integer, primary_key=True, autoincrement=True, nullable=False) username = db.Column(db.String(150), nullable=False, unique=True) @@ -38,7 +39,7 @@ class CSR(Base): office = db.relationship("Office", lazy='joined') counter = db.relationship("Counter", lazy='joined') periods = db.relationship("Period", primaryjoin="and_(CSR.csr_id==Period.csr_id,Period.time_end.is_(None))", - order_by='desc(Period.time_start)') + order_by='desc(Period.time_start)', overlaps='csr') format_string = 'csr_detail_%s' @@ -50,6 +51,8 @@ def __init__(self, **kwargs): @classmethod def find_by_username(cls, username): + if not username or not username.strip(): + return None # Possible keycloak->TheQ id values are user@idir->user, idir/user->user or user@bceid->user@bceid idir_id = username.split("idir/")[-1].lower() if "@idir" in username: @@ -76,6 +79,8 @@ def find_by_userid(cls, userid): @classmethod def delete_user_cache(cls, username): + if not username or not username.strip(): + return idir_id = username.split("idir/")[-1] key = (CSR.format_string % idir_id).lower() cache.delete(key) @@ -94,3 +99,7 @@ def update_user_cache(cls, userid): def get_id(self): return str(self.csr_id) + + @property + def is_active(self): + return self.deleted is None diff --git a/api/app/models/theq/office.py b/api/app/models/theq/office.py index 4ac1218a1..95239e659 100644 --- a/api/app/models/theq/office.py +++ b/api/app/models/theq/office.py @@ -90,18 +90,18 @@ class Office(Base): soonest_appointment = db.Column(db.Integer, default=0) counters = db.relationship("Counter", secondary='office_counter') - services = db.relationship("Service", secondary='office_service') + services = db.relationship("Service", secondary='office_service', overlaps='offices') quick_list = db.relationship("Service", secondary='office_quick_list') back_office_list = db.relationship("Service", secondary='office_back_office_list') - csrs = db.relationship('CSR') - citizens = db.relationship('Citizen', backref='office_citizens') - timeslots = db.relationship('TimeSlot') + csrs = db.relationship('CSR', overlaps='office') + citizens = db.relationship('Citizen', backref=db.backref('office_citizens', overlaps='office'), overlaps='office') + timeslots = db.relationship('TimeSlot', overlaps='office') sb = db.relationship('SmartBoard') timezone = db.relationship('Timezone') - exams = db.relationship("Exam") - rooms = db.relationship('Room') + exams = db.relationship("Exam", overlaps='office') + rooms = db.relationship('Room', overlaps='office') # for walk-in notifications check_in_notification = db.Column(db.Integer) @@ -131,7 +131,7 @@ def find_by_id(cls, office_id: int): key = Office.format_string % office_id office = cache.get(key) if not office: - office = cls.query.get(office_id) + office = db.session.get(cls, office_id) office.timeslots office.timezone return office diff --git a/api/app/models/theq/period.py b/api/app/models/theq/period.py index 8c81240b9..7e18d7ca8 100644 --- a/api/app/models/theq/period.py +++ b/api/app/models/theq/period.py @@ -26,7 +26,7 @@ class Period(Base): time_start = db.Column(db.DateTime, nullable=False) time_end = db.Column(db.DateTime, nullable=True) - csr = db.relationship("CSR", lazy='joined') + csr = db.relationship("CSR", lazy='joined', overlaps='periods') ps = db.relationship("PeriodState", lazy='joined') sr = db.relationship("ServiceReq", lazy='joined') diff --git a/api/app/models/theq/public_user.py b/api/app/models/theq/public_user.py index 1f6be6f3a..fa50d346e 100644 --- a/api/app/models/theq/public_user.py +++ b/api/app/models/theq/public_user.py @@ -15,16 +15,14 @@ from app.models.theq import Base, Citizen from qsystem import cache, db from app.models.bookings.appointments import Appointment -from datetime import datetime -from pytz import timezone -import pytz +from datetime import datetime, timezone class PublicUser(Base): user_id = db.Column(db.Integer, primary_key=True, autoincrement=True, nullable=False) username = db.Column(db.String(100), unique=True, index=True) - last_name = db.Column(db.String(100)) + last_name = db.Column(db.String(200)) display_name = db.Column(db.String(200)) email = db.Column(db.String(200)) telephone = db.Column(db.String(20)) @@ -40,19 +38,23 @@ def __init__(self, **kwargs): @classmethod def find_by_username(cls, username): """Find User records by username.""" + if not username or not username.strip(): + return None user = cls.query.filter_by(username=username).one_or_none() return user @classmethod def find_by_user_id(cls, user_id): """Find User records by user_id.""" - user = cls.query.get(user_id) + user = db.session.get(cls, user_id) return user @classmethod def find_appointments_by_username(cls, username: str): """Find all appointments for the user.""" - today = datetime.now(timezone('UTC')) + if not username or not username.strip(): + return [] + today = datetime.now(timezone.utc) query = db.session.query(Appointment) \ .join(Citizen) \ diff --git a/api/app/models/theq/role.py b/api/app/models/theq/role.py index c71effb89..b9c60fa9b 100644 --- a/api/app/models/theq/role.py +++ b/api/app/models/theq/role.py @@ -26,7 +26,7 @@ class Role(Base): role_code = db.Column(db.String(100)) role_desc = db.Column(db.String(1000)) - roles = db.relationship('CSR', lazy=False) + roles = db.relationship('CSR', lazy=False, overlaps='role') def __repr__(self): return self.role_code diff --git a/api/app/models/theq/service.py b/api/app/models/theq/service.py index 759fec83d..e0d072c05 100644 --- a/api/app/models/theq/service.py +++ b/api/app/models/theq/service.py @@ -41,15 +41,15 @@ class Service(Base): display_dashboard_ind = db.Column(db.Integer, nullable=False) actual_service_ind = db.Column(db.Integer, nullable=False) - external_service_name = db.Column(db.String(100), nullable=True) - online_link = db.Column(db.String(200), nullable=True) + external_service_name = db.Column(db.String(500), nullable=True) + online_link = db.Column(db.String(500), nullable=True) online_availability = db.Column(Enum(Availability)) timeslot_duration = db.Column(db.Integer, nullable=True) is_dlkt = db.Column(Enum(YesNo)) email_paragraph = db.Column(db.String(2000), nullable=True) css_colour = db.Column(db.String(50), nullable=True) - offices = db.relationship("Office", secondary='office_service') + offices = db.relationship("Office", secondary='office_service', overlaps='services') parent = db.relationship("Service", remote_side=[service_id]) def __repr__(self): diff --git a/api/app/models/theq/service_req.py b/api/app/models/theq/service_req.py index 2046c153c..8a1ad8fbf 100644 --- a/api/app/models/theq/service_req.py +++ b/api/app/models/theq/service_req.py @@ -29,9 +29,15 @@ class ServiceReq(Base): sr_number = db.Column(db.Integer, default=1, nullable=False) channel = db.relationship('Channel') - periods = db.relationship('Period', backref=db.backref("request_periods", lazy=False), lazy='joined', order_by='Period.period_id') + periods = db.relationship( + 'Period', + backref=db.backref("request_periods", lazy=False, overlaps='sr'), + lazy='joined', + order_by='Period.period_id', + overlaps='sr' + ) sr_state = db.relationship('SRState', lazy='joined') - citizen = db.relationship('Citizen') + citizen = db.relationship('Citizen', overlaps='service_reqs') service = db.relationship('Service', lazy='joined') # Defining String constants to appease SonarQube diff --git a/api/app/models/theq/time_slot.py b/api/app/models/theq/time_slot.py index f9209e1e6..27bf74f08 100644 --- a/api/app/models/theq/time_slot.py +++ b/api/app/models/theq/time_slot.py @@ -27,7 +27,7 @@ class TimeSlot(Base): day_of_week = db.Column(postgresql.ARRAY(String), nullable=False) no_of_slots = db.Column(db.Integer, nullable=False) - office = db.relationship("Office", lazy='joined') + office = db.relationship("Office", lazy='joined', overlaps='timeslots') format_string = 'time_slot_%s' diff --git a/api/app/resources/bookings/appointment/appointment_availability.py b/api/app/resources/bookings/appointment/appointment_availability.py index c60de79ba..17dbd1c5a 100644 --- a/api/app/resources/bookings/appointment/appointment_availability.py +++ b/api/app/resources/bookings/appointment/appointment_availability.py @@ -14,7 +14,6 @@ import datetime, logging -import pytz from flask_restx import Resource from flask import request from sqlalchemy import exc @@ -22,8 +21,9 @@ from app.models.theq import Office from app.models.theq import Service from app.services import AvailabilityService -from qsystem import api +from qsystem import api, db from app.auth.auth import jwt +from app.utilities.timezone_utils import get_timezone @api.route("/offices//slots/", methods=["GET"]) @@ -36,7 +36,7 @@ def get(self, office_id: int): appointments_days_limit = office.appointments_days_limit # Dictionary to store the available slots per day - tz = pytz.timezone(office.timezone.timezone_name) + tz = get_timezone(office.timezone.timezone_name) # today's date and time today = datetime.datetime.now().astimezone(tz) @@ -47,7 +47,7 @@ def get(self, office_id: int): service = None service_id = request.args.get('service_id') if (service_id): - service = Service.query.get(int(service_id)) + service = db.session.get(Service, int(service_id)) return AvailabilityService.get_available_slots(office=office, days=days, service=service) diff --git a/api/app/resources/bookings/appointment/appointment_delete.py b/api/app/resources/bookings/appointment/appointment_delete.py index abe9b50e6..823cfd8c9 100644 --- a/api/app/resources/bookings/appointment/appointment_delete.py +++ b/api/app/resources/bookings/appointment/appointment_delete.py @@ -22,7 +22,7 @@ from app.schemas.bookings import AppointmentSchema from app.utilities.auth_util import Role, get_username from app.utilities.auth_util import is_public_user -from app.utilities.email import get_cancel_email_contents, send_email +from app.utilities.email import get_cancel_email_contents, send_email, can_send_service_notification from app.utilities.snowplow import SnowPlow from qsystem import application from qsystem import api, db, socketio @@ -55,7 +55,7 @@ def delete(self, id): # Do not log snowplow events or send emails if it's a draft. # If the appointment is public user's and if staff deletes it send email - if not appointment.is_draft and csr: + if can_send_service_notification(appointment) and csr: office = Office.find_by_id(appointment.office_id) diff --git a/api/app/resources/bookings/appointment/appointment_draft_post.py b/api/app/resources/bookings/appointment/appointment_draft_post.py index 4e70127f4..45f6ebe38 100644 --- a/api/app/resources/bookings/appointment/appointment_draft_post.py +++ b/api/app/resources/bookings/appointment/appointment_draft_post.py @@ -44,7 +44,7 @@ def post(self): start_time = parse(json_data.get('start_time')) end_time = parse(json_data.get('end_time')) office = Office.find_by_id(office_id) - service = Service.query.get(int(service_id)) if service_id else None + service = db.session.get(Service, int(service_id)) if service_id else None # end_time can be null for CSRs when they click; whereas citizens know end-time. if not end_time: diff --git a/api/app/resources/bookings/appointment/appointment_list.py b/api/app/resources/bookings/appointment/appointment_list.py index cf5a10285..2f7b289e3 100644 --- a/api/app/resources/bookings/appointment/appointment_list.py +++ b/api/app/resources/bookings/appointment/appointment_list.py @@ -13,8 +13,7 @@ limitations under the License.''' import logging -import pytz -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone from flask_restx import Resource from sqlalchemy import exc from app.models.bookings import Appointment @@ -38,7 +37,7 @@ def get(self): # today's date and time dt = datetime.now() upper_dt = dt - timedelta(days=appt_limit_int) - filter_date = pytz.utc.localize(upper_dt) + filter_date = upper_dt.replace(tzinfo=timezone.utc) # print("filter_date",filter_date) try: appointments = Appointment.query.filter_by(office_id=csr.office_id)\ diff --git a/api/app/resources/bookings/appointment/appointment_post.py b/api/app/resources/bookings/appointment/appointment_post.py index 3e296081d..180523c2d 100644 --- a/api/app/resources/bookings/appointment/appointment_post.py +++ b/api/app/resources/bookings/appointment/appointment_post.py @@ -27,7 +27,7 @@ from app.utilities.auth_util import Role, get_username from app.utilities.auth_util import is_public_user from app.utilities.email import get_confirmation_email_contents, send_email, \ - get_blackout_email_contents + get_blackout_email_contents, can_send_service_notification from app.utilities.snowplow import SnowPlow from qsystem import api, api_call_with_retry, db, my_print, application from qsystem import socketio @@ -35,6 +35,18 @@ from app.utilities.sms import send_sms +def _get_valid_service(service_id): + if service_id in (None, ""): + return None + + try: + service_id = int(service_id) + except (TypeError, ValueError): + return None + + return db.session.get(Service, service_id) + + @api.route("/appointments/", methods=["POST"]) class AppointmentPost(Resource): appointment_schema = AppointmentSchema() @@ -87,7 +99,11 @@ def post(self): citizen.citizen_name = user.display_name office = Office.find_by_id(office_id) - service = Service.query.get(int(service_id)) + service = _get_valid_service(service_id) + if service is None: + return { + "message": "Could not find service for service_id: " + str(service_id) + }, 400 # Validate if the same user has other appointments for same day at same office appointments = Appointment.find_by_username_and_office_id(office_id=office_id, @@ -115,6 +131,23 @@ def post(self): csr = CSR.find_by_username(get_username()) office_id = csr.office_id office = Office.find_by_id(office_id) + service_id = json_data.get('service_id') + + # Preserve legacy Newman blackout payloads, which omit service_id for + # internal recurring blackout appointments. + if not (is_blackout_appt and service_id in (None, "")): + service = _get_valid_service(service_id) + if service is None: + return { + "message": "Could not find service for service_id: " + str(service_id) + }, 400 + else: + service = None + + if service is None and not is_blackout_appt: + return { + "message": "Could not find service for service_id: " + str(service_id) + }, 400 citizen.office_id = office_id citizen.qt_xn_citizen_ind = 0 @@ -143,7 +176,7 @@ def post(self): is_stat = (json_data.get('stat_flag', False)) - if ((not is_stat) and (not is_blackout_appt)): + if can_send_service_notification(appointment): # Send confirmation email and sms try: send_email(request.headers['Authorization'].replace('Bearer ', ''), *get_confirmation_email_contents(appointment, office, office.timezone, user)) @@ -163,4 +196,4 @@ def post(self): "errors": {}}, 201 else: - return {"The Appointment Office ID and CSR Office ID do not match!"}, 403 + return {"message": "The Appointment Office ID and CSR Office ID do not match!"}, 403 diff --git a/api/app/resources/bookings/appointment/appointment_put.py b/api/app/resources/bookings/appointment/appointment_put.py index f3553d396..d329da45d 100644 --- a/api/app/resources/bookings/appointment/appointment_put.py +++ b/api/app/resources/bookings/appointment/appointment_put.py @@ -23,12 +23,25 @@ from app.utilities.snowplow import SnowPlow from app.utilities.auth_util import is_public_user from app.utilities.auth_util import Role, get_username -from app.utilities.email import send_email, get_confirmation_email_contents +from app.utilities.email import send_email, get_confirmation_email_contents, can_send_service_notification from app.services import AvailabilityService from dateutil.parser import parse from qsystem import socketio, application from app.utilities.sms import send_sms + +def _get_valid_service(service_id): + if service_id in (None, ""): + return None + + try: + service_id = int(service_id) + except (TypeError, ValueError): + return None + + return db.session.get(Service, service_id) + + @api.route("/appointments//", methods=["PUT"]) class AppointmentPut(Resource): appointment_schema = AppointmentSchema() @@ -54,6 +67,17 @@ def put(self, id): if is_public_user_appt: office_id = json_data.get('office_id') office = Office.find_by_id(office_id) + appointment = Appointment.query.filter_by(appointment_id=id) \ + .filter_by(office_id=office_id) \ + .first_or_404() + + service_id = json_data.get('service_id', appointment.service_id) + service = _get_valid_service(service_id) + if service is None: + return { + "message": "Could not find service for service_id: " + str(service_id) + }, 400 + # user = PublicUser.find_by_username(g.oidc_token_info['username']) # citizen = Citizen.find_citizen_by_username(g.oidc_token_info['username'], office_id) # Validate if the same user has other appointments for same day at same office @@ -69,8 +93,6 @@ def put(self, id): # Check for race condition start_time = parse(json_data.get('start_time')) end_time = parse(json_data.get('end_time')) - service_id = json_data.get('service_id') - service = Service.query.get(int(service_id)) if not AvailabilityService.has_available_slots(office=office, start_time=start_time, end_time=end_time, service=service): return {"code": "CONFLICT_APPOINTMENT", "message": "Cannot create appointment due to scheduling conflict. Please pick another time."}, 400 @@ -79,10 +101,16 @@ def put(self, id): csr = CSR.find_by_username(get_username()) office_id = csr.office_id office = Office.find_by_id(office_id) + if 'service_id' in json_data: + service = _get_valid_service(json_data.get('service_id')) + if service is None: + return { + "message": "Could not find service for service_id: " + str(json_data.get('service_id')) + }, 400 - appointment = Appointment.query.filter_by(appointment_id=id) \ - .filter_by(office_id=office_id) \ - .first_or_404() + appointment = Appointment.query.filter_by(appointment_id=id) \ + .filter_by(office_id=office_id) \ + .first_or_404() # If appointment is not made by same user, throw error if is_public_user_appt: @@ -102,13 +130,14 @@ def put(self, id): db.session.add(appointment) db.session.commit() - # Send confirmation email - try: - send_email(request.headers['Authorization'].replace('Bearer ', ''), *get_confirmation_email_contents(appointment, office, office.timezone, user)) - send_sms(appointment, office, office.timezone, user, - request.headers['Authorization'].replace('Bearer ', '')) - except Exception as exc: - logging.exception('Error on token generation - %s', exc) + if can_send_service_notification(appointment): + # Send confirmation email + try: + send_email(request.headers['Authorization'].replace('Bearer ', ''), *get_confirmation_email_contents(appointment, office, office.timezone, user)) + send_sms(appointment, office, office.timezone, user, + request.headers['Authorization'].replace('Bearer ', '')) + except Exception as exc: + logging.exception('Error on token generation - %s', exc) # Make Snowplow call. schema = 'appointment_update' diff --git a/api/app/resources/bookings/appointment/appointment_reminder_get.py b/api/app/resources/bookings/appointment/appointment_reminder_get.py index 2fb405114..a465bafa6 100644 --- a/api/app/resources/bookings/appointment/appointment_reminder_get.py +++ b/api/app/resources/bookings/appointment/appointment_reminder_get.py @@ -17,7 +17,7 @@ from app.models.bookings import Appointment from app.utilities.auth_util import Role, has_any_role from app.utilities.email import is_valid_email, formatted_date, get_email, \ - get_duration + get_duration, can_send_service_notification from qsystem import api, api_call_with_retry from app.auth.auth import jwt from app.utilities.sms import is_valid_phone, format_sms_date @@ -52,7 +52,7 @@ def get(self, reminder_type: str = 'email'): send_reminder = True user_telephone = appointment.contact_information - if send_reminder: + if send_reminder and can_send_service_notification(appointment): if reminder_type == 'email': date, day = formatted_date(appointment.start_time, timezone) else: diff --git a/api/app/resources/bookings/booking/booking_post.py b/api/app/resources/bookings/booking/booking_post.py index 64325b6a5..faa135874 100644 --- a/api/app/resources/bookings/booking/booking_post.py +++ b/api/app/resources/bookings/booking/booking_post.py @@ -82,4 +82,4 @@ def post(self): return {"booking": result, "errors": self.booking_schema.validate(booking)}, 201 else: - return {"The Booking Office ID and CSR Office ID do not match!"}, 403 + return {"message": "The Booking Office ID and CSR Office ID do not match!"}, 403 diff --git a/api/app/resources/bookings/booking/booking_put.py b/api/app/resources/bookings/booking/booking_put.py index 39b21106b..d61f04862 100644 --- a/api/app/resources/bookings/booking/booking_put.py +++ b/api/app/resources/bookings/booking/booking_put.py @@ -83,4 +83,4 @@ def put(self, id): "errors": self.booking_schema.validate(booking)}, 200 else: - return {"The Booking Office ID and the CSR Office ID do not match!"}, 403 + return {"message": "The Booking Office ID and the CSR Office ID do not match!"}, 403 diff --git a/api/app/resources/bookings/booking/booking_recurring_delete.py b/api/app/resources/bookings/booking/booking_recurring_delete.py index f84f9a4d5..985e9797c 100644 --- a/api/app/resources/bookings/booking/booking_recurring_delete.py +++ b/api/app/resources/bookings/booking/booking_recurring_delete.py @@ -18,7 +18,7 @@ from app.models.theq import CSR from qsystem import api, db from datetime import datetime, timedelta, date -import logging, pytz +import logging from app.utilities.auth_util import Role, get_username from app.auth.auth import jwt @@ -27,7 +27,6 @@ class BookingRecurringDelete(Resource): booking_schema = BookingSchema - timezone = pytz.timezone("US/Pacific") @jwt.has_one_of_roles([Role.internal_user.value]) def delete(self, id): @@ -54,4 +53,4 @@ def delete(self, id): db.session.delete(booking) db.session.commit() - return {},204 \ No newline at end of file + return {},204 diff --git a/api/app/resources/bookings/booking/booking_recurring_stat_delete.py b/api/app/resources/bookings/booking/booking_recurring_stat_delete.py index 30c68fc74..ec93975e8 100644 --- a/api/app/resources/bookings/booking/booking_recurring_stat_delete.py +++ b/api/app/resources/bookings/booking/booking_recurring_stat_delete.py @@ -18,7 +18,7 @@ from app.models.theq import CSR from qsystem import api, db from datetime import datetime, timedelta, date -import logging, pytz +import logging from app.utilities.auth_util import Role, get_username from app.auth.auth import jwt @@ -27,7 +27,6 @@ class BookingRecurringDelete(Resource): booking_schema = BookingSchema - timezone = pytz.timezone("US/Pacific") @jwt.has_one_of_roles([Role.internal_user.value]) def delete(self, id): @@ -58,7 +57,6 @@ def delete(self, id): class BookingRecurringDelete(Resource): booking_schema = BookingSchema - timezone = pytz.timezone("US/Pacific") @jwt.has_one_of_roles([Role.internal_user.value]) def delete(self, id): @@ -78,4 +76,4 @@ def delete(self, id): db.session.delete(booking) db.session.commit() - return {},204 \ No newline at end of file + return {},204 diff --git a/api/app/resources/bookings/exam/exam_bcmp.py b/api/app/resources/bookings/exam/exam_bcmp.py index c07c3411d..a56c1c39f 100644 --- a/api/app/resources/bookings/exam/exam_bcmp.py +++ b/api/app/resources/bookings/exam/exam_bcmp.py @@ -39,21 +39,22 @@ def post(self): csr = CSR.find_by_username(get_username()) json_data = request.get_json() + exam_payload = ExamPost.model_payload(json_data) if 'bookdata' in json_data.keys(): booking = json_data["bookdata"] else: booking = None - exam = self.exam_schema.load(json_data) - warning = self.exam_schema.validate(json_data) + exam = self.exam_schema.load(exam_payload) + warning = self.exam_schema.validate(exam_payload) if warning: logging.warning("WARNING: %s", warning) return {"message": warning}, 422 if not (exam.office_id == csr.office_id or csr.ita2_designate == 1): - return {"The Exam Office ID and CSR Office ID do not match!"}, 403 + return {"message": "The Exam Office ID and CSR Office ID do not match!"}, 403 formatted_data = ExamPost.format_data(self, json_data, exam) exam = formatted_data["exam"] @@ -82,4 +83,3 @@ def post(self): else: return {"message": "create_group_exam_bcmp failed", "error": bcmp_response}, 403 - diff --git a/api/app/resources/bookings/exam/exam_bulk_status.py b/api/app/resources/bookings/exam/exam_bulk_status.py index a101fbdb9..9924a6a2c 100644 --- a/api/app/resources/bookings/exam/exam_bulk_status.py +++ b/api/app/resources/bookings/exam/exam_bulk_status.py @@ -45,14 +45,15 @@ def post(self): my_print("job_ids to update: ") my_print(job_ids) - exams_tobe_updated = None + updated_exam_ids = [] if len(job_ids) != 0: - exams_tobe_updated = Exam.query.filter(Exam.bcmp_job_id.in_(job_ids)) + exams_tobe_updated = Exam.query.filter(Exam.bcmp_job_id.in_(job_ids)).all() for exam in exams_tobe_updated: exam_upd = self.exam_schema.load({'upload_received_ind': 1}, instance=exam, partial=True) db.session.add(exam_upd) + updated_exam_ids.append(exam.exam_id) try: db.session.commit() @@ -60,7 +61,7 @@ def post(self): db.session.rollback() raise - return {"exams_updated": exams_tobe_updated}, 200 + return {"exams_updated": updated_exam_ids}, 200 except exc.SQLAlchemyError as error: logging.error(error, exc_info=True) diff --git a/api/app/resources/bookings/exam/exam_download.py b/api/app/resources/bookings/exam/exam_download.py index 881b2af64..0b7fd4da2 100644 --- a/api/app/resources/bookings/exam/exam_download.py +++ b/api/app/resources/bookings/exam/exam_download.py @@ -12,12 +12,11 @@ See the License for the specific language governing permissions and limitations under the License.''' -from flask import Response +from flask import send_file from flask_restx import Resource import io import logging import urllib -from werkzeug.wsgi import FileWrapper from sqlalchemy import exc from app.models.theq import CSR from app.models.bookings import Exam @@ -50,15 +49,12 @@ def get(self, exam_id): req = urllib.request.Request(package_url) response = urllib.request.urlopen(req).read() exam_file = io.BytesIO(response) - file_wrapper = FileWrapper(exam_file) - - return Response(file_wrapper, - mimetype="application/pdf", - direct_passthrough=True, - headers={ - "Content-Disposition": 'attachment; filename="%s.csv"' % exam.exam_id, - "Content-Type": "application/pdf" - }) + return send_file( + exam_file, + mimetype="application/pdf", + as_attachment=True, + download_name=f"{exam.exam_id}.pdf" + ) else: return {'message': 'Package not yet generated', 'status': job['jobStatus']}, 400 diff --git a/api/app/resources/bookings/exam/exam_email_invigilator.py b/api/app/resources/bookings/exam/exam_email_invigilator.py index c75ba69ba..1ac798254 100644 --- a/api/app/resources/bookings/exam/exam_email_invigilator.py +++ b/api/app/resources/bookings/exam/exam_email_invigilator.py @@ -37,7 +37,7 @@ def post(self, exam_id): exam = Exam.query.filter_by(exam_id=exam_id).first() if not (exam.office_id == csr.office_id or csr.ita2_designate == 1): - return {"The Exam Office ID and CSR Office ID do not match!"}, 403 + return {"message": "The Exam Office ID and CSR Office ID do not match!"}, 403 json_data = request.get_json() invigilator_id = json_data["invigilator_id"] @@ -46,7 +46,7 @@ def post(self, exam_id): invigilator_phone = json_data["invigilator_phone"] if not invigilator_email or not invigilator_phone or not invigilator_name: - return {"Invigilator name, email, and phone number are required"}, 422 + return {"message": "Invigilator name, email, and phone number are required"}, 422 response = self.bcmp_service.email_exam_invigilator( exam, diff --git a/api/app/resources/bookings/exam/exam_event_id_detail.py b/api/app/resources/bookings/exam/exam_event_id_detail.py index ecfc99bc5..8be42f32a 100644 --- a/api/app/resources/bookings/exam/exam_event_id_detail.py +++ b/api/app/resources/bookings/exam/exam_event_id_detail.py @@ -1,4 +1,4 @@ -'''Copyright 2018 Province of British Columbia +"""Copyright 2018 Province of British Columbia Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -10,21 +10,21 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and -limitations under the License.''' +limitations under the License.""" import logging -from flask_restx import Resource -from sqlalchemy import exc + +from app.auth.auth import jwt from app.models.bookings import Exam from app.schemas.bookings import ExamSchema -from qsystem import api from app.utilities.auth_util import Role, has_any_role -from app.auth.auth import jwt +from flask_restx import Resource +from qsystem import api +from sqlalchemy import exc -@api.route("/exams/event_id//", methods=["GET"]) +@api.route("/exams/event_id//", methods=["GET"]) class ExamEventIDDetail(Resource): - exam_schema = ExamSchema() @jwt.has_one_of_roles([Role.internal_user.value]) @@ -34,12 +34,11 @@ def get(self, id): exam = Exam.query.filter_by(event_id=str(id)).all() if not exam: - return {'message': False}, 200 + return {"message": False}, 200 else: - return {'message': True}, 200 + return {"message": True}, 200 except exc.SQLAlchemyError as error: - logging.error(error, exc_info=True) return {"message": "API is down"}, 500 diff --git a/api/app/resources/bookings/exam/exam_export_list.py b/api/app/resources/bookings/exam/exam_export_list.py index 189e4bea0..eb2faa83d 100644 --- a/api/app/resources/bookings/exam/exam_export_list.py +++ b/api/app/resources/bookings/exam/exam_export_list.py @@ -22,11 +22,11 @@ from app.schemas.theq import OfficeSchema, TimezoneSchema from qsystem import api, my_print from datetime import datetime, timedelta, timezone -import pytz import csv import io from app.utilities.auth_util import Role, get_username from app.auth.auth import jwt +from app.utilities.timezone_utils import get_timezone, localize @api.route("/exams/export/", methods=["GET"]) @@ -48,7 +48,9 @@ def get(self): end_param = request.args.get("end_date") exam_type = request.args.get("exam_type") - validate_params(start_param, end_param) + validation_error = validate_params(start_param, end_param) + if validation_error: + return validation_error try: start_date = datetime.strptime(request.args['start_date'], "%Y-%m-%d") @@ -56,16 +58,16 @@ def get(self): except ValueError as exception: logging.exception(exception) - return {"message", "Unable to return date time string"}, 422 + return {"message": "Unable to return date time string"}, 422 # Code for UTC time. csr_office = Office.query.filter(Office.office_id == csr.office_id).first() csr_timezone = Timezone.query.filter(Timezone.timezone_id == csr_office.timezone_id).first() csr_timename = csr_timezone.timezone_name - timezone = pytz.timezone(csr_timename) - start_local = timezone.localize(start_date) + timezone = get_timezone(csr_timename) + start_local = localize(start_date, csr_timename) end_date += timedelta(days=1) - end_local = timezone.localize(end_date) + end_local = localize(end_date, csr_timename) exams = Exam.query.join(Booking, Exam.booking_id == Booking.booking_id) \ .filter(Booking.start_time >= start_local) \ @@ -339,6 +341,7 @@ def write_exam_returned(row, exam): def validate_params(start_param, end_param): if not (start_param and end_param): return {"message": "Must provide both start and end time"}, 422 + return None def write_non_exam_name(booking, row): diff --git a/api/app/resources/bookings/exam/exam_list.py b/api/app/resources/bookings/exam/exam_list.py index dd5cc2229..3e48dc7a7 100644 --- a/api/app/resources/bookings/exam/exam_list.py +++ b/api/app/resources/bookings/exam/exam_list.py @@ -17,7 +17,7 @@ from flask_restx import Resource from sqlalchemy import exc, or_, desc from app.models.bookings import Exam -from app.models.theq import CSR +from app.models.theq import CSR, Office from app.schemas.bookings import ExamSchema from qsystem import api from datetime import datetime, timedelta @@ -42,8 +42,8 @@ def get(self): exams = Exam.query.filter(Exam.deleted_date.is_(None)) \ .filter(or_(Exam.exam_returned_date.is_(None), Exam.exam_returned_date > ninety_day_filter)) \ - .join(Exam.office, aliased=True) \ - .filter_by(office_number=request.args.get("office_number")) \ + .join(Exam.office) \ + .filter(Office.office_number == request.args.get("office_number")) \ .order_by(desc(Exam.exam_id)) else: exams = Exam.query.filter(Exam.deleted_date.is_(None)) \ diff --git a/api/app/resources/bookings/exam/exam_post.py b/api/app/resources/bookings/exam/exam_post.py index bf3acba9f..c9e279679 100644 --- a/api/app/resources/bookings/exam/exam_post.py +++ b/api/app/resources/bookings/exam/exam_post.py @@ -33,6 +33,29 @@ class ExamPost(Resource): exam_schema = ExamSchema() bcmp_service = BCMPService() + @staticmethod + def model_payload(json_data): + """Strip request-only BCMP fields before loading a SQLAlchemy Exam model.""" + payload = dict(json_data) + + for field_name in ( + "bookdata", + "candidates", + "fees", + "ind_or_group", + "receipt_number", + "sbc_managed", + ): + payload.pop(field_name, None) + + if "receipt" not in payload and json_data.get("receipt_number") is not None: + payload["receipt"] = json_data["receipt_number"] + + if "sbc_managed_ind" not in payload and "sbc_managed" in json_data: + payload["sbc_managed_ind"] = 1 if json_data["sbc_managed"] == "sbc" else 0 + + return payload + @jwt.has_one_of_roles([Role.internal_user.value]) @api_call_with_retry def post(self): @@ -45,9 +68,10 @@ def post(self): csr = CSR.find_by_username(get_username()) json_data = request.get_json() + exam_payload = self.model_payload(json_data) - exam = self.exam_schema.load(json_data) - warning = self.exam_schema.validate(json_data) + exam = self.exam_schema.load(exam_payload) + warning = self.exam_schema.validate(exam_payload) my_print("json_data: ") my_print(json_data) @@ -57,7 +81,7 @@ def post(self): return {"message": warning}, 422 if not (exam.office_id == csr.office_id or csr.ita2_designate == 1): - return {"The Exam Office ID and CSR Office ID do not match!"}, 403 + return {"message": "The Exam Office ID and CSR Office ID do not match!"}, 403 if exam.is_pesticide: formatted_data = self.format_data(json_data, exam) @@ -134,4 +158,3 @@ def format_data(self, json_data, exam): 'candidates_list_bcmp': candidates_list_bcmp, 'pesticide_office': pesticide_office, } - diff --git a/api/app/resources/bookings/walkin/walkin.py b/api/app/resources/bookings/walkin/walkin.py index 79055af70..ba8ef0b1f 100644 --- a/api/app/resources/bookings/walkin/walkin.py +++ b/api/app/resources/bookings/walkin/walkin.py @@ -11,7 +11,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.''' -import logging, pytz +import logging from datetime import datetime, timedelta, timezone from flask import request, g from flask_restx import Resource @@ -29,6 +29,7 @@ from app.utilities.sms import send_walkin_reminder_sms from sqlalchemy.dialects import postgresql from sqlalchemy.orm import raiseload, joinedload, contains_eager +from app.utilities.timezone_utils import UTC, as_utc, get_timezone # Defining String constants to appease SonarQube api_down_const = 'API is down' @@ -88,7 +89,7 @@ def get_my_office_timezone(self, citizen=False, office=False): my_office_data = self.office_schema.dump(my_office) if my_office_data: my_time_zone = my_office_data['timezone']['timezone_name'] - local_timezone = pytz.timezone(my_time_zone) + local_timezone = get_timezone(my_time_zone) return local_timezone def am_i_on_hold(self, citizen): @@ -143,9 +144,9 @@ def process_all_citizen_in_q(self, result, citizen, am_on_hold, local_timezone): if (not_booked_flag and each.get('cs', False)) and each['cs'].get('cs_state_name', '') == 'Active': each_time_obj = datetime.strptime(each['start_time'], '%Y-%m-%dT%H:%M:%SZ') # start - local_datetime_start = each_time_obj.replace(tzinfo=pytz.utc).astimezone(local_timezone) + local_datetime_start = each_time_obj.replace(tzinfo=UTC).astimezone(local_timezone) #end - local_datetime_end = citizen.start_time.replace(tzinfo=pytz.utc).astimezone(local_timezone) + local_datetime_end = citizen.start_time.replace(tzinfo=UTC).astimezone(local_timezone) if am_on_hold or local_datetime_start <= local_datetime_end: data_dict['flag'] = 'walkin_app' walkin_app.append(data_dict) @@ -163,18 +164,8 @@ def get_all_app_from_agenda_panel(self, citizen=False, office=False): if office_id: past_hour = datetime.now(timezone.utc) - timedelta(minutes=15) future_hour = datetime.now(timezone.utc) + timedelta(minutes=15) - if past_hour.tzinfo is None: - # If it's naive, localize to UTC - local_past = pytz.utc.localize(past_hour) - else: - # If it's already timezone-aware, no need to localize - local_past = past_hour - if future_hour.tzinfo is None: - # Only localize if the datetime is naive - local_future = pytz.utc.localize(future_hour) - else: - # If it's already timezone-aware, no need to localize - local_future = future_hour + local_past = as_utc(past_hour) + local_future = as_utc(future_hour) # getting agenda panel app appointments = Appointment.query.filter_by(office_id=office_id)\ .filter(Appointment.start_time <= local_future)\ @@ -196,7 +187,7 @@ def process_agenda_panel(self, result_in_book, local_timezone): if (len(data_dict['start_time']) >= 3) and ':' in data_dict['start_time'][-3]: data_dict['start_time'] = '{}{}'.format(data_dict['start_time'][:-3], data_dict['start_time'][-2:]) utc_datetime = datetime.strptime(data_dict['start_time'], '%Y-%m-%dT%H:%M:%S%z') - local_datetime = utc_datetime.replace(tzinfo=pytz.utc) + local_datetime = utc_datetime.replace(tzinfo=UTC) local_datetime = local_datetime.astimezone(local_timezone) data_dict['start_time'] = local_datetime.strftime("%m/%d/%Y, %H:%M:%S") booked_not_checkin.append(data_dict) @@ -398,4 +389,4 @@ def get(self, id): return {} except exc.SQLAlchemyError as exception: logging.exception(exception) - return {'message': api_down_const}, 500 \ No newline at end of file + return {'message': api_down_const}, 500 diff --git a/api/app/resources/theq/citizen/citizen_detail.py b/api/app/resources/theq/citizen/citizen_detail.py index 214d51fef..60dbbc16b 100644 --- a/api/app/resources/theq/citizen/citizen_detail.py +++ b/api/app/resources/theq/citizen/citizen_detail.py @@ -50,13 +50,10 @@ def get(self, id): @jwt.has_one_of_roles([Role.internal_user.value]) @api_call_with_retry def put(self, id): - json_data = request.get_json() + json_data = request.get_json(silent=True) or {} if 'counter_id' not in json_data: - json_data['counter_id'] = counter_id - - if not json_data: - return {'message': 'No input data received for updating citizen'}, 400 + json_data['counter_id'] = get_counter_id() csr = CSR.find_by_username(get_username()) citizen = Citizen.query.filter_by(citizen_id=id).first() @@ -108,13 +105,11 @@ def put(self, id): return {'citizen': result, 'errors': self.citizen_schema.validate(citizen)}, 200 - -try: - counter = Counter.query.filter(Counter.counter_name=="Counter")[0] - counter_id = counter.counter_id -# NOTE!! There should ONLY be an exception when first building the database -# from a python3 manage.py db upgrade command. -except: - counter_id = 1 - logging.exception("==> In citizen_detail.py") - logging.exception(" --> NOTE!! You should only see this if doing a 'python3 manage.py db upgrade'") +def get_counter_id(): + try: + counter = Counter.query.filter(Counter.counter_name == "Counter")[0] + return counter.counter_id + except Exception: + logging.exception("==> In citizen_detail.py") + logging.exception(" --> NOTE!! You should only see this if doing a 'python3 manage.py db upgrade'") + return 1 diff --git a/api/app/resources/theq/citizen/citizen_finish_service.py b/api/app/resources/theq/citizen/citizen_finish_service.py index 6b4004ace..d7162f32d 100644 --- a/api/app/resources/theq/citizen/citizen_finish_service.py +++ b/api/app/resources/theq/citizen/citizen_finish_service.py @@ -27,6 +27,29 @@ from sqlalchemy.dialects import postgresql +def _citizen_finish_service_query(citizen_id): + return Citizen.query \ + .options( + joinedload(Citizen.service_reqs).options( + joinedload(ServiceReq.periods).options( + joinedload(Period.ps).options(raiseload('*')), + joinedload(Period.csr).options(raiseload('*')), + raiseload('*') + ), + joinedload(ServiceReq.service).options( + joinedload(Service.parent).options( + raiseload(Service.parent).options(raiseload('*')) + ), + raiseload('*') + ) + ), + raiseload(Citizen.user), + joinedload(Citizen.counter), + joinedload(Citizen.office).options(joinedload(Office.sb), raiseload('*')) + ) \ + .filter_by(citizen_id=citizen_id) + + @api.route("/citizens//finish_service/", methods=["POST"]) class CitizenFinishService(Resource): @@ -37,11 +60,7 @@ class CitizenFinishService(Resource): @api_call_with_retry def post(self, id): csr = CSR.find_by_username(get_username()) - citizen = Citizen.query\ - .options(joinedload(Citizen.service_reqs).options(joinedload(ServiceReq.periods).options(joinedload(Period.ps).options(raiseload('*')),joinedload(Period.csr).options(raiseload('*')),raiseload('*')), joinedload(ServiceReq.service).options(joinedload(Service.parent).options(raiseload(Service.parent).options(raiseload('*'))),raiseload('*'))), raiseload(Citizen.counter),raiseload(Citizen.user), joinedload(Citizen.counter), joinedload(Citizen.office).options(joinedload(Office.sb),raiseload('*'))) \ - .filter_by(citizen_id=id) - - citizen = citizen.first() + citizen = _citizen_finish_service_query(id).first() my_print("==> POST /citizens/" + str(citizen.citizen_id) + '/finish_service/, Ticket: ' + citizen.ticket_number) active_service_request = citizen.get_active_service_request() diff --git a/api/app/resources/theq/citizen/citizen_generic_invite.py b/api/app/resources/theq/citizen/citizen_generic_invite.py index 57ffd8f56..7fc61a346 100644 --- a/api/app/resources/theq/citizen/citizen_generic_invite.py +++ b/api/app/resources/theq/citizen/citizen_generic_invite.py @@ -22,7 +22,7 @@ from datetime import datetime from app.utilities.auth_util import Role, get_username from app.auth.auth import jwt -from sqlalchemy.orm import contains_eager, raiseload, joinedload +from sqlalchemy.orm import raiseload from sqlalchemy.dialects import postgresql @@ -50,11 +50,10 @@ def find_wait(): @api_call_with_retry def find_citizen(counter_id, active_citizen_state, csr, waiting_period_state): citizen = Citizen.query \ - .options(joinedload(Citizen.service_reqs, innerjoin=True).joinedload(ServiceReq.periods, innerjoin=True).options(raiseload(Period.sr),joinedload(Period.csr).raiseload('*')),raiseload(Citizen.office),raiseload(Citizen.counter),raiseload(Citizen.user)) \ + .options(raiseload(Citizen.office), raiseload(Citizen.counter), raiseload(Citizen.user)) \ .filter_by(counter_id=counter_id, cs_id=active_citizen_state.cs_id, office_id=csr.office_id) \ .join(Citizen.service_reqs) \ .join(ServiceReq.periods) \ - .options(contains_eager(Citizen.service_reqs).contains_eager(ServiceReq.periods)) \ .filter_by(ps_id=waiting_period_state.ps_id) \ .filter(Period.time_end.is_(None)) \ .order_by(Citizen.priority, Citizen.start_time) @@ -65,11 +64,10 @@ def find_citizen(counter_id, active_citizen_state, csr, waiting_period_state): @api_call_with_retry def find_citizen2(active_citizen_state, csr, waiting_period_state): citizen = Citizen.query \ - .options(joinedload(Citizen.service_reqs, innerjoin=True).joinedload(ServiceReq.periods, innerjoin=True).options(raiseload(Period.sr),joinedload(Period.csr).raiseload('*')),raiseload(Citizen.office),raiseload(Citizen.counter),raiseload(Citizen.user)) \ + .options(raiseload(Citizen.office), raiseload(Citizen.counter), raiseload(Citizen.user)) \ .filter_by(cs_id=active_citizen_state.cs_id, office_id=csr.office_id) \ .join(Citizen.service_reqs) \ .join(ServiceReq.periods) \ - .options(contains_eager(Citizen.service_reqs).contains_eager(ServiceReq.periods)) \ .filter_by(ps_id=waiting_period_state.ps_id) \ .filter(Period.time_end.is_(None)) \ .order_by(Citizen.priority, Citizen.citizen_id) @@ -125,11 +123,11 @@ def post(self): lock = FileLock("lock/invite_citizen_{}.lock".format(csr.office_id)) with lock: - active_citizen_state = citizen_state + active_citizen_state = find_active() waiting_period_state = find_wait() citizen = None - json_data = request.get_json() + json_data = request.get_json(silent=True) or {} if json_data and 'counter_id' in json_data: counter_id = int(json_data.get('counter_id')) @@ -170,11 +168,3 @@ def post(self): return {'citizen': result, 'errors': self.citizen_schema.validate(citizen)}, 200 - -try: - citizen_state = CitizenState.query.filter_by(cs_state_name="Active").first() - active_id = citizen_state.cs_id -except: - active_id = 1 - logging.exception("==> In citizen_generic_invite.py") - logging.exception(" --> NOTE!! You should only see this if doing a 'python3 manage.py db upgrade'") diff --git a/api/app/resources/theq/citizen/citizen_list.py b/api/app/resources/theq/citizen/citizen_list.py index 217283000..2ff8c5773 100644 --- a/api/app/resources/theq/citizen/citizen_list.py +++ b/api/app/resources/theq/citizen/citizen_list.py @@ -45,7 +45,7 @@ def get(self): citizens = Citizen.query \ .options(joinedload(Citizen.service_reqs, innerjoin=True).joinedload(ServiceReq.periods).options(raiseload(Period.sr),joinedload(Period.csr).raiseload('*')),raiseload(Citizen.office),raiseload(Citizen.counter),raiseload(Citizen.user)) \ - .filter_by(office_id=csr.office_id, cs_id=active_id) \ + .filter_by(office_id=csr.office_id, cs_id=get_active_citizen_state_id()) \ .order_by(Citizen.priority) result = self.citizens_schema.dump(citizens) @@ -69,7 +69,7 @@ def post(self, citizens_waiting): has_role([Role.internal_user.value], g.jwt_oidc_token_info['realm_access']['roles'], username, "CitizenList POST /citizens/") - json_data = request.get_json() + json_data = request.get_json(silent=True) csr = CSR.find_by_username(username) if not csr: @@ -89,7 +89,7 @@ def post(self, citizens_waiting): logging.exception(err) return {"message": err.messages}, 422 - citizen.cs_id = active_id + citizen.cs_id = get_active_citizen_state_id() citizen.service_count = 1 db.session.add(citizen) db.session.commit() @@ -101,11 +101,11 @@ def post(self, citizens_waiting): return {'citizen': result, 'errors': self.citizen_schema.validate(citizen)}, 201 -try: - key = get_key() - citizen_state = CitizenState.query.filter_by(cs_state_name="Active").first() - active_id = citizen_state.cs_id -except: - active_id = 1 - logging.exception("==> In citizen_list.py") - logging.exception(" --> NOTE!! You should only see this if doing a 'python3 manage.py db upgrade'") +def get_active_citizen_state_id(): + try: + citizen_state = CitizenState.query.filter_by(cs_state_name="Active").first() + return citizen_state.cs_id + except Exception: + logging.exception("==> In citizen_list.py") + logging.exception(" --> NOTE!! You should only see this if doing a 'python3 manage.py db upgrade'") + return 1 diff --git a/api/app/resources/theq/csrs.py b/api/app/resources/theq/csrs.py index 5abd13746..60af29a4b 100644 --- a/api/app/resources/theq/csrs.py +++ b/api/app/resources/theq/csrs.py @@ -21,9 +21,9 @@ from app.models.theq import Citizen, CSR, Period, ServiceReq, SRState from app.schemas.bookings import ExamSchema, ExamTypeSchema from app.schemas.theq import CitizenSchema, CSRSchema -import pytz from app.utilities.auth_util import Role, get_username from app.auth.auth import jwt +from app.utilities.timezone_utils import get_timezone, localize @api.route("/csrs/", methods=["GET"]) @@ -58,7 +58,7 @@ class CsrSelf(Resource): citizen_schema = CitizenSchema(many=True) exam_schema = ExamSchema(many=True) exam_type_schema = ExamTypeSchema() - timezone = pytz.timezone("US/Pacific") + timezone = get_timezone("America/Vancouver") back_office_display = application.config['BACK_OFFICE_DISPLAY'] recurring_feature_flag = application.config['RECURRING_FEATURE_FLAG'] @@ -75,7 +75,7 @@ def get(self): db.session.add(csr) active_sr_state = SRState.get_state_by_name("Active") today = datetime.now() - start_date = self.timezone.localize(today).date() + start_date = localize(today, "America/Vancouver").date() active_citizens = Citizen.query \ .join(Citizen.service_reqs) \ diff --git a/api/app/resources/theq/feedback.py b/api/app/resources/theq/feedback.py index 31629c991..0bcd16c37 100644 --- a/api/app/resources/theq/feedback.py +++ b/api/app/resources/theq/feedback.py @@ -19,19 +19,19 @@ import urllib.request import urllib.parse import os -import pysnow import requests import json from app.utilities.auth_util import Role, has_any_role from app.auth.auth import jwt +request_timeout_seconds = 30 + @api.route("/feedback/", methods=['POST']) class Feedback(Resource): feedback_destinations = application.config['THEQ_FEEDBACK'] flag_teams = "TEAMS" in feedback_destinations - flag_service_now = "SERVICENOW" in feedback_destinations flag_rocket_chat = "ROCKETCHAT" in feedback_destinations @jwt.has_one_of_roles([Role.internal_user.value]) @@ -46,26 +46,21 @@ def post(self): return {"message": "Must provide message to send as feedback"}, 422 teams_result = None - service_now_result = None rocket_chat_result = None if self.flag_teams: teams_result = Feedback.send_to_teams(feedback_message) - if self.flag_service_now: - service_now_result = Feedback.send_to_service_now(feedback_message) - if self.flag_rocket_chat: rocket_chat_result = Feedback.send_to_rocket_chat(feedback_message) - # Calculate return message as combination of teams and service now results. - result = Feedback.combine_results("Teams: ", teams_result, "Service Now: ", service_now_result) - result = Feedback.combine_results("", result, "Rocket Chat: ", rocket_chat_result) + # Calculate return message as combination + result = Feedback.combine_results("Teams: ", teams_result, "Rocket Chat: ", rocket_chat_result) return result @staticmethod def send_to_teams(feedback_message): - + url = application.config['TEAMS_URL'] if url is None: @@ -88,77 +83,9 @@ def send_to_teams(feedback_message): else: return {"message": "error", "http_code": resp.getcode()}, 400 - @staticmethod - def send_to_service_now(params): - - instance = application.config['SERVICENOW_INSTANCE'] - user = application.config['SERVICENOW_USER'] - password = application.config['SERVICENOW_PASSWORD'] - table = application.config['SERVICENOW_TABLE'] - tenant = application.config['SERVICENOW_TENANT'] - assign_group = application.config['SERVICENOW_ASSIGN_GROUP'] - - if instance is None: - return {"message": "SERVICENOW_INSTANCE is not set"}, 400 - if user is None: - return {"message": "SERVICENOW_USER is not set"}, 400 - if password is None: - return {"message": "SERVICENOW_PASSWORD is not set"}, 400 - if table is None: - return {"message": "SERVICENOW_TABLE is not set"}, 400 - if tenant is None: - return {"message": "SERVICENOW_TENANT is not set"}, 400 - if assign_group is None: - return {"message": "SERVICENOW_ASSIGN_GROUP is not set"}, 400 - - # Generate Service Now incident. - # NOTE: Automatic email gets sent to the assignment group below - # ONLY IF the email of the SERVICENOW_USER IS NOT the same - # as the email of this assignment group. - - c = pysnow.Client(instance = instance, user=user, password=password) - incident = c.resource(api_path=table) - csr = Feedback.extract_string(params, "Username: ", "\n", 0) - ticket = Feedback.extract_string(params, "Ticket Number: ","\n", 0) - msg = Feedback.extract_string(params, "Message: ", "", 50) - short_desc = "TheQ Feedback (CSR: " + csr + "; Ticket: " + ticket + "; Msg: " + msg + ")" - - # Create new record depending on tenant value. - if len(tenant) != 0: - new_record = { - 'caller_id': user, - 'category': 'Inquiry / Help', - 'cmdb_ci': 'CFMS', - 'u_tenant': tenant, - 'impact': '2 - Some Customers', - 'urgency': '2 - High', - 'priority': 'High', - 'short_description': short_desc, - 'description': params, - 'assignment_group': assign_group - } - else: - new_record = { - 'category': 'Inquiry / Help', - 'cmdb_ci': 'CFMS', - 'impact': '2 - Some Customers', - 'urgency': '2 - High', - 'priority': 'High', - 'short_description': short_desc, - 'description': params, - 'assignment_group': assign_group - } - - result = incident.create(payload=new_record) - - if '201' in str(result): - return {"status": "Success"}, 201 - else: - return {"message": "Service Now incident not created"}, 400 - @staticmethod def send_to_rocket_chat(feedback_message): - + url = application.config['ROCKET_CHAT_URL'] if url is None: @@ -169,7 +96,7 @@ def send_to_rocket_chat(feedback_message): } params = json.dumps(feedback_json_data).encode('utf8') try: - result = requests.post(url, params) + result = requests.post(url, json=feedback_json_data, timeout=request_timeout_seconds) except Exception as err: return {"message": "Error posting to Rocket Chat. " + str(err)}, 400 diff --git a/api/app/resources/theq/health.py b/api/app/resources/theq/health.py index 1dd8bf280..f6090fb41 100644 --- a/api/app/resources/theq/health.py +++ b/api/app/resources/theq/health.py @@ -24,7 +24,7 @@ class Healthz(Resource): @staticmethod def get(): try: - db.engine.execute(sql) + db.session.execute(sql) except exc.SQLAlchemyError: return {"message": "api is down"}, 500 diff --git a/api/app/resources/theq/login.py b/api/app/resources/theq/login.py index 6284c038f..d5b55f855 100644 --- a/api/app/resources/theq/login.py +++ b/api/app/resources/theq/login.py @@ -30,26 +30,15 @@ class Login(Resource): @jwt.requires_auth_cookie def get(self): username = get_username() - if username != '': - csr = CSR.find_by_username(username) - if csr: - if csr.deleted is None: - csr.is_active = True - else: - csr.is_active = False - - csr.is_authenticated = False - csr.is_anonymous = False - - login_user(csr) - if application.config['USE_HTTPS']: - return redirect(url_for(admin_index_const, - _scheme=application.config['PREFERRED_URL_SCHEME'], - _external=application.config['USE_HTTPS'])) - else: - return redirect(url_for(admin_index_const)) + csr = CSR.find_by_username(username) + if csr: + login_user(csr) + if application.config['USE_HTTPS']: + return redirect(url_for(admin_index_const, + _scheme=application.config['PREFERRED_URL_SCHEME'], + _external=application.config['USE_HTTPS'])) else: - return abort(401, self.auth_string) + return redirect(url_for(admin_index_const)) else: return abort(401, self.auth_string) diff --git a/api/app/resources/theq/service_requests_detail.py b/api/app/resources/theq/service_requests_detail.py index afdebdcbc..e3a7eb36c 100644 --- a/api/app/resources/theq/service_requests_detail.py +++ b/api/app/resources/theq/service_requests_detail.py @@ -43,7 +43,7 @@ def put(self, id): csr = CSR.find_by_username(get_username()) service_request = ServiceReq.query.filter_by(sr_id=id) \ - .join(ServiceReq.citizen, aliased=True).first_or_404() + .join(ServiceReq.citizen).first_or_404() try: service_request = self.service_request_schema.load(json_data, instance=service_request, partial=True) @@ -77,8 +77,8 @@ def post(self, id): csr = CSR.find_by_username(get_username()) service_request = ServiceReq.query.filter_by(sr_id=id) \ - .join(ServiceReq.citizen, aliased=True) \ - .filter_by(office_id=csr.office_id).first_or_404() + .join(ServiceReq.citizen) \ + .filter(Citizen.office_id == csr.office_id).first_or_404() active_service_state = SRState.get_state_by_name("Active") complete_service_state = SRState.get_state_by_name("Complete") diff --git a/api/app/resources/theq/service_requests_list.py b/api/app/resources/theq/service_requests_list.py index b364f4dec..2e5864eba 100644 --- a/api/app/resources/theq/service_requests_list.py +++ b/api/app/resources/theq/service_requests_list.py @@ -67,13 +67,19 @@ def get_service(service_request, json_data, csr): service = None try: - service = Service.query.get(service_request.service_id) - except: + service = db.session.get(Service, service_request.service_id) + except Exception: logging.exception("==> An exception getting service info") logging.exception(csr_const + csr.username) logging.exception(json_data_const + json.dumps(json_data['service_request'])) return (None, ("Could not find service for service_id: " + str(service_request.service_id)), 400) + if service is None: + logging.info("==> No service found in POST /service_requests/") + logging.info(csr_const + csr.username) + logging.info(json_data_const + json.dumps(json_data['service_request'])) + return (None, ("Could not find service for service_id: " + str(service_request.service_id)), 400) + if service.parent_id is None: logging.info("==> CSR has selected a category, rather than a service. This should not be possible") logging.info(csr_const + csr.username) @@ -92,10 +98,13 @@ class ServiceRequestsList(Resource): @api_call_with_retry def post(self): try: - json_data = request.get_json() + json_data = request.get_json(silent=True) except Exception as error: return {"message": str(error)}, 401 + if json_data is None: + return {"message": "No input data received for creating service request"}, 400 + csr = CSR.find_by_username(get_username()) service_request, message, code = get_service_request(self, json_data, csr) if (service_request is None): @@ -153,11 +162,11 @@ def post(self): offset_start_time = citizen.start_time - timedelta(hours=11) service_count = ServiceReq.query \ - .join(ServiceReq.citizen, aliased=True) \ + .join(ServiceReq.citizen) \ .filter(Citizen.start_time >= offset_start_time.strftime("%Y-%m-%d")) \ - .filter_by(office_id=csr.office_id) \ - .join(ServiceReq.service, aliased=True) \ - .filter_by(prefix=service.prefix) \ + .filter(Citizen.office_id == csr.office_id) \ + .join(ServiceReq.service) \ + .filter(Service.prefix == service.prefix) \ .count() citizen.ticket_number = service.prefix + str(service_count) @@ -172,7 +181,7 @@ def post(self): ) service_request.periods.append(ticket_create_period) - citizen.cs_id = active_id + citizen.cs_id = get_active_citizen_state_id() # If first service, just choose it. If additional service, more work needed. if len(citizen.service_reqs) == 0: @@ -203,10 +212,11 @@ def post(self): return {'service_request': result, 'errors': self.service_request_schema.validate(service_request)}, 201 -try: - citizen_state = CitizenState.query.filter_by(cs_state_name="Active").first() - active_id = citizen_state.cs_id -except: - active_id = 1 - logging.exception("==> In service_requests_list.py") - logging.exception(" --> NOTE!! You should only see this if doing a 'python3 manage.py db upgrade'") +def get_active_citizen_state_id(): + try: + citizen_state = CitizenState.query.filter_by(cs_state_name="Active").first() + return citizen_state.cs_id + except Exception: + logging.exception("==> In service_requests_list.py") + logging.exception(" --> NOTE!! You should only see this if doing a 'python3 manage.py db upgrade'") + return 1 diff --git a/api/app/resources/theq/services.py b/api/app/resources/theq/services.py index 651197612..0d10a1ea8 100644 --- a/api/app/resources/theq/services.py +++ b/api/app/resources/theq/services.py @@ -37,7 +37,10 @@ class Refresh(Resource): @jwt.has_one_of_roles([Role.internal_user.value]) def get(self): if request.args.get('office_id'): - office_id = int(request.args.get('office_id')) + try: + office_id = int(request.args.get('office_id')) + except ValueError: + return {'message': 'office_id must be an integer.'}, 400 csr = CSR.find_by_username(get_username()) if csr.role.role_code == "GA": @@ -53,7 +56,7 @@ def top_reqs(is_back_office=True): # Get top requests for the office, and set the lists based on those. results = ServiceReq.query.options( - noload('*'), joinedload('service') + noload('*'), joinedload(ServiceReq.service) ).join( Citizen ).join( @@ -104,7 +107,7 @@ def top_reqs(is_back_office=True): quick_list = top_reqs(is_back_office=False) back_office_list = top_reqs(is_back_office=True) - office = Office.query.get(office_id) + office = db.session.get(Office, office_id) office.quick_list = quick_list office.back_office_list = back_office_list db.session.commit() @@ -141,7 +144,7 @@ def get(self): if request.args.get('office_id'): try: office_id = int(request.args['office_id']) - office = Office.query.get(office_id) + office = db.session.get(Office, office_id) services = sorted(office.services, key=cmp_to_key(self.sort_services)) filtered_services = [s for s in services if s.deleted is None] result = self.service_schema.dump(filtered_services) diff --git a/api/app/resources/theq/slack.py b/api/app/resources/theq/slack.py index 55271d429..b9fbd0cef 100644 --- a/api/app/resources/theq/slack.py +++ b/api/app/resources/theq/slack.py @@ -18,7 +18,6 @@ from qsystem import application, api, db, socketio from app.auth import required_scope from app.models.theq import Citizen, CSR -from cockroachdb.sqlalchemy import run_transaction import logging from marshmallow import ValidationError, pre_load from sqlalchemy import exc diff --git a/api/app/resources/theq/smartboard.py b/api/app/resources/theq/smartboard.py index 454013c13..06bbee4e2 100644 --- a/api/app/resources/theq/smartboard.py +++ b/api/app/resources/theq/smartboard.py @@ -43,7 +43,7 @@ def get(self): citizens = Citizen.query \ .options(joinedload(Citizen.service_reqs, innerjoin=True).options(joinedload(ServiceReq.periods).options(raiseload(Period.csr),raiseload(Period.sr))), raiseload(Citizen.cs),raiseload(Citizen.counter),raiseload(Citizen.user)) \ .filter_by(office_id=office.office_id) \ - .filter_by(cs_id=active_citizen_state) + .filter_by(cs_id=get_active_citizen_state_id()) for c in citizens: active_service_request = c.get_active_service_request() @@ -99,10 +99,11 @@ def get(self, id): logging.exception(exception) return {'message': 'API is down'}, 500 -try: - citizen_state = CitizenState.query.filter_by(cs_state_name="Active").first() - active_citizen_state = citizen_state.cs_id -except Exception as ex: - active_citizen_state = 1 - logging.exception("==> In smartboard.py") - logging.exception(" --> NOTE!! You should only see this if doing a 'python3 manage.py db upgrade'") \ No newline at end of file +def get_active_citizen_state_id(): + try: + citizen_state = CitizenState.query.filter_by(cs_state_name="Active").first() + return citizen_state.cs_id + except Exception: + logging.exception("==> In smartboard.py") + logging.exception(" --> NOTE!! You should only see this if doing a 'python3 manage.py db upgrade'") + return 1 diff --git a/api/app/resources/theq/user/user.py b/api/app/resources/theq/user/user.py index b566a2715..0071aadaa 100644 --- a/api/app/resources/theq/user/user.py +++ b/api/app/resources/theq/user/user.py @@ -30,6 +30,21 @@ # Defining String constants to appease SonarQube api_down_const = 'API is down' + +def _token_last_name(user_info): + return user_info.get('family_name') or user_info.get('lastName') or '' + + +def _normalize_user_defaults(user: PublicUserModel): + if user.last_name is None: + user.last_name = '' + if user.telephone is None: + user.telephone = '' + if user.send_email_reminders is None: + user.send_email_reminders = False + if user.send_sms_reminders is None: + user.send_sms_reminders = False + @api.route("/users/", methods=['POST']) class PublicUsers(Resource): user_schema = UserSchema(many=False) @@ -38,16 +53,19 @@ class PublicUsers(Resource): def post(self): try: user_info = g.jwt_oidc_token_info - user: PublicUserModel = PublicUserModel.find_by_username(get_username()) + username = get_username() + user: PublicUserModel = PublicUserModel.find_by_username(username) if not user: user = PublicUserModel() - user.username = get_username() + user.username = username user.email = user_info.get('email') else: # update email only if the email is None for existing user if not user.email: user.email = user_info.get('email') user.display_name = user_info.get('display_name') - user.last_name = user_info.get('family_name') + if not user.last_name: + user.last_name = _token_last_name(user_info) + _normalize_user_defaults(user) db.session.add(user) db.session.commit() @@ -67,7 +85,8 @@ class PublicUser(Resource): def put(self, user_id: int): try: json_data = request.get_json() - user: PublicUserModel = PublicUserModel.find_by_username(get_username()) + username = get_username() + user: PublicUserModel = PublicUserModel.find_by_username(username) current_sms_reminder: bool = user.send_sms_reminders user.email = json_data.get('email') user.telephone = json_data.get('telephone') @@ -79,7 +98,7 @@ def put(self, user_id: int): # If the user is opting in for SMS reminders, send reminders for all the appointments. if not current_sms_reminder and user.send_sms_reminders: appointments: List[AppointmentModel] = PublicUserModel.find_appointments_by_username( - get_username()) + username) for appointment in appointments: office = appointment.office send_sms(appointment, office, office.timezone, user, diff --git a/api/app/resources/theq/websocket.py b/api/app/resources/theq/websocket.py index 8e0c5d407..b55c7a6ea 100644 --- a/api/app/resources/theq/websocket.py +++ b/api/app/resources/theq/websocket.py @@ -19,8 +19,8 @@ from app.auth.auth import jwt from app.models.theq import CSR, Office from app.utilities.auth_util import get_username +from flask_jwt_oidc import AuthError from qsystem import socketio, my_print -from flask_jwt_oidc.exceptions import AuthError @socketio.on('joinRoom') diff --git a/api/app/schemas/__init__.py b/api/app/schemas/__init__.py index fc5397d63..bf29488ab 100644 --- a/api/app/schemas/__init__.py +++ b/api/app/schemas/__init__.py @@ -11,6 +11,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.''' +from collections.abc import Mapping + from marshmallow import EXCLUDE from qsystem import ma @@ -21,3 +23,18 @@ class BaseSchema(ma.SQLAlchemySchema): class Meta: load_instance = True unknown = EXCLUDE + + def validate(self, data, *, many=None, partial=None): + """Support legacy validation calls that pass ORM instances.""" + if many is None: + many = self.many + + if isinstance(data, Mapping): + return super().validate(data, many=many, partial=partial) + + if isinstance(data, (list, tuple)): + if all(isinstance(item, Mapping) for item in data): + return super().validate(data, many=many, partial=partial) + return {} + + return {} if data is not None else super().validate(data, many=many, partial=partial) diff --git a/api/app/schemas/bookings/booking_schema.py b/api/app/schemas/bookings/booking_schema.py index c83f70645..f1e8c13f1 100644 --- a/api/app/schemas/bookings/booking_schema.py +++ b/api/app/schemas/bookings/booking_schema.py @@ -69,7 +69,7 @@ def update_invigilators(self, data): data['invigilators'] = invigilator_list return data - @post_dump(pass_many=True) + @post_dump(pass_collection=True) def fix_invigilators(self, data, many, **kwargs): if not many: data = self.update_invigilators(data) diff --git a/api/app/schemas/bookings/exam_schema.py b/api/app/schemas/bookings/exam_schema.py index 391e22956..22884cff5 100644 --- a/api/app/schemas/bookings/exam_schema.py +++ b/api/app/schemas/bookings/exam_schema.py @@ -46,7 +46,7 @@ class Meta(BaseSchema.Meta): exam_method = fields.Str() exam_name = fields.Str() exam_received = fields.Int() - exam_received_date = fields.DateTime(allow_none=True, datetimeformat='%Y-%m-%dT%H:%M:%SZ') + exam_received_date = fields.DateTime(allow_none=True) exam_type_id = fields.Int() examinee_name = fields.Str(allow_none=True) examinee_phone = fields.Str(allow_none=True) @@ -81,4 +81,3 @@ class Meta(BaseSchema.Meta): invigilator = fields.Nested(InvigilatorSchema()) office = fields.Nested(OfficeSchema(only=('appointments_enabled_ind', 'exams_enabled_ind', 'office_id', 'office_name', 'office_number', 'timezone'))) - diff --git a/api/app/schemas/theq/csr_schema.py b/api/app/schemas/theq/csr_schema.py index 36719e9e1..bb0b3c235 100644 --- a/api/app/schemas/theq/csr_schema.py +++ b/api/app/schemas/theq/csr_schema.py @@ -42,7 +42,7 @@ class Meta(BaseSchema.Meta): finance_designate = fields.Int() ita2_designate = fields.Int() - @post_dump(pass_many=True) + @post_dump(pass_collection=True) def add_counter_id(self, data, many, **kwargs): if not many: data['counter'] = data['counter_id'] diff --git a/api/app/schemas/theq/service_schema.py b/api/app/schemas/theq/service_schema.py index d29c5b8ea..50001a595 100644 --- a/api/app/schemas/theq/service_schema.py +++ b/api/app/schemas/theq/service_schema.py @@ -14,6 +14,7 @@ from marshmallow import fields from app.models.theq import Service +from app.utilities.yesno import YesNo from qsystem import ma from app.schemas import BaseSchema @@ -29,7 +30,7 @@ class Meta(BaseSchema.Meta): service_code = fields.Str(dump_only=True) service_name = fields.Str(dump_only=True) service_desc = fields.Str(dump_only=True) - parent = fields.Nested('self', only=('service_name',)) + parent = fields.Nested(lambda: ServiceSchema(only=('service_name',))) parent_id = fields.Int(dump_only=True) deleted = fields.DateTime(dump_only=True) prefix = fields.Str(dump_only=True) @@ -41,4 +42,14 @@ class Meta(BaseSchema.Meta): timeslot_duration = fields.Int(dump_only=True) email_paragraph = fields.Str(dump_only=True) css_colour = fields.Str(dump_only=True) - is_dlkt = fields.Boolean() + is_dlkt = fields.Method(serialize="get_is_dlkt", deserialize="load_is_dlkt", allow_none=True) + + def get_is_dlkt(self, obj): + if obj.is_dlkt is None: + return None + return obj.is_dlkt == YesNo.YES + + def load_is_dlkt(self, value): + if value is None: + return None + return YesNo.YES if value else YesNo.NO diff --git a/api/app/services/availability_service.py b/api/app/services/availability_service.py index 380bc761e..2eebfc91f 100644 --- a/api/app/services/availability_service.py +++ b/api/app/services/availability_service.py @@ -15,13 +15,13 @@ import logging, datetime from typing import Dict -import pytz from sqlalchemy import exc from app.models.bookings import Appointment from app.models.theq import Office from app.models.theq import Service from app.utilities.date_util import add_delta_to_time, day_indexes +from app.utilities.timezone_utils import get_timezone from app.utilities.yesno import YesNo @@ -45,13 +45,14 @@ def get_available_slots(office: Office, days: [datetime], format_time: bool = Tr service_is_dltk = service and service.is_dlkt == YesNo.YES # Dictionary to store the available slots per day - tz = pytz.timezone(office.timezone.timezone_name) + tz = get_timezone(office.timezone.timezone_name) # today's date and time today = datetime.datetime.now().astimezone(tz) # soonest a citizen can book an appointment soonest_appointment_date = today + datetime.timedelta(minutes = office.soonest_appointment or 0) + soonest_appointment_time = soonest_appointment_date.timetz() # Find all appointments between the dates appointments = Appointment.find_appointment_availability(office_id=office.office_id, first_date=today, @@ -91,7 +92,7 @@ def get_available_slots(office: Office, days: [datetime], format_time: bool = Tr } # Check if today's time is past appointment slot # Arc - also check if in office.soonest_appointment - if ((day_in_month.date() == soonest_appointment_date.date() and start_time >= soonest_appointment_date.time()) or day_in_month.date() > soonest_appointment_date.date()) and slot not in available_slots_per_day[formatted_date]: + if ((day_in_month.date() == soonest_appointment_date.date() and start_time >= soonest_appointment_time) or day_in_month.date() > soonest_appointment_date.date()) and slot not in available_slots_per_day[formatted_date]: available_slots_per_day[formatted_date].append(slot) start_time = end_time.replace(tzinfo=tz) @@ -148,8 +149,9 @@ def get_available_slots(office: Office, days: [datetime], format_time: bool = Tr @staticmethod def has_available_slots(office: Office, start_time:datetime, end_time: datetime, service: Service): """Return if there is any available slot for the time period for the office.""" - start_time = start_time.astimezone(pytz.timezone(office.timezone.timezone_name)) - end_time = end_time.astimezone(pytz.timezone(office.timezone.timezone_name)) + office_timezone = get_timezone(office.timezone.timezone_name) + start_time = start_time.astimezone(office_timezone) + end_time = end_time.astimezone(office_timezone) available_day_slots = AvailabilityService.get_available_slots(office=office, days=[start_time], format_time=False, service=service) @@ -158,7 +160,7 @@ def has_available_slots(office: Office, start_time:datetime, end_time: datetime, # Because services can be artbitary duration, we just check if times fall within duration # e.g slot is 8-9, but start_time/end_time are 8:30-8:45. # We do NOT check across slots, only within an individual slot - if slot['start_time'] <= start_time.time() and slot['end_time'] >= end_time.time(): + if slot['start_time'] <= start_time.timetz() and slot['end_time'] >= end_time.timetz(): has_available_slot = True return has_available_slot @@ -167,12 +169,13 @@ def has_available_slots(office: Office, start_time:datetime, end_time: datetime, def group_appointments(appointments, timezone: str): filtered_appointments = {} for app in appointments: - formatted_date = app.start_time.astimezone(pytz.timezone(timezone)).strftime('%m/%d/%Y') + app_timezone = get_timezone(timezone) + formatted_date = app.start_time.astimezone(app_timezone).strftime('%m/%d/%Y') if not filtered_appointments.get(formatted_date, None): filtered_appointments[formatted_date] = [] filtered_appointments[formatted_date].append({ - 'start_time': app.start_time.astimezone(pytz.timezone(timezone)).time(), - 'end_time': app.end_time.astimezone(pytz.timezone(timezone)).time(), + 'start_time': app.start_time.astimezone(app_timezone).timetz(), + 'end_time': app.end_time.astimezone(app_timezone).timetz(), 'blackout_flag': app.blackout_flag == 'Y' or app.stat_flag, 'is_dlkt': (app.service.is_dlkt == YesNo.YES) if app.service else False }) diff --git a/api/app/tests/README.md b/api/app/tests/README.md new file mode 100644 index 000000000..222d50414 --- /dev/null +++ b/api/app/tests/README.md @@ -0,0 +1,159 @@ +# API Test Suite Guide + +This suite covers the active API surface used by `/frontend` and +`/appointment-frontend`. The suite is split into a DB-free `smoke` +slice and a Postgres-backed `integration` slice. + +## Supported Run Modes + +From the API root: + +```sh +cd /Users/csampson/Developer/Repositories/queue-management/api +``` + +Smoke-only, DB-free: + +```sh +./scripts/run_api_smoke_tests.sh +``` + +Integration-only, fail fast if disposable Postgres is unavailable: + +```sh +./scripts/run_api_integration_tests.sh +``` + +Full suite, including the default line and branch coverage reports: + +```sh +./scripts/run_api_full_tests.sh +``` + +Equivalent direct pytest commands: + +```sh +uv run pytest app/tests -m smoke -q --override-ini "addopts=--strict-markers" +uv run pytest app/tests -m integration -q --override-ini "addopts=--strict-markers" --require-integration-db +uv run pytest app/tests -q --require-integration-db +``` + +Marker-specific runs still work during local debugging: + +```sh +uv run pytest app/tests -m contracts -q --override-ini "addopts=--strict-markers" +uv run pytest app/tests -m flows -q --override-ini "addopts=--strict-markers" +uv run pytest app/tests -m validation -q --override-ini "addopts=--strict-markers" +uv run pytest app/tests -m "contracts and integration" -q --override-ini "addopts=--strict-markers" --require-integration-db +``` + +## Smoke Vs Integration + +`smoke` is the reliable local gate. It does not require disposable Postgres and +should stay free of DB-dependent skips. + +`integration` is the seeded disposable-Postgres suite. It covers the auth, +contracts, flows, validation, and DB-backed modernization checks that exercise +the live application stack. + +The `--require-integration-db` flag makes Postgres dependency failures loud. If +the DB cannot be created or reached, pytest exits immediately instead of +collapsing the integration slice into a wall of skips. + +If you intentionally want a best-effort local run that allows integration tests +to skip when Postgres is unavailable, `uv run pytest app/tests -q` still works. +That mode is useful for quick local debugging, but it should not be treated as +rewrite-readiness coverage because DB-backed skips can mask missing regression +signal. + +The default pytest configuration now records both line and branch coverage and +writes reports to `htmlcov/` and `coverage.xml`. The explicit marker-focused +commands above override `addopts` so local debugging stays fast and uncluttered. + +## Harness Layout + +| Path | Purpose | +| --- | --- | +| `conftest.py` | Thin pytest plugin loader plus marker/collection policy | +| `fixtures/db.py` | Disposable Postgres, app boot, migrations, and seeded data | +| `fixtures/auth.py` | Authenticated client factories and identity fixtures | +| `fixtures/smoke.py` | Minimal Flask helpers for DB-free smoke tests | +| `contracts/schemas.py` | Shared response schema registry for contract tests | +| `contracts/conftest.py` | Contract validation helper only | +| `helpers/appointments.py` | Reminder and appointment test helpers | +| `helpers/exams.py` | Exam integration test helpers | +| `auth/auth_support.py` | Route builders, seeded auth helpers, integration stubs | + +## Test Coverage + +- Auth boundaries across public, mixed-role, authenticated-only, and + internal-only routes +- Frontend-facing contracts for appointments, users, bookings, exams, + citizens, service requests, and reference data +- Explicit frontend route contracts for `/csrs/`, `/rooms/?office_id=...`, + `/invigilators/offsite/`, and `/smardboard/side-menu/` +- Office-scoped service-list coverage for `/services/?office_id=...`, + including filtering of deleted services and stable frontend ordering +- CSR dashboard coverage for `/csrs/me/`, including `attention_needed`, + `active_citizens`, and rewrite-critical feature flags consumed by + `/frontend` +- Core appointment, draft, booking, exam, queue, and CSR flows +- Current-office recurring booking delete coverage, including same-office + deletion rules and the current-day `<= 5am` preservation exception +- Walk-in and smartboard behavior coverage for queue grouping, payload shaping, + and reminder side effects used by `/appointment-frontend` and smartboard UIs +- Direct availability-service coverage for DST grouping, `soonest_appointment`, + blackout pruning, DLKT slot caps, and overlap checks +- Reminder payload contracts and behavior for email and SMS reminder jobs +- Service-request creation branches for missing payloads, category rejection, + first-service ticket numbering, and additional-service Snowplow transitions +- Service refresh behavior for GA and SUPPORT roles +- Active exam integration flows for BCMP create/status, transfer, download, and + invigilator email +- Pesticide and group-exam creation coverage, including candidate + normalization, non-SBC office reassignment, and exam export filter variants +- Exam export coverage for fail-fast validation, localized CSV timestamps, + blank room/invigilator fields, and designate-vs-office-scoped exports +- DB-free websocket smoke coverage for join-room, smartboard-room, and cache + handlers +- Flask 3, Marshmallow 4, WTForms, timezone, and SQLAlchemy modernization smoke + coverage + +## Contract Strictness Policy + +The schema registry in `contracts/schemas.py` treats frontend-owned +envelopes and stable nested objects as closed contracts by using +`additionalProperties: False`. + +Strict by default for: + +- appointments +- public users +- bookings +- exams +- citizens and service requests +- offices, services, categories, channels, rooms, invigilators, exam types + +Intentionally permissive where the payload shape is genuinely variable: + +- date-keyed slot maps +- office `timeslots` +- BCMP and candidate payloads that the frontend does not treat as fixed + contracts + +`contracts/test_contract_strictness.py` guards against accidental schema +loosening by injecting unexpected fields into valid payloads and asserting that +validation fails. + +## Deprecated And Out-Of-Scope Surface + +The following routes should not affect rewrite-readiness scoring: + +- `/feedback/` +- `/slack/` +- upload routes +- video routes + +Deprecated auth coverage that still exists for upload or video routes should be +treated as cleanup follow-up, not as a blocker for the active rewrite safety +net. diff --git a/api/app/tests/api_test_support.py b/api/app/tests/api_test_support.py new file mode 100644 index 000000000..87188816f --- /dev/null +++ b/api/app/tests/api_test_support.py @@ -0,0 +1,407 @@ +from __future__ import annotations + +from dataclasses import dataclass +from datetime import datetime, time, timedelta, timezone +from typing import Any, Optional +from uuid import uuid4 +from zoneinfo import ZoneInfo + + +@dataclass +class ApiClient: + client: Any + identity_name: Optional[str] + token: Optional[str] = "theq-test-token" + + def _normalize_path(self, path: str) -> str: + if path.startswith("/api/"): + return path + if path.startswith("/"): + return f"/api/v1{path}" + return f"/api/v1/{path.lstrip('/')}" + + def _headers(self, headers: Optional[dict[str, str]] = None) -> dict[str, str]: + merged: dict[str, str] = {} + if self.token: + merged["Authorization"] = f"Bearer {self.token}" + if self.identity_name: + merged["X-TheQ-Test-Identity"] = self.identity_name + if headers: + merged.update(headers) + return merged + + def open(self, path: str, **kwargs): + headers = self._headers(kwargs.pop("headers", None)) + return self.client.open(self._normalize_path(path), headers=headers, **kwargs) + + def get(self, path: str, **kwargs): + return self.open(path, method="GET", **kwargs) + + def post(self, path: str, **kwargs): + return self.open(path, method="POST", **kwargs) + + def put(self, path: str, **kwargs): + return self.open(path, method="PUT", **kwargs) + + def delete(self, path: str, **kwargs): + return self.open(path, method="DELETE", **kwargs) + + +def json_of(response) -> dict[str, Any]: + return response.get_json() + + +def assert_status(response, expected_status: int): + assert response.status_code == expected_status, response.get_data(as_text=True) + + +def assert_json_response(response, expected_status: int): + assert_status(response, expected_status) + content_type = response.headers.get("Content-Type", "") + assert content_type.startswith("application/json"), content_type + + +def assert_unauthorized(response): + assert_status(response, 401) + + +def assert_forbidden(response): + assert_status(response, 403) + + +def assert_not_auth_error(response): + assert response.status_code not in {401, 403}, response.get_data(as_text=True) + + +def flatten_slots( + slots_by_day: dict[str, list[dict[str, Any]]], +) -> list[tuple[str, dict[str, Any]]]: + flattened: list[tuple[str, dict[str, Any]]] = [] + for day, slots in slots_by_day.items(): + for slot in slots: + flattened.append((day, slot)) + return flattened + + +def first_day_with_slots( + slots_by_day: dict[str, list[dict[str, Any]]], minimum_slots: int = 1 +) -> tuple[str, list[dict[str, Any]]]: + for day, slots in slots_by_day.items(): + if len(slots) >= minimum_slots: + return day, slots + raise AssertionError( + f"expected at least one day with {minimum_slots} slot(s), got {slots_by_day}" + ) + + +def slot_window_to_iso( + day_key: str, slot: dict[str, Any], timezone_name: str +) -> tuple[str, str]: + day_value = datetime.strptime(day_key, "%m/%d/%Y").date() + timezone = ZoneInfo(timezone_name) + start_hour, start_minute = [int(part) for part in slot["start_time"].split(":")] + end_hour, end_minute = [int(part) for part in slot["end_time"].split(":")] + start_dt = datetime.combine( + day_value, time(start_hour, start_minute), tzinfo=timezone + ) + end_dt = datetime.combine(day_value, time(end_hour, end_minute), tzinfo=timezone) + return start_dt.isoformat(), end_dt.isoformat() + + +def future_utc_window( + days_from_now: int, start_hour: int = 17, duration_minutes: int = 30 +) -> tuple[str, str]: + start_dt = datetime.now(timezone.utc).replace( + microsecond=0, second=0, minute=0, hour=start_hour + ) + start_dt = start_dt + timedelta(days=days_from_now) + end_dt = start_dt + timedelta(minutes=duration_minutes) + return start_dt.isoformat(), end_dt.isoformat() + + +def unique_name(prefix: str) -> str: + return f"{prefix}-{uuid4().hex[:8]}" + + +def create_public_user(api_client: ApiClient) -> dict[str, Any]: + response = api_client.post("/users/") + assert_json_response(response, 200) + return json_of(response)[0] + + +def public_slot_payload( + api_client: ApiClient, + seeded_data: dict[str, Any], + *, + minimum_slots: int = 1, + comments: str = "Public appointment", + citizen_name: str = "Codex Public User", + contact_information: str = "public@example.com", +) -> tuple[dict[str, Any], str, list[dict[str, Any]]]: + slots_response = api_client.get( + f"/offices/{seeded_data['office_ids']['limited_office']}/slots/?service_id={seeded_data['service_ids']['limited_office_service']}" + ) + assert_json_response(slots_response, 200) + day_key, slots = first_day_with_slots( + json_of(slots_response), minimum_slots=minimum_slots + ) + start_time, end_time = slot_window_to_iso( + day_key, slots[0], seeded_data["office_timezones"]["limited_office"] + ) + return ( + { + "service_id": seeded_data["service_ids"]["limited_office_service"], + "office_id": seeded_data["office_ids"]["limited_office"], + "start_time": start_time, + "end_time": end_time, + "comments": comments, + "citizen_name": citizen_name, + "contact_information": contact_information, + }, + day_key, + slots, + ) + + +def create_draft_appointment( + api_client: ApiClient, + seeded_data: dict[str, Any], + *, + minimum_slots: int = 1, +) -> dict[str, Any]: + payload, _day_key, _slots = public_slot_payload( + api_client, seeded_data, minimum_slots=minimum_slots + ) + response = api_client.post("/appointments/draft", json=payload) + assert_json_response(response, 201) + return json_of(response)["appointment"] + + +def create_public_draft_and_payload( + api_client: ApiClient, seeded_data: dict[str, Any] +) -> tuple[dict[str, Any], dict[str, Any]]: + draft = create_draft_appointment(api_client, seeded_data, minimum_slots=1) + payload, _day_key, _slots = public_slot_payload( + api_client, seeded_data, minimum_slots=1 + ) + payload["appointment_draft_id"] = draft["appointment_id"] + return draft, payload + + +def create_internal_appointment( + api_client: ApiClient, + seeded_data: dict[str, Any], + *, + days_from_now: int, + recurring_uuid: Optional[str] = None, +) -> dict[str, Any]: + start_time, end_time = future_utc_window(days_from_now) + response = api_client.post( + "/appointments/", + json={ + "service_id": seeded_data["service_ids"]["msp"], + "office_id": seeded_data["office_ids"]["test_office"], + "start_time": start_time, + "end_time": end_time, + "comments": "Internal appointment", + "citizen_name": unique_name("internal-appt"), + "contact_information": "internal@example.com", + "recurring_uuid": recurring_uuid, + }, + ) + assert_json_response(response, 201) + return json_of(response)["appointment"] + + +def create_booking( + api_client: ApiClient, + seeded_data: dict[str, Any], + *, + days_from_now: int, + recurring_uuid: Optional[str] = None, + invigilator_ids: Optional[list[int]] = None, + office_id: Optional[int] = None, + room_id: Optional[int] = None, + booking_name: Optional[str] = None, +) -> dict[str, Any]: + start_time, end_time = future_utc_window(days_from_now, duration_minutes=120) + if invigilator_ids is None: + invigilator_ids = [seeded_data["invigilator_ids"][0]] + if office_id is None: + office_id = seeded_data["office_ids"]["test_office"] + if room_id is None: + room_id = seeded_data["room_id"] + if booking_name is None: + booking_name = unique_name("booking") + response = api_client.post( + "/bookings/", + json={ + "booking_name": booking_name, + "booking_contact_information": "booking@example.com", + "fees": "false", + "office_id": office_id, + "room_id": room_id, + "start_time": start_time, + "end_time": end_time, + "recurring_uuid": recurring_uuid, + "invigilator_id": invigilator_ids, + }, + ) + assert_json_response(response, 201) + return json_of(response)["booking"] + + +def create_exam( + api_client: ApiClient, + seeded_data: dict[str, Any], + booking_id: Optional[int], + *, + event_id: str, + exam_type_id: Optional[int] = None, + office_id: Optional[int] = None, + **overrides: Any, +) -> dict[str, Any]: + expiry_date = ( + (datetime.now(timezone.utc) + timedelta(days=30)) + .replace(microsecond=0) + .isoformat() + ) + payload = { + "event_id": event_id, + "exam_method": "paper", + "exam_name": unique_name("exam"), + "exam_type_id": ( + seeded_data["exam_type_id"] if exam_type_id is None else exam_type_id + ), + "exam_written_ind": 0, + "examinee_name": "Codex Examinee", + "notes": "Codex exam notes", + "number_of_students": 19, + "office_id": ( + seeded_data["office_ids"]["test_office"] + if office_id is None + else office_id + ), + "offsite_location": "Test Office", + "expiry_date": expiry_date, + } + if booking_id is not None: + payload["booking_id"] = booking_id + payload.update(overrides) + response = api_client.post( + "/exams/", + json=payload, + ) + assert_json_response(response, 201) + return json_of(response)["exam"] + + +def create_citizen( + api_client: ApiClient, + position: int, + *, + name: str, + comments: Optional[str] = None, +) -> dict[str, Any]: + payload = {"citizen_name": name} + if comments is not None: + payload["citizen_comments"] = comments + + response = api_client.post(f"/citizens/{position}/add_citizen/", json=payload) + assert_json_response(response, 201) + return json_of(response)["citizen"] + + +def update_citizen(api_client: ApiClient, citizen_id: int, **payload) -> dict[str, Any]: + response = api_client.put(f"/citizens/{citizen_id}/", json=payload) + assert_json_response(response, 200) + return json_of(response)["citizen"] + + +def create_service_request( + api_client: ApiClient, + citizen_id: int, + *, + service_id: int, + channel_id: int, + quantity: int, +) -> dict[str, Any]: + response = api_client.post( + "/service_requests/", + json={ + "service_request": { + "citizen_id": citizen_id, + "service_id": service_id, + "channel_id": channel_id, + "quantity": quantity, + } + }, + ) + assert_json_response(response, 201) + return json_of(response)["service_request"] + + +def create_service_ready_citizen( + api_client: ApiClient, + seeded_data: dict[str, Any], + *, + position: int, + name: str, + service_id_key: str, + channel_id_key: str, + quantity: int, + counter_id_key: Optional[str] = None, + qt_xn_citizen_ind: Optional[int] = None, + comments: Optional[str] = None, +) -> tuple[dict[str, Any], dict[str, Any]]: + citizen = create_citizen(api_client, position, name=name, comments=comments) + + update_payload = {"citizen_name": name} + if comments is not None: + update_payload["citizen_comments"] = comments + if counter_id_key is not None: + update_payload["counter_id"] = seeded_data["counter_ids"][counter_id_key] + if qt_xn_citizen_ind is not None: + update_payload["qt_xn_citizen_ind"] = qt_xn_citizen_ind + + updated = update_citizen(api_client, citizen["citizen_id"], **update_payload) + service_request = create_service_request( + api_client, + updated["citizen_id"], + service_id=seeded_data["service_ids"][service_id_key], + channel_id=seeded_data["channel_ids"][channel_id_key], + quantity=quantity, + ) + return updated, service_request + + +def create_queue_ready_citizen( + api_client: ApiClient, + seeded_data: dict[str, Any], + *, + position: int, + name: str, + service_id_key: str, + channel_id_key: str, + quantity: int, + counter_id_key: str, + qt_xn_citizen_ind: int, + comments: Optional[str] = None, +) -> tuple[dict[str, Any], dict[str, Any], dict[str, Any]]: + citizen, service_request = create_service_ready_citizen( + api_client, + seeded_data, + position=position, + name=name, + service_id_key=service_id_key, + channel_id_key=channel_id_key, + quantity=quantity, + counter_id_key=counter_id_key, + qt_xn_citizen_ind=qt_xn_citizen_ind, + comments=comments, + ) + queued_response = api_client.post( + f"/citizens/{citizen['citizen_id']}/add_to_queue/" + ) + assert_json_response(queued_response, 200) + return citizen, service_request, json_of(queued_response)["citizen"] diff --git a/api/app/tests/auth/__init__.py b/api/app/tests/auth/__init__.py new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/api/app/tests/auth/__init__.py @@ -0,0 +1 @@ + diff --git a/api/app/tests/auth/auth_support.py b/api/app/tests/auth/auth_support.py new file mode 100644 index 000000000..54234fb70 --- /dev/null +++ b/api/app/tests/auth/auth_support.py @@ -0,0 +1,271 @@ +from __future__ import annotations + +import io +import json +from datetime import datetime, timezone +from pathlib import Path +from uuid import uuid4 + +from app.tests.api_test_support import ( + assert_json_response, + create_booking, + create_exam, + create_internal_appointment, + create_public_user, + create_queue_ready_citizen, + create_service_ready_citizen, + create_service_request, + json_of, + public_slot_payload, +) + + +def configure_video_path( + app, monkeypatch, tmp_path: Path, *, office_number: int +) -> Path: + """Create a disposable video directory and point the app config at it.""" + video_dir = tmp_path / "videos" + video_dir.mkdir() + (video_dir / "sample.mp4").write_bytes(b"video-bytes") + (video_dir / "manifest.json").write_text( + json.dumps( + { + str(office_number): {"url": "https://example.com/office-video.mp4"}, + "default": {"url": "https://example.com/default-video.mp4"}, + } + ) + ) + monkeypatch.setitem(app.config, "VIDEO_PATH", str(video_dir)) + return video_dir + + +def create_public_appointment(public_client, seeded_data) -> dict: + """Create an appointment owned by the authenticated public test user.""" + create_public_user(public_client) + payload, _day_key, _slots = public_slot_payload( + public_client, seeded_data, minimum_slots=1 + ) + response = public_client.post("/appointments/", json=payload) + assert_json_response(response, 201) + return json_of(response)["appointment"] + + +def create_internal_exam_bundle(internal_ga_client, seeded_data) -> tuple[dict, dict]: + """Create a booking plus exam pair for exam-auth tests.""" + booking = create_booking(internal_ga_client, seeded_data, days_from_now=5) + exam = create_exam( + internal_ga_client, + seeded_data, + booking["booking_id"], + event_id=f"event-{uuid4().hex[:8]}", + ) + return booking, exam + + +def create_walkin_target(app, internal_ga_client, seeded_data) -> tuple[dict, str]: + """Create a queued citizen and persist a walk-in identifier for open walk-in routes.""" + citizen, _service_request, _queued = create_queue_ready_citizen( + internal_ga_client, + seeded_data, + position=0, + name="Walkin Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=1, + counter_id_key="counter", + qt_xn_citizen_ind=0, + comments="Walkin citizen", + ) + walkin_id = f"walkin-{uuid4().hex[:8]}" + + with app.app_context(): + from app.models.theq import Citizen + from qsystem import db + + citizen_model = Citizen.find_citizen_by_id(citizen["citizen_id"]) + citizen_model.walkin_unique_id = walkin_id + citizen_model.notification_phone = "2505550100" + citizen_model.start_position = 1 + db.session.add(citizen_model) + db.session.commit() + + return citizen, walkin_id + + +def promote_internal_csr_to_support(app, *, username="cfms-postman-non-operator"): + """Promote a seeded internal CSR to SUPPORT for role-specific integration tests.""" + with app.app_context(): + from app.models.theq import CSR, Role + from qsystem import db + + csr = CSR.query.filter_by(username=username).first() + support_role = Role.query.filter_by(role_code="SUPPORT").first() + csr.role_id = support_role.role_id + db.session.add(csr) + db.session.commit() + return csr.csr_id + + +def patch_exam_integrations( + monkeypatch, + *, + create_individual_response=None, + create_group_response=None, + bulk_jobs=None, + transfer_response=None, + email_result=True, + download_job=None, + download_bytes=b"pdf-bytes", +): + """Replace BCMP and MinIO calls with deterministic local stubs.""" + from app.resources.bookings.exam.exam_bcmp import ExamBcmpPost + from app.resources.bookings.exam.exam_bulk_status import ExamList + from app.resources.bookings.exam.exam_download import ( + ExamStatus as ExamDownloadStatus, + ) + from app.resources.bookings.exam.exam_email_invigilator import ExamEmailInvigilator + from app.resources.bookings.exam.exam_transfer import ( + ExamStatus as ExamTransferStatus, + ) + from app.utilities.document_service import DocumentService + + if create_individual_response is None: + create_individual_response = {"jobId": "bcmp-job-123"} + if create_group_response is None: + create_group_response = {"jobId": "bcmp-group-job-123"} + if bulk_jobs is None: + bulk_jobs = [] + if transfer_response is None: + transfer_response = {"jobId": "transfer-job-123"} + if download_job is None: + download_job = { + "jobStatus": "PACKAGE_GENERATED", + "jobProperties": {"EXAM_PACKAGE_URL": "https://example.com/package.pdf"}, + } + + monkeypatch.setattr( + ExamBcmpPost.bcmp_service, + "create_individual_exam", + lambda *args, **kwargs: create_individual_response, + ) + monkeypatch.setattr( + ExamBcmpPost.bcmp_service, + "create_group_exam_bcmp", + lambda *args, **kwargs: create_group_response, + ) + monkeypatch.setattr( + ExamList.bcmp_service, + "bulk_check_exam_status", + lambda exams: {"jobs": list(bulk_jobs)}, + ) + monkeypatch.setattr( + ExamTransferStatus.bcmp_service, + "send_exam_to_bcmp", + lambda exam: transfer_response, + ) + monkeypatch.setattr( + ExamEmailInvigilator.bcmp_service, + "email_exam_invigilator", + lambda *args, **kwargs: email_result, + ) + monkeypatch.setattr( + ExamDownloadStatus.bcmp_service, + "check_exam_status", + lambda exam: download_job, + ) + monkeypatch.setattr( + DocumentService, + "get_presigned_put_url", + lambda self, name: "https://example.com/upload", + ) + + from app.resources.bookings.exam import exam_download as exam_download_module + + monkeypatch.setattr( + exam_download_module.urllib.request, + "urlopen", + lambda request: io.BytesIO(download_bytes), + ) + + +def build_bcmp_exam_payload(seeded_data) -> dict: + """Build a minimal BCMP exam payload that reaches the authenticated code path.""" + return { + "event_id": f"bcmp-{uuid4().hex[:8]}", + "exam_method": "paper", + "exam_name": "Environment", + "exam_type_id": seeded_data["exam_type_id"], + "exam_written_ind": 0, + "examinee_name": "BCMP Examinee", + "notes": "BCMP auth test", + "number_of_students": 1, + "office_id": seeded_data["office_ids"]["test_office"], + "offsite_location": "Test Office", + "expiry_date": datetime.now(timezone.utc).replace(microsecond=0).isoformat(), + "is_pesticide": 1, + "sbc_managed": "sbc", + "ind_or_group": "individual", + "fees": "25.00", + } + + +def prepare_service_activation(api_client, seeded_data) -> tuple[dict, dict]: + """Create two service requests so the first one can be reactivated.""" + citizen, first_service = create_service_ready_citizen( + api_client, + seeded_data, + position=0, + name="Activation Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=1, + counter_id_key="counter", + ) + create_service_request( + api_client, + citizen["citizen_id"], + service_id=seeded_data["service_ids"]["msp"], + channel_id=seeded_data["channel_ids"]["email"], + quantity=1, + ) + return citizen, first_service + + +def prepare_hold_or_finish_target(api_client, seeded_data) -> dict: + """Create a citizen and advance them to the Being Served state.""" + citizen, _service_request = create_service_ready_citizen( + api_client, + seeded_data, + position=0, + name="Serving Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=1, + counter_id_key="counter", + ) + api_client.post(f"/citizens/{citizen['citizen_id']}/begin_service/") + return citizen + + +def prepare_recurring_bookings(api_client, seeded_data) -> str: + """Create recurring bookings and return the shared recurring UUID.""" + recurring_uuid = str(uuid4()) + create_booking( + api_client, seeded_data, days_from_now=3, recurring_uuid=recurring_uuid + ) + create_booking( + api_client, seeded_data, days_from_now=4, recurring_uuid=recurring_uuid + ) + return recurring_uuid + + +def prepare_recurring_appointments(api_client, seeded_data) -> str: + """Create recurring appointments and return the shared recurring UUID.""" + recurring_uuid = str(uuid4()) + create_internal_appointment( + api_client, seeded_data, days_from_now=3, recurring_uuid=recurring_uuid + ) + create_internal_appointment( + api_client, seeded_data, days_from_now=4, recurring_uuid=recurring_uuid + ) + return recurring_uuid diff --git a/api/app/tests/auth/test_authenticated_only_routes.py b/api/app/tests/auth/test_authenticated_only_routes.py new file mode 100644 index 000000000..401a160b9 --- /dev/null +++ b/api/app/tests/auth/test_authenticated_only_routes.py @@ -0,0 +1,212 @@ +from __future__ import annotations + +from dataclasses import dataclass + +import pytest +from app.tests.api_test_support import ( + assert_not_auth_error, + assert_status, + assert_unauthorized, +) +from app.tests.auth.auth_support import ( + build_bcmp_exam_payload, + create_internal_exam_bundle, + patch_exam_integrations, +) + +pytestmark = [pytest.mark.auth, pytest.mark.usefixtures("seeded_database")] + + +@dataclass(frozen=True) +class AuthenticatedRouteCase: + """Describe a route that requires authentication but uses additional in-method checks.""" + + id: str + method: str + build_request: object + success_assertion: object + public_forbidden: bool = False + + +def _assert_exact_status(expected_status: int): + def assertion(response): + assert_status(response, expected_status) + + return assertion + + +def _build_csr_states_request(ctx): + return {"path": "/csr_states/"} + + +def _build_citizens_request(ctx): + return {"path": "/citizens/"} + + +def _build_invigilators_offsite_request(ctx): + return {"path": "/invigilators/offsite/"} + + +def _build_exam_bcmp_request(ctx): + patch_exam_integrations(ctx["monkeypatch"]) + return {"path": "/exams/bcmp/", "json": build_bcmp_exam_payload(ctx["seeded_data"])} + + +def _build_exam_bcmp_status_request(ctx): + patch_exam_integrations(ctx["monkeypatch"]) + return {"path": "/exams/bcmp_status/", "json": {}} + + +def _build_exam_upload_request(ctx): + patch_exam_integrations(ctx["monkeypatch"]) + _booking, exam = create_internal_exam_bundle( + ctx["internal_ga_client"], ctx["seeded_data"] + ) + return {"path": f"/exams/{exam['exam_id']}/upload/"} + + +def _build_exam_transfer_request(ctx): + patch_exam_integrations(ctx["monkeypatch"]) + _booking, exam = create_internal_exam_bundle( + ctx["internal_ga_client"], ctx["seeded_data"] + ) + return {"path": f"/exams/{exam['exam_id']}/transfer/"} + + +def _build_exam_email_invigilator_request(ctx): + patch_exam_integrations(ctx["monkeypatch"]) + _booking, exam = create_internal_exam_bundle( + ctx["internal_ga_client"], ctx["seeded_data"] + ) + return { + "path": f"/exams/{exam['exam_id']}/email_invigilator/", + "json": { + "invigilator_id": ctx["seeded_data"]["invigilator_ids"][0], + "invigilator_name": "Homer Simpson", + "invigilator_email": "homer@example.com", + "invigilator_phone": "2505550100", + }, + } + + +def _build_exam_download_request(ctx): + patch_exam_integrations(ctx["monkeypatch"]) + _booking, exam = create_internal_exam_bundle( + ctx["internal_ga_client"], ctx["seeded_data"] + ) + return {"path": f"/exams/{exam['exam_id']}/download/"} + + +AUTHENTICATED_ONLY_CASES = [ + AuthenticatedRouteCase( + "GET /csr_states/", + "GET", + _build_csr_states_request, + _assert_exact_status(200), + public_forbidden=True, + ), + AuthenticatedRouteCase( + "GET /citizens/", + "GET", + _build_citizens_request, + _assert_exact_status(200), + public_forbidden=True, + ), + AuthenticatedRouteCase( + "GET /invigilators/offsite/", + "GET", + _build_invigilators_offsite_request, + _assert_exact_status(200), + ), + AuthenticatedRouteCase( + "POST /exams/bcmp/", "POST", _build_exam_bcmp_request, assert_not_auth_error + ), + AuthenticatedRouteCase( + "POST /exams/bcmp_status/", + "POST", + _build_exam_bcmp_status_request, + _assert_exact_status(200), + ), + AuthenticatedRouteCase( + "GET /exams//upload/", + "GET", + _build_exam_upload_request, + _assert_exact_status(200), + ), + AuthenticatedRouteCase( + "POST /exams//transfer/", + "POST", + _build_exam_transfer_request, + _assert_exact_status(202), + ), + AuthenticatedRouteCase( + "POST /exams//email_invigilator/", + "POST", + _build_exam_email_invigilator_request, + _assert_exact_status(200), + ), + AuthenticatedRouteCase( + "GET /exams//download/", + "GET", + _build_exam_download_request, + _assert_exact_status(200), + ), +] + + +def _context(internal_ga_client, monkeypatch, public_client, seeded_data): + return { + "internal_ga_client": internal_ga_client, + "monkeypatch": monkeypatch, + "public_client": public_client, + "seeded_data": seeded_data, + } + + +@pytest.mark.parametrize("case", AUTHENTICATED_ONLY_CASES, ids=lambda case: case.id) +def test_bare_client_receives_401_for_authenticated_only_routes( + bare_client, case, internal_ga_client, monkeypatch, public_client, seeded_data +): + """Assert that authenticated-only routes reject missing identities before any in-method checks run.""" + ctx = _context(internal_ga_client, monkeypatch, public_client, seeded_data) + request_kwargs = case.build_request(ctx) + + response = bare_client.open( + request_kwargs.pop("path"), method=case.method, **request_kwargs + ) + + assert_unauthorized(response) + + +@pytest.mark.parametrize("case", AUTHENTICATED_ONLY_CASES, ids=lambda case: case.id) +def test_internal_user_reaches_non_auth_behavior_for_authenticated_only_routes( + bare_client, case, internal_ga_client, monkeypatch, public_client, seeded_data +): + """Assert that authenticated internal users still reach the non-auth behavior for authenticated-only routes.""" + ctx = _context(internal_ga_client, monkeypatch, public_client, seeded_data) + request_kwargs = case.build_request(ctx) + + response = internal_ga_client.open( + request_kwargs.pop("path"), method=case.method, **request_kwargs + ) + + case.success_assertion(response) + + +@pytest.mark.parametrize( + "case", + [case for case in AUTHENTICATED_ONLY_CASES if case.public_forbidden], + ids=lambda case: case.id, +) +def test_public_user_receives_403_when_authenticated_only_routes_perform_explicit_role_checks( + bare_client, case, internal_ga_client, monkeypatch, public_client, seeded_data +): + """Assert that public users receive 403 only on authenticated-only routes that explicitly enforce internal roles.""" + ctx = _context(internal_ga_client, monkeypatch, public_client, seeded_data) + request_kwargs = case.build_request(ctx) + + response = public_client.open( + request_kwargs.pop("path"), method=case.method, **request_kwargs + ) + + assert_status(response, 403) diff --git a/api/app/tests/auth/test_cookie_routes.py b/api/app/tests/auth/test_cookie_routes.py new file mode 100644 index 000000000..30443fa5a --- /dev/null +++ b/api/app/tests/auth/test_cookie_routes.py @@ -0,0 +1,19 @@ +import pytest +from app.tests.api_test_support import assert_unauthorized + +pytestmark = [pytest.mark.auth, pytest.mark.usefixtures("seeded_database")] + + +def test_bare_client_receives_401_for_cookie_authenticated_login(bare_client): + """Assert that the admin login route still rejects unauthenticated cookie requests.""" + response = bare_client.get("/login/") + + assert_unauthorized(response) + + +def test_internal_user_can_reach_cookie_authenticated_login(internal_ga_client): + """Assert that an authenticated internal user still reaches the admin login redirect.""" + response = internal_ga_client.get("/login/") + + assert response.status_code == 302, response.get_data(as_text=True) + assert response.headers["Location"].endswith("/admin/") diff --git a/api/app/tests/auth/test_internal_only_routes.py b/api/app/tests/auth/test_internal_only_routes.py new file mode 100644 index 000000000..2f9f103c7 --- /dev/null +++ b/api/app/tests/auth/test_internal_only_routes.py @@ -0,0 +1,878 @@ +from __future__ import annotations + +import io +from dataclasses import dataclass +from datetime import datetime, timezone +from uuid import uuid4 +from zoneinfo import ZoneInfo + +import pytest +from app.tests.api_test_support import ( + assert_forbidden, + assert_not_auth_error, + assert_status, + assert_unauthorized, + create_booking, + create_citizen, + create_internal_appointment, + create_queue_ready_citizen, + create_service_ready_citizen, + create_service_request, + future_utc_window, + json_of, +) +from app.tests.auth.auth_support import ( + configure_video_path, + create_internal_exam_bundle, + create_walkin_target, + prepare_hold_or_finish_target, + prepare_recurring_appointments, + prepare_recurring_bookings, + prepare_service_activation, +) + +pytestmark = [pytest.mark.auth, pytest.mark.usefixtures("seeded_database")] + + +@dataclass(frozen=True) +class InternalRouteCase: + """Describe an internal-only endpoint and how to reach its non-authenticated success path.""" + + id: str + method: str + build_request: object + success_assertion: object + + +def _assert_exact_status(expected_status: int): + def assertion(response): + assert_status(response, expected_status) + + return assertion + + +def _build_context( + app, + bare_client, + internal_ga_client, + monkeypatch, + public_client, + seeded_data, + tmp_path, +): + return { + "app": app, + "bare_client": bare_client, + "internal_ga_client": internal_ga_client, + "monkeypatch": monkeypatch, + "public_client": public_client, + "seeded_data": seeded_data, + "tmp_path": tmp_path, + } + + +def _build_update_csr_request(ctx): + csr_id = ctx["seeded_data"]["csr_ids"]["ga"] + return {"path": f"/csrs/{csr_id}/", "json": {"receptionist_ind": 1}} + + +def _build_update_service_request(ctx): + citizen, service_request = create_service_ready_citizen( + ctx["internal_ga_client"], + ctx["seeded_data"], + position=0, + name="Service Request Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=1, + counter_id_key="counter", + ) + return { + "path": f"/service_requests/{service_request['sr_id']}/", + "json": {"quantity": 2}, + } + + +def _build_activate_service_request(ctx): + _citizen, first_service = prepare_service_activation( + ctx["internal_ga_client"], ctx["seeded_data"] + ) + return {"path": f"/service_requests/{first_service['sr_id']}/activate/"} + + +def _build_channels_request(ctx): + return {"path": "/channels/"} + + +def _build_create_service_request(ctx): + citizen = create_citizen( + ctx["internal_ga_client"], 0, name="Create Service Citizen" + ) + return { + "path": "/service_requests/", + "json": { + "service_request": { + "citizen_id": citizen["citizen_id"], + "service_id": ctx["seeded_data"]["service_ids"]["ptax"], + "channel_id": ctx["seeded_data"]["channel_ids"]["phone"], + "quantity": 1, + } + }, + } + + +def _build_csrs_request(ctx): + return {"path": "/csrs/"} + + +def _build_csr_me_request(ctx): + return {"path": "/csrs/me/"} + + +def _build_video_list_request(ctx): + configure_video_path( + ctx["app"], + ctx["monkeypatch"], + ctx["tmp_path"], + office_number=ctx["seeded_data"]["office_numbers"]["test_office"], + ) + return {"path": "/videofiles/"} + + +def _build_video_delete_request(ctx): + configure_video_path( + ctx["app"], + ctx["monkeypatch"], + ctx["tmp_path"], + office_number=ctx["seeded_data"]["office_numbers"]["test_office"], + ) + return {"path": "/videofiles/", "json": {"name": "sample.mp4"}} + + +def _build_upload_request(ctx): + configure_video_path( + ctx["app"], + ctx["monkeypatch"], + ctx["tmp_path"], + office_number=ctx["seeded_data"]["office_numbers"]["test_office"], + ) + return { + "path": "/upload/", + "data": { + "manifest": '{"default": {"url": "https://example.com/video.mp4"}}', + "file": (io.BytesIO(b"video-bytes"), "sample.mp4"), + }, + "content_type": "multipart/form-data", + } + + +def _build_refresh_services_request(ctx): + return { + "path": f"/services/refresh/?office_id={ctx['seeded_data']['office_ids']['test_office']}" + } + + +def _build_remove_from_queue_request(ctx): + citizen, _service_request = create_service_ready_citizen( + ctx["internal_ga_client"], + ctx["seeded_data"], + position=0, + name="Remove From Queue Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=1, + counter_id_key="counter", + ) + return {"path": f"/citizens/{citizen['citizen_id']}/remove_from_queue/"} + + +def _build_begin_service_request(ctx): + citizen, _service_request = create_service_ready_citizen( + ctx["internal_ga_client"], + ctx["seeded_data"], + position=0, + name="Begin Service Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=1, + counter_id_key="counter", + ) + return {"path": f"/citizens/{citizen['citizen_id']}/begin_service/"} + + +def _build_citizen_service_requests_request(ctx): + citizen, _service_request = create_service_ready_citizen( + ctx["internal_ga_client"], + ctx["seeded_data"], + position=0, + name="Citizen Services Lookup", + service_id_key="ptax", + channel_id_key="phone", + quantity=1, + counter_id_key="counter", + ) + return {"path": f"/citizens/{citizen['citizen_id']}/service_requests/"} + + +def _build_citizen_detail_request(ctx): + citizen = create_citizen(ctx["internal_ga_client"], 0, name="Citizen Detail") + return {"path": f"/citizens/{citizen['citizen_id']}/"} + + +def _build_citizen_update_request(ctx): + citizen = create_citizen(ctx["internal_ga_client"], 0, name="Citizen Update") + return { + "path": f"/citizens/{citizen['citizen_id']}/", + "json": {"citizen_name": "Citizen Updated"}, + } + + +def _build_specific_invite_request(ctx): + citizen, _service_request, _queued = create_queue_ready_citizen( + ctx["internal_ga_client"], + ctx["seeded_data"], + position=0, + name="Specific Invite Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=1, + counter_id_key="counter", + qt_xn_citizen_ind=0, + ) + return {"path": f"/citizens/{citizen['citizen_id']}/invite/"} + + +def _build_citizen_left_request(ctx): + citizen, _service_request = create_service_ready_citizen( + ctx["internal_ga_client"], + ctx["seeded_data"], + position=0, + name="Citizen Left", + service_id_key="ptax", + channel_id_key="phone", + quantity=1, + counter_id_key="counter", + ) + return {"path": f"/citizens/{citizen['citizen_id']}/citizen_left/"} + + +def _build_add_to_queue_request(ctx): + citizen, _service_request = create_service_ready_citizen( + ctx["internal_ga_client"], + ctx["seeded_data"], + position=0, + name="Add To Queue", + service_id_key="ptax", + channel_id_key="phone", + quantity=1, + counter_id_key="counter", + ) + return {"path": f"/citizens/{citizen['citizen_id']}/add_to_queue/"} + + +def _build_finish_service_request(ctx): + citizen = prepare_hold_or_finish_target( + ctx["internal_ga_client"], ctx["seeded_data"] + ) + return {"path": f"/citizens/{citizen['citizen_id']}/finish_service/"} + + +def _build_place_on_hold_request(ctx): + citizen = prepare_hold_or_finish_target( + ctx["internal_ga_client"], ctx["seeded_data"] + ) + return {"path": f"/citizens/{citizen['citizen_id']}/place_on_hold/"} + + +def _build_add_citizen_request(ctx): + return { + "path": "/citizens/0/add_citizen/", + "json": {"citizen_name": "Added Citizen"}, + } + + +def _build_generic_invite_request(ctx): + create_queue_ready_citizen( + ctx["internal_ga_client"], + ctx["seeded_data"], + position=0, + name="Generic Invite Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=1, + counter_id_key="counter", + qt_xn_citizen_ind=0, + ) + return { + "path": "/citizens/invite/", + "json": {"counter_id": ctx["seeded_data"]["counter_ids"]["counter"]}, + } + + +def _build_rooms_request(ctx): + return {"path": "/rooms/"} + + +def _build_booking_detail_request(ctx): + booking = create_booking( + ctx["internal_ga_client"], ctx["seeded_data"], days_from_now=2 + ) + return {"path": f"/bookings/{booking['booking_id']}/"} + + +def _build_recurring_booking_update_request(ctx): + recurring_uuid = prepare_recurring_bookings( + ctx["internal_ga_client"], ctx["seeded_data"] + ) + return { + "path": f"/bookings/recurring/{recurring_uuid}", + "json": {"booking_name": "Recurring Booking Updated"}, + } + + +def _build_recurring_booking_current_office_delete_request(ctx): + recurring_uuid = prepare_recurring_bookings( + ctx["internal_ga_client"], ctx["seeded_data"] + ) + return {"path": f"/bookings/recurring/current-office/{recurring_uuid}"} + + +def _build_recurring_booking_stat_delete_request(ctx): + recurring_uuid = prepare_recurring_bookings( + ctx["internal_ga_client"], ctx["seeded_data"] + ) + return {"path": f"/bookings/recurring/stat/{recurring_uuid}"} + + +def _build_booking_create_request(ctx): + start_time, end_time = future_utc_window(2, duration_minutes=120) + return { + "path": "/bookings/", + "json": { + "booking_name": f"Auth Booking {uuid4().hex[:6]}", + "booking_contact_information": "booking@example.com", + "fees": "false", + "office_id": ctx["seeded_data"]["office_ids"]["test_office"], + "room_id": ctx["seeded_data"]["room_id"], + "start_time": start_time, + "end_time": end_time, + "invigilator_id": [ctx["seeded_data"]["invigilator_ids"][0]], + }, + } + + +def _build_invigilator_update_request(ctx): + invigilator_id = ctx["seeded_data"]["invigilator_ids"][0] + return {"path": f"/invigilator/{invigilator_id}/?subtract=True&add=False"} + + +def _build_invigilator_list_request(ctx): + return {"path": "/invigilators/"} + + +def _build_booking_delete_request(ctx): + booking = create_booking( + ctx["internal_ga_client"], ctx["seeded_data"], days_from_now=2 + ) + return {"path": f"/bookings/{booking['booking_id']}/"} + + +def _build_booking_list_request(ctx): + return {"path": "/bookings/"} + + +def _build_booking_recurring_delete_request(ctx): + recurring_uuid = prepare_recurring_bookings( + ctx["internal_ga_client"], ctx["seeded_data"] + ) + return {"path": f"/bookings/recurring/{recurring_uuid}"} + + +def _build_walkin_reminder_request(ctx): + citizen, _walkin_id = create_walkin_target( + ctx["app"], ctx["internal_ga_client"], ctx["seeded_data"] + ) + return { + "path": "/send-reminder/line-walkin/", + "json": {"previous_citizen_id": citizen["citizen_id"]}, + } + + +def _build_appointment_recurring_update_request(ctx): + recurring_uuid = prepare_recurring_appointments( + ctx["internal_ga_client"], ctx["seeded_data"] + ) + return { + "path": f"/appointments/recurring/{recurring_uuid}", + "json": {"comments": "Recurring appointment updated"}, + } + + +def _build_appointment_all_stat_delete_request(ctx): + recurring_uuid = prepare_recurring_appointments( + ctx["internal_ga_client"], ctx["seeded_data"] + ) + return {"path": f"/appointments/all-stat/{recurring_uuid}"} + + +def _build_appointment_list_request(ctx): + return {"path": "/appointments/"} + + +def _build_appointment_recurring_delete_request(ctx): + recurring_uuid = prepare_recurring_appointments( + ctx["internal_ga_client"], ctx["seeded_data"] + ) + return {"path": f"/appointments/recurring/{recurring_uuid}"} + + +def _build_appointment_detail_request(ctx): + appointment = create_internal_appointment( + ctx["internal_ga_client"], ctx["seeded_data"], days_from_now=2 + ) + return {"path": f"/appointments/{appointment['appointment_id']}/"} + + +def _build_exam_create_request(ctx): + booking = create_booking( + ctx["internal_ga_client"], ctx["seeded_data"], days_from_now=5 + ) + return { + "path": "/exams/", + "json": { + "booking_id": booking["booking_id"], + "event_id": f"auth-event-{uuid4().hex[:6]}", + "exam_method": "paper", + "exam_name": "Auth Exam", + "exam_type_id": ctx["seeded_data"]["exam_type_id"], + "exam_written_ind": 0, + "examinee_name": "Auth Examinee", + "notes": "Auth exam notes", + "number_of_students": 19, + "office_id": ctx["seeded_data"]["office_ids"]["test_office"], + "offsite_location": "Test Office", + "expiry_date": datetime.now(timezone.utc) + .replace(microsecond=0) + .isoformat(), + }, + } + + +def _build_exam_type_list_request(ctx): + return {"path": "/exam_types/"} + + +def _build_exam_update_request(ctx): + _booking, exam = create_internal_exam_bundle( + ctx["internal_ga_client"], ctx["seeded_data"] + ) + return { + "path": f"/exams/{exam['exam_id']}/", + "json": {"exam_name": "Updated Auth Exam"}, + } + + +def _build_exam_detail_request(ctx): + _booking, exam = create_internal_exam_bundle( + ctx["internal_ga_client"], ctx["seeded_data"] + ) + return {"path": f"/exams/{exam['exam_id']}/"} + + +def _build_exam_list_request(ctx): + return {"path": "/exams/"} + + +def _build_exam_export_request(ctx): + booking, _exam = create_internal_exam_bundle( + ctx["internal_ga_client"], ctx["seeded_data"] + ) + export_date = ( + datetime.fromisoformat(booking["start_time"].replace("Z", "+00:00")) + .astimezone(ZoneInfo(ctx["seeded_data"]["office_timezones"]["test_office"])) + .date() + ) + return { + "path": f"/exams/export/?start_date={export_date.isoformat()}&end_date={export_date.isoformat()}" + } + + +def _build_exam_delete_request(ctx): + _booking, exam = create_internal_exam_bundle( + ctx["internal_ga_client"], ctx["seeded_data"] + ) + return {"path": f"/exams/{exam['exam_id']}/"} + + +def _build_exam_event_lookup_request(ctx): + booking = create_booking( + ctx["internal_ga_client"], ctx["seeded_data"], days_from_now=5 + ) + event_id = 9000 + booking["booking_id"] + create_exam_response = ctx["internal_ga_client"].post( + "/exams/", + json={ + "booking_id": booking["booking_id"], + "event_id": str(event_id), + "exam_method": "paper", + "exam_name": "Lookup Exam", + "exam_type_id": ctx["seeded_data"]["exam_type_id"], + "exam_written_ind": 0, + "examinee_name": "Lookup Examinee", + "notes": "Lookup exam notes", + "number_of_students": 19, + "office_id": ctx["seeded_data"]["office_ids"]["test_office"], + "offsite_location": "Test Office", + "expiry_date": datetime.now(timezone.utc) + .replace(microsecond=0) + .isoformat(), + }, + ) + assert_status(create_exam_response, 201) + return {"path": f"/exams/event_id/{event_id}/"} + + +INTERNAL_ONLY_CASES = [ + InternalRouteCase( + "PUT /csrs//", "PUT", _build_update_csr_request, _assert_exact_status(200) + ), + InternalRouteCase( + "PUT /service_requests//", + "PUT", + _build_update_service_request, + _assert_exact_status(200), + ), + InternalRouteCase( + "POST /service_requests//activate/", + "POST", + _build_activate_service_request, + _assert_exact_status(200), + ), + InternalRouteCase( + "GET /channels/", "GET", _build_channels_request, _assert_exact_status(200) + ), + InternalRouteCase( + "POST /service_requests/", + "POST", + _build_create_service_request, + _assert_exact_status(201), + ), + InternalRouteCase( + "GET /csrs/", "GET", _build_csrs_request, _assert_exact_status(200) + ), + InternalRouteCase( + "GET /csrs/me/", "GET", _build_csr_me_request, _assert_exact_status(200) + ), + InternalRouteCase( + "GET /videofiles/", "GET", _build_video_list_request, _assert_exact_status(200) + ), + InternalRouteCase( + "DELETE /videofiles/", + "DELETE", + _build_video_delete_request, + _assert_exact_status(204), + ), + InternalRouteCase( + "POST /upload/", "POST", _build_upload_request, assert_not_auth_error + ), + InternalRouteCase( + "GET /services/refresh/", + "GET", + _build_refresh_services_request, + _assert_exact_status(200), + ), + InternalRouteCase( + "POST /citizens//remove_from_queue/", + "POST", + _build_remove_from_queue_request, + assert_not_auth_error, + ), + InternalRouteCase( + "POST /citizens//begin_service/", + "POST", + _build_begin_service_request, + _assert_exact_status(200), + ), + InternalRouteCase( + "GET /citizens//service_requests/", + "GET", + _build_citizen_service_requests_request, + _assert_exact_status(200), + ), + InternalRouteCase( + "GET /citizens//", + "GET", + _build_citizen_detail_request, + _assert_exact_status(200), + ), + InternalRouteCase( + "PUT /citizens//", + "PUT", + _build_citizen_update_request, + _assert_exact_status(200), + ), + InternalRouteCase( + "POST /citizens//invite/", + "POST", + _build_specific_invite_request, + _assert_exact_status(200), + ), + InternalRouteCase( + "POST /citizens//citizen_left/", + "POST", + _build_citizen_left_request, + _assert_exact_status(200), + ), + InternalRouteCase( + "POST /citizens//add_to_queue/", + "POST", + _build_add_to_queue_request, + _assert_exact_status(200), + ), + InternalRouteCase( + "POST /citizens//finish_service/", + "POST", + _build_finish_service_request, + _assert_exact_status(200), + ), + InternalRouteCase( + "POST /citizens//place_on_hold/", + "POST", + _build_place_on_hold_request, + _assert_exact_status(200), + ), + InternalRouteCase( + "POST /citizens//add_citizen/", + "POST", + _build_add_citizen_request, + _assert_exact_status(201), + ), + InternalRouteCase( + "POST /citizens/invite/", + "POST", + _build_generic_invite_request, + _assert_exact_status(200), + ), + InternalRouteCase( + "GET /rooms/", "GET", _build_rooms_request, _assert_exact_status(200) + ), + InternalRouteCase( + "GET /bookings//", + "GET", + _build_booking_detail_request, + _assert_exact_status(200), + ), + InternalRouteCase( + "PUT /bookings/recurring/", + "PUT", + _build_recurring_booking_update_request, + _assert_exact_status(200), + ), + InternalRouteCase( + "DELETE /bookings/recurring/current-office/", + "DELETE", + _build_recurring_booking_current_office_delete_request, + _assert_exact_status(204), + ), + InternalRouteCase( + "DELETE /bookings/recurring/stat/", + "DELETE", + _build_recurring_booking_stat_delete_request, + _assert_exact_status(204), + ), + InternalRouteCase( + "POST /bookings/", + "POST", + _build_booking_create_request, + _assert_exact_status(201), + ), + InternalRouteCase( + "PUT /invigilator//", + "PUT", + _build_invigilator_update_request, + _assert_exact_status(200), + ), + InternalRouteCase( + "GET /invigilators/", + "GET", + _build_invigilator_list_request, + _assert_exact_status(200), + ), + InternalRouteCase( + "DELETE /bookings//", + "DELETE", + _build_booking_delete_request, + _assert_exact_status(204), + ), + InternalRouteCase( + "GET /bookings/", "GET", _build_booking_list_request, _assert_exact_status(200) + ), + InternalRouteCase( + "DELETE /bookings/recurring/", + "DELETE", + _build_booking_recurring_delete_request, + _assert_exact_status(204), + ), + InternalRouteCase( + "POST /send-reminder/line-walkin/", + "POST", + _build_walkin_reminder_request, + _assert_exact_status(200), + ), + InternalRouteCase( + "PUT /appointments/recurring/", + "PUT", + _build_appointment_recurring_update_request, + _assert_exact_status(200), + ), + InternalRouteCase( + "DELETE /appointments/all-stat/", + "DELETE", + _build_appointment_all_stat_delete_request, + _assert_exact_status(204), + ), + InternalRouteCase( + "GET /appointments/", + "GET", + _build_appointment_list_request, + _assert_exact_status(200), + ), + InternalRouteCase( + "DELETE /appointments/recurring/", + "DELETE", + _build_appointment_recurring_delete_request, + _assert_exact_status(204), + ), + InternalRouteCase( + "GET /appointments//", + "GET", + _build_appointment_detail_request, + _assert_exact_status(200), + ), + InternalRouteCase( + "POST /exams/", "POST", _build_exam_create_request, _assert_exact_status(201) + ), + InternalRouteCase( + "GET /exam_types/", + "GET", + _build_exam_type_list_request, + _assert_exact_status(200), + ), + InternalRouteCase( + "PUT /exams//", "PUT", _build_exam_update_request, _assert_exact_status(201) + ), + InternalRouteCase( + "GET /exams//", "GET", _build_exam_detail_request, _assert_exact_status(200) + ), + InternalRouteCase( + "GET /exams/", "GET", _build_exam_list_request, _assert_exact_status(200) + ), + InternalRouteCase( + "GET /exams/export/", + "GET", + _build_exam_export_request, + _assert_exact_status(200), + ), + InternalRouteCase( + "DELETE /exams//", + "DELETE", + _build_exam_delete_request, + _assert_exact_status(204), + ), + InternalRouteCase( + "GET /exams/event_id//", + "GET", + _build_exam_event_lookup_request, + _assert_exact_status(200), + ), +] + + +@pytest.mark.parametrize("case", INTERNAL_ONLY_CASES, ids=lambda case: case.id) +def test_bare_client_receives_401_for_internal_only_routes( + app, + bare_client, + case, + internal_ga_client, + monkeypatch, + public_client, + seeded_data, + tmp_path, +): + """Assert that internal-only routes reject unauthenticated requests.""" + ctx = _build_context( + app, + bare_client, + internal_ga_client, + monkeypatch, + public_client, + seeded_data, + tmp_path, + ) + request_kwargs = case.build_request(ctx) + + response = bare_client.open( + request_kwargs.pop("path"), method=case.method, **request_kwargs + ) + + assert_unauthorized(response) + + +@pytest.mark.parametrize("case", INTERNAL_ONLY_CASES, ids=lambda case: case.id) +def test_public_user_receives_403_for_internal_only_routes( + app, + bare_client, + case, + internal_ga_client, + monkeypatch, + public_client, + seeded_data, + tmp_path, +): + """Assert that public users remain forbidden from internal-only routes.""" + ctx = _build_context( + app, + bare_client, + internal_ga_client, + monkeypatch, + public_client, + seeded_data, + tmp_path, + ) + request_kwargs = case.build_request(ctx) + + response = public_client.open( + request_kwargs.pop("path"), method=case.method, **request_kwargs + ) + + assert_forbidden(response) + + +@pytest.mark.parametrize("case", INTERNAL_ONLY_CASES, ids=lambda case: case.id) +def test_internal_user_reaches_non_auth_behavior_for_internal_only_routes( + app, + bare_client, + case, + internal_ga_client, + monkeypatch, + public_client, + seeded_data, + tmp_path, +): + """Assert that internal users still reach each internal-only route's non-auth behavior.""" + ctx = _build_context( + app, + bare_client, + internal_ga_client, + monkeypatch, + public_client, + seeded_data, + tmp_path, + ) + request_kwargs = case.build_request(ctx) + + response = internal_ga_client.open( + request_kwargs.pop("path"), method=case.method, **request_kwargs + ) + + case.success_assertion(response) diff --git a/api/app/tests/auth/test_mixed_role_routes.py b/api/app/tests/auth/test_mixed_role_routes.py new file mode 100644 index 000000000..7842d0e01 --- /dev/null +++ b/api/app/tests/auth/test_mixed_role_routes.py @@ -0,0 +1,152 @@ +import pytest +from app.tests.api_test_support import ( + assert_json_response, + assert_unauthorized, + create_internal_appointment, + create_public_user, + json_of, + public_slot_payload, + slot_window_to_iso, +) +from app.tests.auth.auth_support import create_public_appointment + +pytestmark = [pytest.mark.auth, pytest.mark.usefixtures("seeded_database")] + + +def test_bare_client_receives_401_for_mixed_role_appointment_create( + bare_client, seeded_data +): + """Assert that appointment creation still requires some authenticated role even though multiple roles are allowed.""" + payload, _day_key, _slots = public_slot_payload( + bare_client, seeded_data, minimum_slots=1 + ) + response = bare_client.post("/appointments/", json=payload) + + assert_unauthorized(response) + + +def test_bare_client_receives_401_for_mixed_role_appointment_update( + bare_client, internal_ga_client, seeded_data +): + """Assert that appointment updates still reject unauthenticated callers.""" + appointment = create_internal_appointment( + internal_ga_client, seeded_data, days_from_now=2 + ) + response = bare_client.put( + f"/appointments/{appointment['appointment_id']}/", json={"comments": "No auth"} + ) + + assert_unauthorized(response) + + +def test_bare_client_receives_401_for_mixed_role_appointment_delete( + bare_client, internal_ga_client, seeded_data +): + """Assert that appointment deletion still rejects unauthenticated callers.""" + appointment = create_internal_appointment( + internal_ga_client, seeded_data, days_from_now=2 + ) + response = bare_client.delete(f"/appointments/{appointment['appointment_id']}/") + + assert_unauthorized(response) + + +def test_internal_user_can_create_appointments_on_mixed_role_route( + internal_ga_client, seeded_data +): + """Assert that internal users can still create appointments on the shared appointment route.""" + appointment = create_internal_appointment( + internal_ga_client, seeded_data, days_from_now=2 + ) + + assert appointment["appointment_id"] > 0 + + +def test_internal_user_can_update_appointments_on_mixed_role_route( + internal_ga_client, seeded_data +): + """Assert that internal users can still update appointments on the shared appointment route.""" + appointment = create_internal_appointment( + internal_ga_client, seeded_data, days_from_now=2 + ) + + response = internal_ga_client.put( + f"/appointments/{appointment['appointment_id']}/", + json={"comments": "Internal mixed-route update"}, + ) + + assert_json_response(response, 200) + assert json_of(response)["appointment"]["comments"] == "Internal mixed-route update" + + +def test_internal_user_can_delete_appointments_on_mixed_role_route( + internal_ga_client, seeded_data +): + """Assert that internal users can still delete appointments on the shared appointment route.""" + appointment = create_internal_appointment( + internal_ga_client, seeded_data, days_from_now=2 + ) + + response = internal_ga_client.delete( + f"/appointments/{appointment['appointment_id']}/" + ) + + assert response.status_code == 204, response.get_data(as_text=True) + + +def test_public_user_can_create_appointments_on_mixed_role_route( + public_client, seeded_data +): + """Assert that public users can still create appointments on the shared appointment route.""" + create_public_user(public_client) + payload, _day_key, _slots = public_slot_payload( + public_client, seeded_data, minimum_slots=1 + ) + + response = public_client.post("/appointments/", json=payload) + + assert_json_response(response, 201) + assert json_of(response)["appointment"]["online_flag"] is True + + +def test_public_user_can_update_their_own_appointments_on_mixed_role_route( + public_client, seeded_data +): + """Assert that public users can still update their own appointments on the shared appointment route.""" + create_public_user(public_client) + payload, day_key, slots = public_slot_payload( + public_client, seeded_data, minimum_slots=2 + ) + create_response = public_client.post("/appointments/", json=payload) + assert_json_response(create_response, 201) + appointment = json_of(create_response)["appointment"] + updated_start_time, updated_end_time = slot_window_to_iso( + day_key, + slots[1], + seeded_data["office_timezones"]["limited_office"], + ) + + response = public_client.put( + f"/appointments/{appointment['appointment_id']}/", + json={ + "comments": "Public mixed-route update", + "office_id": appointment["office_id"], + "service_id": appointment["service_id"], + "start_time": updated_start_time, + "end_time": updated_end_time, + }, + ) + + assert_json_response(response, 200) + assert json_of(response)["appointment"]["comments"] == "Public mixed-route update" + + +def test_public_user_can_delete_their_own_appointments_on_mixed_role_route( + public_client, seeded_data +): + """Assert that public users can still delete their own appointments on the shared appointment route.""" + appointment = create_public_appointment(public_client, seeded_data) + + response = public_client.delete(f"/appointments/{appointment['appointment_id']}/") + + assert response.status_code == 204, response.get_data(as_text=True) diff --git a/api/app/tests/auth/test_open_routes.py b/api/app/tests/auth/test_open_routes.py new file mode 100644 index 000000000..4bc6c5867 --- /dev/null +++ b/api/app/tests/auth/test_open_routes.py @@ -0,0 +1,171 @@ +import pytest +from app.tests.api_test_support import ( + assert_json_response, + create_draft_appointment, + json_of, + public_slot_payload, +) +from app.tests.auth.auth_support import configure_video_path, create_walkin_target + +pytestmark = [pytest.mark.auth, pytest.mark.usefixtures("seeded_database")] + + +@pytest.mark.parametrize( + ("path", "query", "expected_key"), + [ + pytest.param("/healthz/", "", "message", id="GET /healthz/"), + pytest.param("/readyz/", "", "message", id="GET /readyz/"), + pytest.param("/offices/", "", "offices", id="GET /offices/"), + pytest.param("/services/", "", "services", id="GET /services/"), + pytest.param("/categories/", "", "categories", id="GET /categories/"), + ], +) +def test_bare_client_can_access_simple_open_routes( + bare_client, path, query, expected_key +): + """Assert that explicitly open routes remain reachable without an authenticated identity.""" + response = bare_client.get(f"{path}{query}") + + assert_json_response(response, 200) + assert expected_key in json_of(response) + + +def test_bare_client_can_access_logout_without_authentication(bare_client): + """Assert that logout remains reachable without an authenticated identity.""" + response = bare_client.get("/logout/") + + assert response.status_code == 302, response.get_data(as_text=True) + assert response.headers["Location"].endswith("/admin/") + + +def test_bare_client_can_access_smartboard_without_authentication( + bare_client, seeded_data +): + """Assert that the public smartboard endpoint remains reachable without authentication.""" + office_number = seeded_data["office_numbers"]["test_office"] + response = bare_client.get(f"/smartboard/?office_number={office_number}") + + assert_json_response(response, 200) + body = json_of(response) + assert "office_type" in body + assert "citizens" in body + + +def test_bare_client_can_access_smartboard_side_menu_without_authentication( + bare_client, seeded_data +): + """Assert that the smartboard side-menu endpoint remains publicly reachable.""" + office_number = seeded_data["office_numbers"]["test_office"] + response = bare_client.get(f"/smardboard/side-menu/{office_number}") + + assert_json_response(response, 200) + assert "office" in json_of(response) + + +def test_bare_client_can_access_public_video_manifest_without_authentication( + bare_client, app, monkeypatch, seeded_data, tmp_path +): + """Assert that public video lookup remains reachable without an authenticated identity.""" + office_number = seeded_data["office_numbers"]["test_office"] + configure_video_path(app, monkeypatch, tmp_path, office_number=office_number) + + response = bare_client.get(f"/videofiles/{office_number}") + + assert_json_response(response, 200) + assert json_of(response)["videourl"].endswith(".mp4") + + +def test_bare_client_can_access_slots_without_authentication(bare_client, seeded_data): + """Assert that appointment slot discovery remains publicly reachable.""" + response = bare_client.get( + f"/offices/{seeded_data['office_ids']['limited_office']}/slots/?service_id={seeded_data['service_ids']['limited_office_service']}" + ) + + assert_json_response(response, 200) + assert json_of(response) + + +def test_bare_client_can_access_walkin_lookup_without_authentication( + bare_client, internal_ga_client, seeded_data, app +): + """Assert that walk-in queue lookups remain publicly reachable without authentication.""" + _citizen, walkin_id = create_walkin_target(app, internal_ga_client, seeded_data) + + response = bare_client.get(f"/citizen/all-walkin/{walkin_id}/") + + assert_json_response(response, 200) + assert "citizen" in json_of(response) + + +def test_bare_client_can_access_waiting_queue_details_without_authentication( + bare_client, seeded_data, app +): + """Assert that waiting smartboard queue details remain publicly reachable.""" + office_number = seeded_data["office_numbers"]["test_office"] + + with app.app_context(): + from app.models.theq import Office + from qsystem import db + + office = Office.find_by_id(seeded_data["office_ids"]["test_office"]) + office.currently_waiting = 0 + db.session.add(office) + db.session.commit() + + response = bare_client.get(f"/smardboard/Q-details/waiting/{office_number}") + + assert_json_response(response, 200) + assert "citizen_in_q" in json_of(response) + + +def test_bare_client_can_access_upcoming_queue_details_without_authentication( + bare_client, seeded_data, app +): + """Assert that upcoming smartboard queue details remain publicly reachable.""" + office_number = seeded_data["office_numbers"]["test_office"] + + with app.app_context(): + from app.models.theq import Office + from qsystem import db + + office = Office.find_by_id(seeded_data["office_ids"]["test_office"]) + office.currently_waiting = 0 + db.session.add(office) + db.session.commit() + + response = bare_client.get(f"/smardboard/Q-details/upcoming/{office_number}") + + assert_json_response(response, 200) + assert "booked_not_checkin" in json_of(response) + + +def test_bare_client_can_create_a_draft_appointment_without_authentication( + bare_client, seeded_data +): + """Assert that draft appointments remain creatable before a user authenticates.""" + payload, _day_key, _slots = public_slot_payload( + bare_client, seeded_data, minimum_slots=1 + ) + response = bare_client.post("/appointments/draft", json=payload) + + assert_json_response(response, 201) + assert json_of(response)["appointment"]["is_draft"] is True + + +def test_bare_client_can_delete_a_draft_appointment_without_authentication( + bare_client, seeded_data +): + """Assert that draft appointments remain deletable without an authenticated identity.""" + draft = create_draft_appointment(bare_client, seeded_data) + + response = bare_client.delete(f"/appointments/draft/{draft['appointment_id']}/") + + assert response.status_code == 204, response.get_data(as_text=True) + + +def test_bare_client_can_flush_expired_drafts_without_authentication(bare_client): + """Assert that draft flushing remains callable without an authenticated identity.""" + response = bare_client.post("/appointments/draft/flush") + + assert_json_response(response, 200) + assert "deleted_draft_ids" in json_of(response) diff --git a/api/app/tests/auth/test_public_user_routes.py b/api/app/tests/auth/test_public_user_routes.py new file mode 100644 index 000000000..192403503 --- /dev/null +++ b/api/app/tests/auth/test_public_user_routes.py @@ -0,0 +1,202 @@ +from __future__ import annotations + +from dataclasses import dataclass + +import pytest +from app.tests.api_test_support import ( + assert_forbidden, + assert_status, + assert_unauthorized, + create_public_user, + json_of, + public_slot_payload, +) + +pytestmark = [pytest.mark.auth, pytest.mark.usefixtures("seeded_database")] + + +@dataclass(frozen=True) +class PublicRouteCase: + """Describe a public-user-only route and the request needed to reach it.""" + + id: str + method: str + build_request: object + expected_status: int + + +def _create_user_request(ctx): + return {"path": "/users/"} + + +def _update_user_request(ctx): + user = create_public_user(ctx["public_client"]) + return { + "path": f"/users/{user['user_id']}/", + "json": { + "email": "updated-public@example.com", + "telephone": "2505550100", + "send_email_reminders": True, + "send_sms_reminders": True, + }, + } + + +def _me_request(ctx): + create_public_user(ctx["public_client"]) + return {"path": "/users/me/"} + + +def _appointments_request(ctx): + create_public_user(ctx["public_client"]) + payload, _day_key, _slots = public_slot_payload( + ctx["public_client"], ctx["seeded_data"], minimum_slots=1 + ) + create_response = ctx["public_client"].post("/appointments/", json=payload) + assert_status(create_response, 201) + return {"path": "/users/appointments/"} + + +PUBLIC_ROUTE_CASES = [ + PublicRouteCase("POST /users/", "POST", _create_user_request, 200), + PublicRouteCase("PUT /users//", "PUT", _update_user_request, 200), + PublicRouteCase("GET /users/me/", "GET", _me_request, 200), + PublicRouteCase("GET /users/appointments/", "GET", _appointments_request, 200), +] + + +def _context(bare_client, internal_ga_client, public_client, seeded_data): + return { + "bare_client": bare_client, + "internal_ga_client": internal_ga_client, + "public_client": public_client, + "seeded_data": seeded_data, + } + + +def _seed_blank_public_user(app): + with app.app_context(): + from app.models.theq import PublicUser + from qsystem import db + + user = PublicUser.query.filter_by(username="").one_or_none() + if user is None: + user = PublicUser( + username="", + display_name="Legacy Blank User", + last_name="Legacy", + email="legacy-blank@example.com", + telephone="2505550199", + send_email_reminders=False, + send_sms_reminders=False, + ) + db.session.add(user) + db.session.commit() + return user.user_id + + +@pytest.mark.parametrize("case", PUBLIC_ROUTE_CASES, ids=lambda case: case.id) +def test_bare_client_receives_401_for_public_user_routes( + bare_client, case, internal_ga_client, public_client, seeded_data +): + """Assert that public-user routes still require an authenticated public identity.""" + ctx = _context(bare_client, internal_ga_client, public_client, seeded_data) + request_kwargs = case.build_request(ctx) + + response = bare_client.open( + request_kwargs.pop("path"), method=case.method, **request_kwargs + ) + + assert_unauthorized(response) + + +@pytest.mark.parametrize("case", PUBLIC_ROUTE_CASES, ids=lambda case: case.id) +def test_internal_user_receives_403_for_public_user_routes( + bare_client, case, internal_ga_client, public_client, seeded_data +): + """Assert that internal users remain forbidden from public-user-only routes.""" + ctx = _context(bare_client, internal_ga_client, public_client, seeded_data) + request_kwargs = case.build_request(ctx) + + response = internal_ga_client.open( + request_kwargs.pop("path"), method=case.method, **request_kwargs + ) + + assert_forbidden(response) + + +@pytest.mark.parametrize("case", PUBLIC_ROUTE_CASES, ids=lambda case: case.id) +def test_public_user_can_reach_public_user_routes( + bare_client, case, internal_ga_client, public_client, seeded_data +): + """Assert that authenticated public users still reach their user-management routes.""" + ctx = _context(bare_client, internal_ga_client, public_client, seeded_data) + request_kwargs = case.build_request(ctx) + + response = public_client.open( + request_kwargs.pop("path"), method=case.method, **request_kwargs + ) + + assert_status(response, case.expected_status) + assert response.get_json() is not None + + +def test_public_user_create_backfills_legacy_required_fields(public_client_alt): + """Assert that user creation returns non-null legacy fields expected by the Postman collection.""" + user = create_public_user(public_client_alt) + + assert user["last_name"] == "PublicAlt" + assert user["telephone"] == "" + assert user["send_email_reminders"] is False + assert user["send_sms_reminders"] is False + + +def test_malformed_public_identity_cannot_create_or_match_blank_user( + public_client_malformed, app +): + """Assert that malformed public identities fail auth instead of matching a legacy blank username row.""" + blank_user_id = _seed_blank_public_user(app) + + response = public_client_malformed.post("/users/") + + assert_unauthorized(response) + + with app.app_context(): + from app.models.theq import PublicUser + + blank_user = PublicUser.find_by_user_id(blank_user_id) + assert blank_user is not None + assert blank_user.display_name == "Legacy Blank User" + assert PublicUser.query.filter_by(username="").count() == 1 + + +def test_malformed_public_identity_cannot_read_me_as_blank_user( + public_client_malformed, app +): + """Assert that malformed public identities cannot resolve /users/me/ to a blank username row.""" + _seed_blank_public_user(app) + + response = public_client_malformed.get("/users/me/") + + assert_unauthorized(response) + + +def test_public_identity_without_username_claim_cannot_read_me_as_blank_user( + public_client_missing_username, app +): + """Assert that a public token missing the username claim cannot resolve /users/me/ to the legacy blank user.""" + _seed_blank_public_user(app) + + response = public_client_missing_username.get("/users/me/") + + assert_unauthorized(response) + + +def test_blank_username_lookups_are_rejected(app): + """Assert that blank usernames no longer resolve public-user or CSR lookups.""" + with app.app_context(): + from app.models.theq import CSR, PublicUser + + assert PublicUser.find_by_username("") is None + assert PublicUser.find_appointments_by_username("") == [] + assert CSR.find_by_username("") is None diff --git a/api/app/tests/auth/test_reminder_job_routes.py b/api/app/tests/auth/test_reminder_job_routes.py new file mode 100644 index 000000000..538c64a58 --- /dev/null +++ b/api/app/tests/auth/test_reminder_job_routes.py @@ -0,0 +1,38 @@ +import pytest +from app.tests.api_test_support import ( + assert_forbidden, + assert_json_response, + assert_unauthorized, + json_of, +) + +pytestmark = [pytest.mark.auth, pytest.mark.usefixtures("seeded_database")] + + +def test_bare_client_receives_401_for_reminder_job_routes(bare_client): + """Assert that reminder-job routes still reject unauthenticated callers.""" + response = bare_client.get("/appointment/reminders/email/") + + assert_unauthorized(response) + + +def test_internal_user_receives_403_for_reminder_job_routes(internal_ga_client): + """Assert that regular internal identities remain forbidden from reminder-job routes.""" + response = internal_ga_client.get("/appointment/reminders/email/") + + assert_forbidden(response) + + +def test_public_user_receives_403_for_reminder_job_routes(public_client): + """Assert that public identities remain forbidden from reminder-job routes.""" + response = public_client.get("/appointment/reminders/email/") + + assert_forbidden(response) + + +def test_reminder_job_identity_can_access_reminder_routes(reminder_job_client): + """Assert that the synthetic reminder-job identity can still reach reminder routes.""" + response = reminder_job_client.get("/appointment/reminders/email/") + + assert_json_response(response, 200) + assert "appointments" in json_of(response) diff --git a/api/app/tests/conftest.py b/api/app/tests/conftest.py new file mode 100644 index 000000000..9cf7b605e --- /dev/null +++ b/api/app/tests/conftest.py @@ -0,0 +1,53 @@ +from pathlib import Path + +import pytest + +pytest_plugins = [ + "app.tests.fixtures.auth", + "app.tests.fixtures.db", + "app.tests.fixtures.smoke", +] + +CONTRACT_SMOKE_FILES = { + "test_contract_helpers.py", + "test_contract_strictness.py", +} +DB_BACKED_TOP_LEVEL_FILES = { + "test_flask3_admin.py", + "test_schema_compatibility.py", + "test_sqlalchemy.py", +} + + +def pytest_addoption(parser): + parser.addoption( + "--require-integration-db", + action="store_true", + default=False, + help="Fail fast when the integration database is unavailable.", + ) + + +def _is_integration_path(path: Path) -> bool: + path_str = path.as_posix() + + if "/app/tests/auth/" in path_str: + return True + if "/app/tests/flows/" in path_str: + return True + if "/app/tests/validation/" in path_str: + return True + if "/app/tests/contracts/" in path_str and path.name not in CONTRACT_SMOKE_FILES: + return True + if path.name in DB_BACKED_TOP_LEVEL_FILES: + return True + return False + + +def pytest_collection_modifyitems(config, items): + del config + + for item in items: + path = Path(str(item.fspath)) + if _is_integration_path(path) and not item.get_closest_marker("integration"): + item.add_marker(pytest.mark.integration) diff --git a/api/app/tests/contracts/__init__.py b/api/app/tests/contracts/__init__.py new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/api/app/tests/contracts/__init__.py @@ -0,0 +1 @@ + diff --git a/api/app/tests/contracts/conftest.py b/api/app/tests/contracts/conftest.py new file mode 100644 index 000000000..22112db3c --- /dev/null +++ b/api/app/tests/contracts/conftest.py @@ -0,0 +1,17 @@ +import jsonschema +import pytest + + +def validate_schema(response_json, schema): + __tracebackhide__ = True + try: + jsonschema.validate(instance=response_json, schema=schema) + except jsonschema.ValidationError as error: + path = ".".join(str(part) for part in error.absolute_path) + location = path or "" + if error.validator == "required" and error.message.startswith("'"): + missing_property = error.message.split("'", 2)[1] + location = f"{path}.{missing_property}" if path else missing_property + pytest.fail(f"Schema validation failed at {location}: {error.message}") + except jsonschema.SchemaError as error: + pytest.fail(f"Invalid schema: {error.message}") diff --git a/api/app/tests/contracts/schemas.py b/api/app/tests/contracts/schemas.py new file mode 100644 index 000000000..f4f8d8f7c --- /dev/null +++ b/api/app/tests/contracts/schemas.py @@ -0,0 +1,817 @@ +UTC_DATETIME_SCHEMA = { + "type": "string", + "pattern": r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$", +} +ISO_DATETIME_SCHEMA = { + "type": "string", + "pattern": r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:(?:Z|[+-]\d{2}:\d{2}))?$", +} +DATE_KEY_SCHEMA = {"type": "string", "pattern": r"^\d{2}/\d{2}/\d{4}$"} + + +def nullable(schema): + return {"anyOf": [schema, {"type": "null"}]} + + +def object_schema(*, required, properties, additional_properties=False): + return { + "type": "object", + "required": list(required), + "properties": properties, + "additionalProperties": additional_properties, + } + + +TIMEZONE_SCHEMA = object_schema( + required=["timezone_id", "timezone_name"], + properties={ + "timezone_id": {"type": "integer"}, + "timezone_name": {"type": "string"}, + }, +) + +COUNTER_SCHEMA = object_schema( + required=["counter_id", "counter_name"], + properties={ + "counter_id": {"type": "integer"}, + "counter_name": {"type": "string"}, + }, +) + +SMARTBOARD_SCHEMA = object_schema( + required=["sb_id", "sb_type"], + properties={ + "sb_id": {"type": "integer"}, + "sb_type": {"type": "string"}, + }, +) + +CHANNEL_SCHEMA = object_schema( + required=["channel_id", "channel_name"], + properties={ + "channel_id": {"type": "integer"}, + "channel_name": {"type": "string"}, + }, +) + +SERVICE_PARENT_SCHEMA = object_schema( + required=["service_name"], + properties={"service_name": {"type": "string"}}, +) + +SERVICE_SCHEMA = object_schema( + required=[ + "service_id", + "service_name", + "parent_id", + "display_dashboard_ind", + "actual_service_ind", + ], + properties={ + "service_id": {"type": "integer"}, + "service_code": nullable({"type": "string"}), + "service_name": {"type": "string"}, + "service_desc": nullable({"type": "string"}), + "parent": nullable(SERVICE_PARENT_SCHEMA), + "parent_id": nullable({"type": "integer"}), + "deleted": nullable(ISO_DATETIME_SCHEMA), + "prefix": nullable({"type": "string"}), + "display_dashboard_ind": {"type": "integer"}, + "actual_service_ind": {"type": "integer"}, + "external_service_name": nullable({"type": "string"}), + "online_link": nullable({"type": "string"}), + "online_availability": nullable({"type": "string"}), + "timeslot_duration": nullable({"type": "integer"}), + "email_paragraph": nullable({"type": "string"}), + "css_colour": nullable({"type": "string"}), + "is_dlkt": nullable({"type": "boolean"}), + }, +) + +CATEGORY_SCHEMA = SERVICE_SCHEMA + +SERVICE_REQUEST_SERVICE_SCHEMA = object_schema( + required=["service_name"], + properties={ + "service_name": {"type": "string"}, + "parent": nullable(SERVICE_PARENT_SCHEMA), + "parent_id": nullable({"type": "integer"}), + "external_service_name": nullable({"type": "string"}), + "online_link": nullable({"type": "string"}), + "online_availability": nullable({"type": "string"}), + "timeslot_duration": nullable({"type": "integer"}), + "email_paragraph": nullable({"type": "string"}), + "css_colour": nullable({"type": "string"}), + "is_dlkt": nullable({"type": "boolean"}), + }, +) + +ROLE_SCHEMA = object_schema( + required=["role_id", "role_code"], + properties={ + "role_id": {"type": "integer"}, + "role_code": {"type": "string"}, + "role_desc": nullable({"type": "string"}), + }, +) + +CSR_STATE_SCHEMA = object_schema( + required=["csr_state_id", "csr_state_name"], + properties={ + "csr_state_id": {"type": "integer"}, + "csr_state_name": {"type": "string"}, + "csr_state_desc": nullable({"type": "string"}), + }, +) + +OFFICE_SUMMARY_SCHEMA = object_schema( + required=["office_id", "office_name", "office_number", "timezone"], + properties={ + "office_id": {"type": "integer"}, + "office_name": {"type": "string"}, + "office_number": {"type": "integer"}, + "appointments_enabled_ind": nullable({"type": "integer"}), + "exams_enabled_ind": nullable({"type": "integer"}), + "timezone": TIMEZONE_SCHEMA, + }, +) + +OFFICE_APPOINTMENT_SCHEMA = object_schema( + required=["office_id", "office_name", "office_number", "timezone"], + properties={ + "office_id": {"type": "integer"}, + "office_name": {"type": "string"}, + "office_number": {"type": "integer"}, + "sb_id": nullable({"type": "integer"}), + "deleted": nullable(ISO_DATETIME_SCHEMA), + "exams_enabled_ind": nullable({"type": "integer"}), + "appointments_enabled_ind": nullable({"type": "integer"}), + "max_person_appointment_per_day": nullable({"type": "integer"}), + "telephone": nullable({"type": "string"}), + "appointments_days_limit": nullable({"type": "integer"}), + "appointment_duration": nullable({"type": "integer"}), + "timezone": TIMEZONE_SCHEMA, + "latitude": nullable({"type": "number"}), + "longitude": nullable({"type": "number"}), + "office_appointment_message": nullable({"type": "string"}), + "civic_address": nullable({"type": "string"}), + "online_status": nullable({"type": "string"}), + "optout_status": nullable({"type": "integer"}), + "external_map_link": nullable({"type": "string"}), + "check_in_notification": nullable({"type": "integer"}), + "check_in_reminder_msg": nullable({"type": "string"}), + "automatic_reminder_at": nullable({"type": "integer"}), + "currently_waiting": nullable({"type": "integer"}), + "digital_signage_message": nullable({"type": "integer"}), + "digital_signage_message_1": nullable({"type": "string"}), + "digital_signage_message_2": nullable({"type": "string"}), + "digital_signage_message_3": nullable({"type": "string"}), + "show_currently_waiting_bottom": nullable({"type": "integer"}), + }, +) + +ROOM_SCHEMA = object_schema( + required=["room_id", "room_name", "capacity", "color", "office"], + properties={ + "room_id": {"type": "integer"}, + "room_name": {"type": "string"}, + "capacity": {"type": "integer"}, + "color": nullable({"type": "string"}), + "deleted": nullable({"type": "string"}), + "office": OFFICE_SUMMARY_SCHEMA, + }, +) + +BOOKING_ROOM_SCHEMA = object_schema( + required=["room_id", "room_name", "capacity", "color"], + properties={ + "room_id": {"type": "integer"}, + "room_name": {"type": "string"}, + "capacity": {"type": "integer"}, + "color": nullable({"type": "string"}), + "deleted": nullable({"type": "string"}), + }, +) + +INVIGILATOR_SCHEMA = object_schema( + required=[ + "invigilator_id", + "invigilator_name", + "shadow_count", + "shadow_flag", + "office_id", + ], + properties={ + "invigilator_id": {"type": "integer"}, + "invigilator_name": {"type": "string"}, + "shadow_count": {"type": "integer"}, + "shadow_flag": {"type": "string"}, + "office_id": {"type": "integer"}, + "contact_phone": nullable({"type": "string"}), + "contact_email": nullable({"type": "string"}), + "contract_number": nullable({"type": "string"}), + "contract_expiry_date": nullable({"type": "string"}), + "invigilator_notes": nullable({"type": "string"}), + "deleted": nullable({"type": "string"}), + "office": OFFICE_SUMMARY_SCHEMA, + }, +) + +EXAM_TYPE_SCHEMA = object_schema( + required=[ + "exam_type_id", + "exam_type_name", + "number_of_hours", + "number_of_minutes", + "group_exam_ind", + "pesticide_exam_ind", + ], + properties={ + "exam_type_id": {"type": "integer"}, + "exam_type_name": {"type": "string"}, + "exam_color": nullable({"type": "string"}), + "number_of_hours": {"type": "integer"}, + "number_of_minutes": {"type": "integer"}, + "method_type": nullable({"type": "string"}), + "ita_ind": nullable({"type": "integer"}), + "group_exam_ind": {"type": "integer"}, + "pesticide_exam_ind": {"type": "integer"}, + "deleted": nullable({"type": "string"}), + }, +) + +PERIOD_STATE_SCHEMA = object_schema( + required=["ps_name"], + properties={ + "ps_id": nullable({"type": "integer"}), + "ps_name": {"type": "string"}, + "ps_desc": nullable({"type": "string"}), + "ps_number": nullable({"type": "integer"}), + }, +) + +SR_STATE_SCHEMA = object_schema( + required=["sr_code"], + properties={ + "sr_state_id": nullable({"type": "integer"}), + "sr_code": {"type": "string"}, + "sr_state_desc": nullable({"type": "string"}), + }, +) + +CITIZEN_STATE_SCHEMA = object_schema( + required=["cs_state_name"], + properties={ + "cs_id": nullable({"type": "integer"}), + "cs_state_name": {"type": "string"}, + "cs_state_desc": nullable({"type": "string"}), + }, +) + +PERIOD_CSR_SCHEMA = object_schema( + required=["username", "counter_id", "counter"], + properties={ + "username": {"type": "string"}, + "counter_id": {"type": "integer"}, + "counter": {"type": "integer"}, + "qt_xn_csr_ind": nullable({"type": "integer"}), + }, +) + +PERIOD_SCHEMA = object_schema( + required=["period_id", "time_start", "ps", "csr"], + properties={ + "period_id": {"type": "integer"}, + "sr_id": nullable({"type": "integer"}), + "csr_id": nullable({"type": "integer"}), + "reception_csr_ind": nullable({"type": "integer"}), + "ps_id": nullable({"type": "integer"}), + "time_start": nullable(ISO_DATETIME_SCHEMA), + "time_end": nullable(ISO_DATETIME_SCHEMA), + "ps": PERIOD_STATE_SCHEMA, + "csr": PERIOD_CSR_SCHEMA, + }, +) + +SERVICE_NAME_ONLY_SCHEMA = object_schema( + required=["service_name"], + properties={"service_name": {"type": "string"}}, +) + +CHANNEL_NAME_ONLY_SCHEMA = object_schema( + required=["channel_name"], + properties={"channel_name": {"type": "string"}}, +) + +SERVICE_REQUEST_SCHEMA = object_schema( + required=[ + "sr_id", + "citizen_id", + "channel_id", + "service_id", + "quantity", + "sr_number", + "periods", + "sr_state", + "service", + "channel", + ], + properties={ + "sr_id": {"type": "integer"}, + "citizen_id": {"type": "integer"}, + "channel_id": {"type": "integer"}, + "service_id": {"type": "integer"}, + "quantity": {"type": "integer"}, + "sr_number": {"type": "integer"}, + "periods": {"type": "array", "items": PERIOD_SCHEMA}, + "sr_state": SR_STATE_SCHEMA, + "service": SERVICE_REQUEST_SERVICE_SCHEMA, + "channel": CHANNEL_NAME_ONLY_SCHEMA, + }, +) + +CITIZEN_SCHEMA = object_schema( + required=["citizen_id", "citizen_name", "office_id", "service_reqs", "cs"], + properties={ + "citizen_id": {"type": "integer"}, + "citizen_name": nullable({"type": "string"}), + "office_id": {"type": "integer"}, + "ticket_number": nullable({"type": "string"}), + "citizen_comments": nullable({"type": "string"}), + "qt_xn_citizen_ind": nullable({"type": "integer"}), + "counter_id": nullable({"type": "integer"}), + "start_time": nullable(UTC_DATETIME_SCHEMA), + "accurate_time_ind": nullable({"type": "integer"}), + "service_reqs": {"type": "array", "items": SERVICE_REQUEST_SCHEMA}, + "cs": CITIZEN_STATE_SCHEMA, + "priority": nullable({"type": "integer"}), + "user_id": nullable({"type": "integer"}), + "notification_sent_time": nullable(ISO_DATETIME_SCHEMA), + "notification_phone": nullable({"type": "string"}), + "notification_email": nullable({"type": "string"}), + "reminder_flag": nullable({"type": "integer"}), + "walkin_unique_id": nullable({"type": "string"}), + "automatic_reminder_flag": nullable({"type": "integer"}), + "created_at": nullable(ISO_DATETIME_SCHEMA), + }, +) + +SERVICE_REQUEST_CITIZEN_SCHEMA = object_schema( + required=["citizen_id", "citizen_name", "office_id", "cs"], + properties={ + "citizen_id": {"type": "integer"}, + "citizen_name": nullable({"type": "string"}), + "office_id": {"type": "integer"}, + "ticket_number": nullable({"type": "string"}), + "citizen_comments": nullable({"type": "string"}), + "qt_xn_citizen_ind": nullable({"type": "integer"}), + "counter_id": nullable({"type": "integer"}), + "start_time": nullable(UTC_DATETIME_SCHEMA), + "accurate_time_ind": nullable({"type": "integer"}), + "cs": CITIZEN_STATE_SCHEMA, + "priority": nullable({"type": "integer"}), + "user_id": nullable({"type": "integer"}), + "notification_sent_time": nullable(ISO_DATETIME_SCHEMA), + "notification_phone": nullable({"type": "string"}), + "notification_email": nullable({"type": "string"}), + "reminder_flag": nullable({"type": "integer"}), + "walkin_unique_id": nullable({"type": "string"}), + "automatic_reminder_flag": nullable({"type": "integer"}), + "created_at": nullable(ISO_DATETIME_SCHEMA), + }, +) + +SERVICE_REQUEST_SCHEMA["properties"]["citizen"] = SERVICE_REQUEST_CITIZEN_SCHEMA + +OFFICE_SCHEMA = object_schema( + required=[ + "office_id", + "office_name", + "office_number", + "timezone", + "counters", + "timeslots", + ], + properties={ + "office_id": {"type": "integer"}, + "office_name": {"type": "string"}, + "office_number": {"type": "integer"}, + "sb_id": nullable({"type": "integer"}), + "deleted": nullable(ISO_DATETIME_SCHEMA), + "exams_enabled_ind": nullable({"type": "integer"}), + "appointments_enabled_ind": nullable({"type": "integer"}), + "max_person_appointment_per_day": nullable({"type": "integer"}), + "telephone": nullable({"type": "string"}), + "appointments_days_limit": nullable({"type": "integer"}), + "appointment_duration": nullable({"type": "integer"}), + "sb": nullable(SMARTBOARD_SCHEMA), + "timezone": TIMEZONE_SCHEMA, + "counters": {"type": "array", "items": COUNTER_SCHEMA}, + "quick_list": {"type": "array", "items": SERVICE_SCHEMA}, + "back_office_list": {"type": "array", "items": SERVICE_SCHEMA}, + "timeslots": {"type": "array", "items": {"type": "object"}}, + "latitude": nullable({"type": "number"}), + "longitude": nullable({"type": "number"}), + "office_appointment_message": nullable({"type": "string"}), + "civic_address": nullable({"type": "string"}), + "online_status": nullable({"type": "string"}), + "optout_status": nullable({"type": "integer"}), + "external_map_link": nullable({"type": "string"}), + "check_in_notification": nullable({"type": "integer"}), + "check_in_reminder_msg": nullable({"type": "string"}), + "automatic_reminder_at": nullable({"type": "integer"}), + "currently_waiting": nullable({"type": "integer"}), + "digital_signage_message": nullable({"type": "integer"}), + "digital_signage_message_1": nullable({"type": "string"}), + "digital_signage_message_2": nullable({"type": "string"}), + "digital_signage_message_3": nullable({"type": "string"}), + "show_currently_waiting_bottom": nullable({"type": "integer"}), + }, +) + +ROOM_SCHEMA["properties"]["office"] = OFFICE_SCHEMA +INVIGILATOR_SCHEMA["properties"]["office"] = OFFICE_SCHEMA + +APPOINTMENT_SCHEMA = object_schema( + required=[ + "appointment_id", + "office_id", + "start_time", + "end_time", + "citizen_name", + ], + properties={ + "appointment_id": {"type": "integer"}, + "office_id": {"type": "integer"}, + "service_id": nullable({"type": "integer"}), + "citizen_id": nullable({"type": "integer"}), + "start_time": nullable(ISO_DATETIME_SCHEMA), + "end_time": nullable(ISO_DATETIME_SCHEMA), + "checked_in_time": nullable(ISO_DATETIME_SCHEMA), + "comments": nullable({"type": "string"}), + "citizen_name": {"type": "string"}, + "contact_information": nullable({"type": "string"}), + "blackout_flag": nullable({"type": "string"}), + "recurring_uuid": nullable({"type": "string"}), + "online_flag": nullable({"type": "boolean"}), + "is_draft": nullable({"type": "boolean"}), + "stat_flag": nullable({"type": "boolean"}), + "office": nullable(OFFICE_APPOINTMENT_SCHEMA), + "service": nullable(SERVICE_SCHEMA), + }, +) + +BOOKING_SCHEMA = object_schema( + required=["booking_id", "office_id", "start_time", "end_time", "invigilators"], + properties={ + "booking_id": {"type": "integer"}, + "booking_name": nullable({"type": "string"}), + "end_time": nullable(ISO_DATETIME_SCHEMA), + "fees": nullable({"type": "string"}), + "room_id": nullable({"type": "integer"}), + "start_time": nullable(ISO_DATETIME_SCHEMA), + "shadow_invigilator_id": nullable({"type": "integer"}), + "office_id": {"type": "integer"}, + "sbc_staff_invigilated": nullable({"type": "integer"}), + "booking_contact_information": nullable({"type": "string"}), + "blackout_flag": nullable({"type": "string"}), + "blackout_notes": nullable({"type": "string"}), + "recurring_uuid": nullable({"type": "string"}), + "stat_flag": nullable({"type": "boolean"}), + "room": nullable(BOOKING_ROOM_SCHEMA), + "office": nullable(OFFICE_SUMMARY_SCHEMA), + "invigilators": {"type": "array", "items": {"type": "integer"}}, + }, +) + +EXAM_SCHEMA = object_schema( + required=[ + "exam_id", + "office_id", + "exam_type_id", + "exam_name", + "exam_written_ind", + ], + properties={ + "booking_id": nullable({"type": "integer"}), + "deleted_date": nullable({"type": "string"}), + "event_id": nullable({"type": "string"}), + "exam_destroyed_date": nullable({"type": "string"}), + "exam_id": {"type": "integer"}, + "exam_method": nullable({"type": "string"}), + "exam_name": {"type": "string"}, + "exam_received": nullable({"type": "integer"}), + "exam_received_date": nullable(ISO_DATETIME_SCHEMA), + "exam_type_id": {"type": "integer"}, + "examinee_name": nullable({"type": "string"}), + "examinee_phone": nullable({"type": "string"}), + "examinee_email": nullable({"type": "string"}), + "expiry_date": nullable(ISO_DATETIME_SCHEMA), + "notes": nullable({"type": "string"}), + "number_of_students": nullable({"type": "integer"}), + "office_id": {"type": "integer"}, + "invigilator_id": nullable({"type": "integer"}), + "session_number": nullable({"type": "integer"}), + "exam_returned_ind": nullable({"type": "integer"}), + "exam_returned_date": nullable({"type": "string"}), + "exam_returned_tracking_number": nullable({"type": "string"}), + "exam_written_ind": {"type": "integer"}, + "upload_received_ind": nullable({"type": "integer"}), + "offsite_location": nullable({"type": "string"}), + "sbc_managed_ind": nullable({"type": "integer"}), + "receipt": nullable({"type": "string"}), + "receipt_number": nullable({"type": "string"}), + "fees": nullable({"type": "string"}), + "payee_ind": nullable({"type": "integer"}), + "receipt_sent_ind": nullable({"type": "integer"}), + "payee_name": nullable({"type": "string"}), + "payee_email": nullable({"type": "string"}), + "payee_phone": nullable({"type": "string"}), + "bcmp_job_id": nullable({"type": "string"}), + "is_pesticide": nullable({"type": "integer"}), + "candidates_list": nullable({"type": "object"}), + "booking": nullable(BOOKING_SCHEMA), + "exam_type": nullable(EXAM_TYPE_SCHEMA), + "invigilator": nullable(INVIGILATOR_SCHEMA), + "office": nullable(OFFICE_SUMMARY_SCHEMA), + }, +) + +PUBLIC_USER_SCHEMA = object_schema( + required=[ + "telephone", + "send_email_reminders", + "email", + "display_name", + "last_name", + "username", + "user_id", + "send_sms_reminders", + ], + properties={ + "telephone": nullable({"type": "string"}), + "send_email_reminders": nullable({"type": "boolean"}), + "email": nullable({"type": "string"}), + "display_name": nullable({"type": "string"}), + "last_name": nullable({"type": "string"}), + "username": {"type": "string"}, + "user_id": {"type": "integer"}, + "send_sms_reminders": nullable({"type": "boolean"}), + }, +) + +SLOT_SCHEMA = object_schema( + required=["start_time", "end_time", "no_of_slots"], + properties={ + "start_time": {"type": "string", "pattern": r"^\d{2}:\d{2}$"}, + "end_time": {"type": "string", "pattern": r"^\d{2}:\d{2}$"}, + "no_of_slots": {"type": "integer"}, + }, +) + +SLOTS_SCHEMA = { + "type": "object", + "patternProperties": { + DATE_KEY_SCHEMA["pattern"]: {"type": "array", "items": SLOT_SCHEMA} + }, + "additionalProperties": False, +} + +REMINDER_APPOINTMENT_SCHEMA = object_schema( + required=[ + "formatted_date", + "day", + "email", + "display_name", + "location", + "duration", + "telephone", + "service_email_paragraph", + "office_email_paragraph", + "service_name", + "civic_address", + "user_telephone", + ], + properties={ + "formatted_date": {"type": "string"}, + "day": nullable({"type": "string"}), + "email": nullable({"type": "string"}), + "display_name": {"type": "string"}, + "location": {"type": "string"}, + "duration": {"type": "integer"}, + "telephone": nullable({"type": "string"}), + "service_email_paragraph": nullable({"type": "string"}), + "office_email_paragraph": nullable({"type": "string"}), + "service_name": {"type": "string"}, + "civic_address": nullable({"type": "string"}), + "user_telephone": nullable({"type": "string"}), + }, +) + +ERRORS_SCHEMA = {"type": "object"} + +CITIZEN_RESPONSE_SCHEMA = object_schema( + required=["citizen", "errors"], + properties={"citizen": CITIZEN_SCHEMA, "errors": ERRORS_SCHEMA}, +) + +SERVICE_REQUEST_RESPONSE_SCHEMA = object_schema( + required=["service_request", "errors"], + properties={ + "service_request": SERVICE_REQUEST_SCHEMA, + "errors": ERRORS_SCHEMA, + }, +) + +SERVICE_REQUEST_LIST_RESPONSE_SCHEMA = object_schema( + required=["service_requests", "errors"], + properties={ + "service_requests": {"type": "array", "items": SERVICE_REQUEST_SCHEMA}, + "errors": ERRORS_SCHEMA, + }, +) + +APPOINTMENT_RESPONSE_SCHEMA = object_schema( + required=["appointment", "errors"], + properties={"appointment": APPOINTMENT_SCHEMA, "errors": ERRORS_SCHEMA}, +) + +APPOINTMENT_LIST_RESPONSE_SCHEMA = object_schema( + required=["appointments", "errors"], + properties={ + "appointments": {"type": "array", "items": APPOINTMENT_SCHEMA}, + "errors": ERRORS_SCHEMA, + }, +) + +BOOKING_RESPONSE_SCHEMA = object_schema( + required=["booking", "errors"], + properties={"booking": BOOKING_SCHEMA, "errors": ERRORS_SCHEMA}, +) + +BOOKING_LIST_RESPONSE_SCHEMA = object_schema( + required=["bookings", "errors"], + properties={ + "bookings": {"type": "array", "items": BOOKING_SCHEMA}, + "errors": ERRORS_SCHEMA, + }, +) + +EXAM_RESPONSE_SCHEMA = object_schema( + required=["exam", "errors"], + properties={"exam": EXAM_SCHEMA, "errors": ERRORS_SCHEMA}, +) + +EXAM_LIST_RESPONSE_SCHEMA = object_schema( + required=["exams", "errors"], + properties={ + "exams": {"type": "array", "items": EXAM_SCHEMA}, + "errors": ERRORS_SCHEMA, + }, +) + +CHANNEL_LIST_RESPONSE_SCHEMA = object_schema( + required=["channels", "errors"], + properties={ + "channels": {"type": "array", "items": CHANNEL_SCHEMA}, + "errors": ERRORS_SCHEMA, + }, +) + +CATEGORY_LIST_RESPONSE_SCHEMA = object_schema( + required=["categories", "errors"], + properties={ + "categories": {"type": "array", "items": CATEGORY_SCHEMA}, + "errors": ERRORS_SCHEMA, + }, +) + +SERVICE_LIST_RESPONSE_SCHEMA = object_schema( + required=["services", "errors"], + properties={ + "services": {"type": "array", "items": SERVICE_SCHEMA}, + "errors": ERRORS_SCHEMA, + }, +) + +OFFICE_LIST_RESPONSE_SCHEMA = object_schema( + required=["offices", "errors"], + properties={ + "offices": {"type": "array", "items": OFFICE_SCHEMA}, + "errors": ERRORS_SCHEMA, + }, +) + +ROOM_LIST_RESPONSE_SCHEMA = object_schema( + required=["rooms", "errors"], + properties={ + "rooms": {"type": "array", "items": ROOM_SCHEMA}, + "errors": ERRORS_SCHEMA, + }, +) + +INVIGILATOR_LIST_RESPONSE_SCHEMA = object_schema( + required=["invigilators", "errors"], + properties={ + "invigilators": {"type": "array", "items": INVIGILATOR_SCHEMA}, + "errors": ERRORS_SCHEMA, + }, +) + +EXAM_TYPE_LIST_RESPONSE_SCHEMA = object_schema( + required=["exam_types", "errors"], + properties={ + "exam_types": {"type": "array", "items": EXAM_TYPE_SCHEMA}, + "errors": ERRORS_SCHEMA, + }, +) + +CSR_SCHEMA = object_schema( + required=[ + "csr_id", + "username", + "office_id", + "role_id", + "csr_state_id", + "counter_id", + "counter", + "role", + "office", + "finance_designate", + "ita2_designate", + "pesticide_designate", + "qt_xn_csr_ind", + ], + properties={ + "csr_id": {"type": "integer"}, + "username": {"type": "string"}, + "office_id": {"type": "integer"}, + "role_id": {"type": "integer"}, + "receptionist_ind": nullable({"type": "integer"}), + "deleted": nullable(ISO_DATETIME_SCHEMA), + "csr_state_id": {"type": "integer"}, + "counter_id": {"type": "integer"}, + "counter": {"type": "integer"}, + "csr_state": nullable(CSR_STATE_SCHEMA), + "office": OFFICE_SCHEMA, + "role": ROLE_SCHEMA, + "office_manager": nullable({"type": "integer"}), + "pesticide_designate": nullable({"type": "integer"}), + "qt_xn_csr_ind": nullable({"type": "integer"}), + "finance_designate": nullable({"type": "integer"}), + "ita2_designate": nullable({"type": "integer"}), + }, +) + +CSR_LIST_ITEM_SCHEMA = object_schema( + required=[field for field in CSR_SCHEMA["required"] if field != "office"], + properties={ + key: value for key, value in CSR_SCHEMA["properties"].items() if key != "office" + }, +) + +CSR_LIST_RESPONSE_SCHEMA = object_schema( + required=["csrs", "errors"], + properties={ + "csrs": {"type": "array", "items": CSR_LIST_ITEM_SCHEMA}, + "errors": ERRORS_SCHEMA, + }, +) + +CSR_ME_RESPONSE_SCHEMA = object_schema( + required=[ + "csr", + "attention_needed", + "active_citizens", + "back_office_display", + "recurring_feature_flag", + "errors", + ], + properties={ + "csr": CSR_SCHEMA, + "attention_needed": {"type": "boolean"}, + "active_citizens": {"type": "array", "items": CITIZEN_SCHEMA}, + "back_office_display": {}, + "recurring_feature_flag": {}, + "errors": ERRORS_SCHEMA, + }, +) + +SMARTBOARD_SIDE_MENU_RESPONSE_SCHEMA = object_schema( + required=["office"], + properties={"office": OFFICE_SCHEMA}, +) + +PUBLIC_USER_LIST_SCHEMA = {"type": "array", "items": PUBLIC_USER_SCHEMA} + +USER_APPOINTMENTS_RESPONSE_SCHEMA = object_schema( + required=["appointments"], + properties={"appointments": {"type": "array", "items": APPOINTMENT_SCHEMA}}, +) + +REMINDER_RESPONSE_SCHEMA = object_schema( + required=["appointments"], + properties={ + "appointments": {"type": "array", "items": REMINDER_APPOINTMENT_SCHEMA} + }, +) diff --git a/api/app/tests/contracts/test_appointment_contracts.py b/api/app/tests/contracts/test_appointment_contracts.py new file mode 100644 index 000000000..43f70f20b --- /dev/null +++ b/api/app/tests/contracts/test_appointment_contracts.py @@ -0,0 +1,149 @@ +import pytest +from app.tests.api_test_support import ( + assert_json_response, + first_day_with_slots, + future_utc_window, + json_of, + slot_window_to_iso, + unique_name, +) +from app.tests.contracts.conftest import validate_schema +from app.tests.contracts.schemas import ( + APPOINTMENT_LIST_RESPONSE_SCHEMA, + APPOINTMENT_RESPONSE_SCHEMA, + SLOTS_SCHEMA, + USER_APPOINTMENTS_RESPONSE_SCHEMA, +) + +pytestmark = [pytest.mark.contracts, pytest.mark.usefixtures("seeded_database")] + + +def _create_internal_appointment(api_client, seeded_data, *, days_from_now): + start_time, end_time = future_utc_window(days_from_now) + response = api_client.post( + "/appointments/", + json={ + "service_id": seeded_data["service_ids"]["msp"], + "office_id": seeded_data["office_ids"]["test_office"], + "start_time": start_time, + "end_time": end_time, + "comments": "Internal appointment", + "citizen_name": unique_name("internal-appt"), + "contact_information": "internal@example.com", + }, + ) + assert_json_response(response, 201) + return json_of(response)["appointment"] + + +def test_appointment_create_response_matches_the_contract( + internal_ga_client, seeded_data +): + """Assert that appointment creation returns the stable appointment payload contract.""" + start_time, end_time = future_utc_window(2) + response = internal_ga_client.post( + "/appointments/", + json={ + "service_id": seeded_data["service_ids"]["msp"], + "office_id": seeded_data["office_ids"]["test_office"], + "start_time": start_time, + "end_time": end_time, + "comments": "Internal appointment", + "citizen_name": unique_name("contract-appt"), + "contact_information": "internal@example.com", + }, + ) + body = json_of(response) + + assert_json_response(response, 201) + validate_schema(body, APPOINTMENT_RESPONSE_SCHEMA) + assert body["appointment"]["citizen_name"] + + +def test_appointment_detail_response_matches_the_contract( + internal_ga_client, seeded_data +): + """Assert that appointment detail preserves the contract used by appointment edit screens.""" + appointment = _create_internal_appointment( + internal_ga_client, seeded_data, days_from_now=2 + ) + + response = internal_ga_client.get(f"/appointments/{appointment['appointment_id']}/") + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, APPOINTMENT_RESPONSE_SCHEMA) + assert body["appointment"]["appointment_id"] == appointment["appointment_id"] + + +def test_appointment_list_response_matches_the_contract( + internal_ga_client, seeded_data +): + """Assert that appointment list items preserve the contract used by calendar views.""" + appointment = _create_internal_appointment( + internal_ga_client, seeded_data, days_from_now=2 + ) + + response = internal_ga_client.get("/appointments/") + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, APPOINTMENT_LIST_RESPONSE_SCHEMA) + assert any( + item["appointment_id"] == appointment["appointment_id"] + for item in body["appointments"] + ) + + +def test_slots_response_matches_the_date_keyed_contract(public_client, seeded_data): + """Assert that public slot availability preserves the date-keyed slot contract.""" + response = public_client.get( + f"/offices/{seeded_data['office_ids']['limited_office']}/slots/?service_id={seeded_data['service_ids']['limited_office_service']}" + ) + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, SLOTS_SCHEMA) + + day_key, slots = first_day_with_slots(body) + assert day_key + assert slots[0]["no_of_slots"] >= 1 + + +def test_public_user_appointments_response_matches_the_contract( + public_client, seeded_data +): + """Assert that public-user appointment listings reuse the stable appointment contract.""" + create_user_response = public_client.post("/users/") + assert_json_response(create_user_response, 200) + + slots_response = public_client.get( + f"/offices/{seeded_data['office_ids']['limited_office']}/slots/?service_id={seeded_data['service_ids']['limited_office_service']}" + ) + assert_json_response(slots_response, 200) + + day_key, slots = first_day_with_slots(json_of(slots_response)) + start_time, end_time = slot_window_to_iso( + day_key, + slots[0], + seeded_data["office_timezones"]["limited_office"], + ) + create_appointment_response = public_client.post( + "/appointments/", + json={ + "service_id": seeded_data["service_ids"]["limited_office_service"], + "office_id": seeded_data["office_ids"]["limited_office"], + "start_time": start_time, + "end_time": end_time, + "comments": "Public appointment", + "citizen_name": "Codex Public User", + "contact_information": "public@example.com", + }, + ) + assert_json_response(create_appointment_response, 201) + + response = public_client.get("/users/appointments/") + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, USER_APPOINTMENTS_RESPONSE_SCHEMA) diff --git a/api/app/tests/contracts/test_booking_contracts.py b/api/app/tests/contracts/test_booking_contracts.py new file mode 100644 index 000000000..aa4e4d693 --- /dev/null +++ b/api/app/tests/contracts/test_booking_contracts.py @@ -0,0 +1,77 @@ +import pytest +from app.tests.api_test_support import ( + assert_json_response, + future_utc_window, + json_of, + unique_name, +) +from app.tests.contracts.conftest import validate_schema +from app.tests.contracts.schemas import BOOKING_LIST_RESPONSE_SCHEMA, BOOKING_RESPONSE_SCHEMA + +pytestmark = [pytest.mark.contracts, pytest.mark.usefixtures("seeded_database")] + + +def _create_booking(api_client, seeded_data, *, days_from_now): + start_time, end_time = future_utc_window(days_from_now, duration_minutes=120) + response = api_client.post( + "/bookings/", + json={ + "booking_name": unique_name("booking"), + "booking_contact_information": "booking@example.com", + "fees": "false", + "office_id": seeded_data["office_ids"]["test_office"], + "room_id": seeded_data["room_id"], + "start_time": start_time, + "end_time": end_time, + "invigilator_id": [seeded_data["invigilator_ids"][0]], + }, + ) + assert_json_response(response, 201) + return json_of(response)["booking"] + + +def test_booking_create_response_matches_the_contract(internal_ga_client, seeded_data): + """Assert that booking creation returns the stable booking payload contract.""" + start_time, end_time = future_utc_window(2, duration_minutes=120) + response = internal_ga_client.post( + "/bookings/", + json={ + "booking_name": unique_name("booking"), + "booking_contact_information": "booking@example.com", + "fees": "false", + "office_id": seeded_data["office_ids"]["test_office"], + "room_id": seeded_data["room_id"], + "start_time": start_time, + "end_time": end_time, + "invigilator_id": [seeded_data["invigilator_ids"][0]], + }, + ) + body = json_of(response) + + assert_json_response(response, 201) + validate_schema(body, BOOKING_RESPONSE_SCHEMA) + assert body["booking"]["invigilators"] == [seeded_data["invigilator_ids"][0]] + + +def test_booking_detail_response_matches_the_contract(internal_ga_client, seeded_data): + """Assert that booking detail preserves the contract used by booking edit screens.""" + booking = _create_booking(internal_ga_client, seeded_data, days_from_now=2) + + response = internal_ga_client.get(f"/bookings/{booking['booking_id']}/") + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, BOOKING_RESPONSE_SCHEMA) + assert body["booking"]["booking_id"] == booking["booking_id"] + + +def test_booking_list_response_matches_the_contract(internal_ga_client, seeded_data): + """Assert that booking list items preserve the contract used by booking dashboards.""" + booking = _create_booking(internal_ga_client, seeded_data, days_from_now=2) + + response = internal_ga_client.get("/bookings/") + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, BOOKING_LIST_RESPONSE_SCHEMA) + assert any(item["booking_id"] == booking["booking_id"] for item in body["bookings"]) diff --git a/api/app/tests/contracts/test_citizen_contracts.py b/api/app/tests/contracts/test_citizen_contracts.py new file mode 100644 index 000000000..bc2adcbe6 --- /dev/null +++ b/api/app/tests/contracts/test_citizen_contracts.py @@ -0,0 +1,79 @@ +import pytest +from app.tests.api_test_support import assert_json_response, json_of +from app.tests.contracts.conftest import validate_schema +from app.tests.contracts.schemas import ( + CITIZEN_RESPONSE_SCHEMA, + SERVICE_REQUEST_LIST_RESPONSE_SCHEMA, +) + +pytestmark = [pytest.mark.contracts, pytest.mark.usefixtures("seeded_database")] + + +def _create_citizen(api_client, position, *, name): + response = api_client.post( + f"/citizens/{position}/add_citizen/", + json={"citizen_name": name}, + ) + assert_json_response(response, 201) + return json_of(response)["citizen"] + + +def _create_service_request(api_client, citizen_id, seeded_data): + response = api_client.post( + "/service_requests/", + json={ + "service_request": { + "citizen_id": citizen_id, + "service_id": seeded_data["service_ids"]["ptax"], + "channel_id": seeded_data["channel_ids"]["phone"], + "quantity": 2, + } + }, + ) + assert_json_response(response, 201) + return json_of(response)["service_request"] + + +def test_citizen_detail_matches_the_nested_contract(internal_ga_client, seeded_data): + """Assert that citizen detail preserves the nested queue-state contract used by the frontend.""" + citizen = _create_citizen(internal_ga_client, 0, name="Contract Citizen") + _create_service_request(internal_ga_client, citizen["citizen_id"], seeded_data) + + response = internal_ga_client.get(f"/citizens/{citizen['citizen_id']}/") + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, CITIZEN_RESPONSE_SCHEMA) + + citizen_detail = body["citizen"] + service_request = citizen_detail["service_reqs"][0] + period = service_request["periods"][0] + + assert citizen_detail["start_time"].endswith("Z") + assert citizen_detail["cs"]["cs_state_name"] == "Active" + assert service_request["sr_state"]["sr_code"] == "Active" + assert period["ps"]["ps_name"] == "Ticket Creation" + assert isinstance(period["csr"]["counter_id"], int) + + +def test_citizen_service_requests_endpoint_matches_the_nested_contract( + internal_ga_client, seeded_data +): + """Assert that the citizen service-request list returns the expected nested contract.""" + citizen = _create_citizen(internal_ga_client, 0, name="Contract Requests Citizen") + service_request = _create_service_request( + internal_ga_client, citizen["citizen_id"], seeded_data + ) + + response = internal_ga_client.get( + f"/citizens/{citizen['citizen_id']}/service_requests/" + ) + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, SERVICE_REQUEST_LIST_RESPONSE_SCHEMA) + + request_body = body["service_requests"][0] + assert request_body["sr_id"] == service_request["sr_id"] + assert request_body["sr_state"]["sr_code"] == "Active" + assert request_body["periods"][0]["ps"]["ps_name"] == "Ticket Creation" diff --git a/api/app/tests/contracts/test_contract_helpers.py b/api/app/tests/contracts/test_contract_helpers.py new file mode 100644 index 000000000..d3d606c73 --- /dev/null +++ b/api/app/tests/contracts/test_contract_helpers.py @@ -0,0 +1,46 @@ +import pytest +from app.tests.api_test_support import assert_json_response +from app.tests.contracts.conftest import validate_schema + +pytestmark = [pytest.mark.contracts, pytest.mark.smoke] + + +def test_assert_json_response_accepts_application_json(minimal_app): + """Assert that JSON responses with the expected status pass the shared helper.""" + response = minimal_app.response_class( + response='{"message":"ok"}', + status=200, + mimetype="application/json", + ) + + assert_json_response(response, 200) + + +def test_assert_json_response_rejects_non_json_content_type(minimal_app): + """Assert that the shared JSON helper rejects non-JSON content types.""" + response = minimal_app.response_class(response="ok", status=200, mimetype="text/html") + + with pytest.raises(AssertionError): + assert_json_response(response, 200) + + +def test_validate_schema_reports_the_failing_path(): + """Assert that schema validation failures include the nested field path.""" + with pytest.raises(pytest.fail.Exception, match=r"items\.0\.name"): + validate_schema( + {"items": [{}]}, + { + "type": "object", + "required": ["items"], + "properties": { + "items": { + "type": "array", + "items": { + "type": "object", + "required": ["name"], + "properties": {"name": {"type": "string"}}, + }, + } + }, + }, + ) diff --git a/api/app/tests/contracts/test_contract_strictness.py b/api/app/tests/contracts/test_contract_strictness.py new file mode 100644 index 000000000..e1f540b5c --- /dev/null +++ b/api/app/tests/contracts/test_contract_strictness.py @@ -0,0 +1,138 @@ +import pytest +from app.tests.contracts.conftest import validate_schema +from app.tests.contracts.schemas import ( + APPOINTMENT_RESPONSE_SCHEMA, + CITIZEN_RESPONSE_SCHEMA, + PUBLIC_USER_LIST_SCHEMA, +) + +pytestmark = [pytest.mark.contracts, pytest.mark.smoke] + + +def test_appointment_contract_rejects_unexpected_fields(): + """Assert that appointment contracts fail when additive top-level fields sneak into the payload.""" + with pytest.raises(pytest.fail.Exception, match=r"appointment"): + validate_schema( + { + "appointment": { + "appointment_id": 1, + "office_id": 2, + "service_id": 3, + "citizen_id": 4, + "start_time": "2026-03-25T18:00:00+00:00", + "end_time": "2026-03-25T18:30:00+00:00", + "checked_in_time": None, + "comments": "Comment", + "citizen_name": "Pat Citizen", + "contact_information": "pat@example.com", + "blackout_flag": "N", + "recurring_uuid": None, + "online_flag": False, + "is_draft": False, + "stat_flag": False, + "office": None, + "service": None, + "unexpected": "nope", + }, + "errors": {}, + }, + APPOINTMENT_RESPONSE_SCHEMA, + ) + + +def test_public_user_contract_rejects_unexpected_fields(): + """Assert that public-user contracts reject additive profile fields.""" + with pytest.raises(pytest.fail.Exception, match=r"unexpected"): + validate_schema( + [ + { + "telephone": "2505550100", + "send_email_reminders": True, + "email": "public@example.com", + "display_name": "Public User", + "last_name": "User", + "username": "public@bceid", + "user_id": 7, + "send_sms_reminders": False, + "unexpected": True, + } + ], + PUBLIC_USER_LIST_SCHEMA, + ) + + +def test_citizen_contract_rejects_unexpected_nested_service_request_fields(): + """Assert that nested citizen/service-request contracts reject additive fields.""" + with pytest.raises(pytest.fail.Exception, match=r"unexpected"): + validate_schema( + { + "citizen": { + "citizen_id": 1, + "citizen_name": "Citizen", + "office_id": 2, + "ticket_number": None, + "citizen_comments": None, + "qt_xn_citizen_ind": 0, + "counter_id": None, + "start_time": "2026-03-25T18:00:00Z", + "accurate_time_ind": None, + "service_reqs": [ + { + "sr_id": 9, + "citizen_id": 1, + "channel_id": 3, + "service_id": 4, + "quantity": 1, + "sr_number": 12, + "periods": [ + { + "period_id": 8, + "sr_id": 9, + "csr_id": 6, + "reception_csr_ind": 0, + "ps_id": 2, + "time_start": "2026-03-25T18:00:00+00:00", + "time_end": None, + "ps": { + "ps_id": 2, + "ps_name": "Ticket Creation", + "ps_desc": None, + "ps_number": 2, + }, + "csr": { + "username": "tester", + "counter_id": 2, + "counter": 2, + "qt_xn_csr_ind": 0, + }, + } + ], + "sr_state": { + "sr_state_id": 1, + "sr_code": "Active", + "sr_state_desc": None, + }, + "service": {"service_name": "Property Tax"}, + "channel": {"channel_name": "Phone"}, + "unexpected": "x", + } + ], + "cs": { + "cs_id": 1, + "cs_state_name": "Active", + "cs_state_desc": None, + }, + "priority": None, + "user_id": None, + "notification_sent_time": None, + "notification_phone": None, + "notification_email": None, + "reminder_flag": None, + "walkin_unique_id": None, + "automatic_reminder_flag": None, + "created_at": None, + }, + "errors": {}, + }, + CITIZEN_RESPONSE_SCHEMA, + ) diff --git a/api/app/tests/contracts/test_exam_contracts.py b/api/app/tests/contracts/test_exam_contracts.py new file mode 100644 index 000000000..38b6b0ab9 --- /dev/null +++ b/api/app/tests/contracts/test_exam_contracts.py @@ -0,0 +1,118 @@ +from datetime import datetime, timedelta, timezone + +import pytest +from app.tests.api_test_support import ( + assert_json_response, + future_utc_window, + json_of, + unique_name, +) +from app.tests.contracts.conftest import validate_schema +from app.tests.contracts.schemas import EXAM_LIST_RESPONSE_SCHEMA, EXAM_RESPONSE_SCHEMA + +pytestmark = [pytest.mark.contracts, pytest.mark.usefixtures("seeded_database")] + + +def _create_booking(api_client, seeded_data, *, days_from_now): + start_time, end_time = future_utc_window(days_from_now, duration_minutes=120) + response = api_client.post( + "/bookings/", + json={ + "booking_name": unique_name("booking"), + "booking_contact_information": "booking@example.com", + "fees": "false", + "office_id": seeded_data["office_ids"]["test_office"], + "room_id": seeded_data["room_id"], + "start_time": start_time, + "end_time": end_time, + "invigilator_id": [seeded_data["invigilator_ids"][0]], + }, + ) + assert_json_response(response, 201) + return json_of(response)["booking"] + + +def _create_exam(api_client, seeded_data, booking_id, *, event_id): + expiry_date = ( + (datetime.now(timezone.utc) + timedelta(days=30)) + .replace(microsecond=0) + .isoformat() + ) + response = api_client.post( + "/exams/", + json={ + "booking_id": booking_id, + "event_id": event_id, + "exam_method": "paper", + "exam_name": unique_name("exam"), + "exam_type_id": seeded_data["exam_type_id"], + "exam_written_ind": 0, + "examinee_name": "Codex Examinee", + "notes": "Codex exam notes", + "number_of_students": 19, + "office_id": seeded_data["office_ids"]["test_office"], + "offsite_location": "Test Office", + "expiry_date": expiry_date, + }, + ) + assert_json_response(response, 201) + return json_of(response)["exam"] + + +def test_exam_create_response_matches_the_contract(internal_ga_client, seeded_data): + """Assert that exam creation returns the stable exam payload contract.""" + booking = _create_booking(internal_ga_client, seeded_data, days_from_now=5) + response = internal_ga_client.post( + "/exams/", + json={ + "booking_id": booking["booking_id"], + "event_id": f"event-{booking['booking_id']}", + "exam_method": "paper", + "exam_name": unique_name("exam"), + "exam_type_id": seeded_data["exam_type_id"], + "exam_written_ind": 0, + "examinee_name": "Codex Examinee", + "notes": "Codex exam notes", + "number_of_students": 19, + "office_id": seeded_data["office_ids"]["test_office"], + "offsite_location": "Test Office", + "expiry_date": (datetime.now(timezone.utc) + timedelta(days=30)) + .replace(microsecond=0) + .isoformat(), + }, + ) + body = json_of(response) + + assert_json_response(response, 201) + validate_schema(body, EXAM_RESPONSE_SCHEMA) + assert body["exam"]["booking_id"] == booking["booking_id"] + + +def test_exam_detail_response_matches_the_contract(internal_ga_client, seeded_data): + """Assert that exam detail preserves the contract used by exam detail screens.""" + booking = _create_booking(internal_ga_client, seeded_data, days_from_now=5) + exam = _create_exam( + internal_ga_client, seeded_data, booking["booking_id"], event_id="event-detail" + ) + + response = internal_ga_client.get(f"/exams/{exam['exam_id']}/") + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, EXAM_RESPONSE_SCHEMA) + assert body["exam"]["exam_id"] == exam["exam_id"] + + +def test_exam_list_response_matches_the_contract(internal_ga_client, seeded_data): + """Assert that exam list items preserve the contract used by exam dashboards.""" + booking = _create_booking(internal_ga_client, seeded_data, days_from_now=5) + exam = _create_exam( + internal_ga_client, seeded_data, booking["booking_id"], event_id="event-list" + ) + + response = internal_ga_client.get("/exams/") + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, EXAM_LIST_RESPONSE_SCHEMA) + assert any(item["exam_id"] == exam["exam_id"] for item in body["exams"]) diff --git a/api/app/tests/contracts/test_public_api_contracts.py b/api/app/tests/contracts/test_public_api_contracts.py new file mode 100644 index 000000000..e501b7368 --- /dev/null +++ b/api/app/tests/contracts/test_public_api_contracts.py @@ -0,0 +1,28 @@ +import pytest +from app.tests.api_test_support import assert_json_response, json_of +from app.tests.contracts.conftest import validate_schema +from app.tests.contracts.schemas import PUBLIC_USER_LIST_SCHEMA + +pytestmark = [pytest.mark.contracts, pytest.mark.usefixtures("seeded_database")] + + +def test_public_user_create_response_matches_the_contract(public_client): + """Assert that public-user creation returns the stable user profile contract.""" + response = public_client.post("/users/") + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, PUBLIC_USER_LIST_SCHEMA) + assert body[0]["username"].endswith("@bceid") + + +def test_public_user_me_response_matches_the_contract(public_client): + """Assert that the public-user self endpoint preserves the stable user profile contract.""" + create_response = public_client.post("/users/") + assert_json_response(create_response, 200) + + response = public_client.get("/users/me/") + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, PUBLIC_USER_LIST_SCHEMA) diff --git a/api/app/tests/contracts/test_reference_data_contracts.py b/api/app/tests/contracts/test_reference_data_contracts.py new file mode 100644 index 000000000..cd4f1eb62 --- /dev/null +++ b/api/app/tests/contracts/test_reference_data_contracts.py @@ -0,0 +1,353 @@ +from datetime import datetime, timezone + +import pytest +from app.tests.api_test_support import assert_json_response, json_of +from app.tests.contracts.conftest import validate_schema +from app.tests.contracts.schemas import ( + CATEGORY_LIST_RESPONSE_SCHEMA, + CSR_LIST_RESPONSE_SCHEMA, + CHANNEL_LIST_RESPONSE_SCHEMA, + CSR_ME_RESPONSE_SCHEMA, + EXAM_TYPE_LIST_RESPONSE_SCHEMA, + INVIGILATOR_LIST_RESPONSE_SCHEMA, + OFFICE_LIST_RESPONSE_SCHEMA, + ROOM_LIST_RESPONSE_SCHEMA, + SMARTBOARD_SIDE_MENU_RESPONSE_SCHEMA, + SERVICE_LIST_RESPONSE_SCHEMA, +) +from app.tests.auth.auth_support import promote_internal_csr_to_support + +pytestmark = [pytest.mark.contracts, pytest.mark.usefixtures("seeded_database")] + + +def test_channels_contract_includes_named_channels(internal_ga_client): + """Assert that channels expose the stable identifier and display-name fields.""" + response = internal_ga_client.get("/channels/") + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, CHANNEL_LIST_RESPONSE_SCHEMA) + assert any(channel["channel_name"] == "Phone" for channel in body["channels"]) + + +def test_categories_contract_includes_dashboard_flags(internal_ga_client): + """Assert that category responses preserve the frontend flag fields and parent reference.""" + response = internal_ga_client.get("/categories/") + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, CATEGORY_LIST_RESPONSE_SCHEMA) + + property_tax = next( + category + for category in body["categories"] + if category["service_name"] == "Property Tax" + ) + assert property_tax["actual_service_ind"] == 0 + assert "display_dashboard_ind" in property_tax + assert property_tax["parent_id"] is None + + +def test_services_contract_includes_parent_relationships(internal_ga_client): + """Assert that services expose parent relationships needed for service selection UIs.""" + response = internal_ga_client.get("/services/") + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, SERVICE_LIST_RESPONSE_SCHEMA) + + service = next( + service + for service in body["services"] + if service["service_name"] == "Payment - MSP" + ) + assert service["parent_id"] is not None + assert service["parent"]["service_name"] + + rural_ptax = next( + service + for service in body["services"] + if service["service_name"] == "Other - Rural PTAX" + ) + assert rural_ptax["parent"]["service_name"] == "Property Tax" + + +def test_office_scoped_services_filter_deleted_entries_and_preserve_sort_order( + internal_ga_client, seeded_data, app +): + """Assert that office-scoped services stay filtered and stably ordered for service-picking UIs.""" + with app.app_context(): + from app.models.theq import Office, Service + from qsystem import db + + test_office = Office.find_by_id(seeded_data["office_ids"]["test_office"]) + limited_office = Office.find_by_id(seeded_data["office_ids"]["limited_office"]) + + ordered_parent = Service( + service_code="ORDERED-CATEGORY", + service_name="Ordered Category", + service_desc="Ordered category for scoped services tests", + prefix="O", + display_dashboard_ind=0, + actual_service_ind=0, + ) + alpha_child = Service( + service_code="ORDERED-ALPHA", + service_name="Alpha Child", + service_desc="Alpha child service", + prefix="O", + display_dashboard_ind=1, + actual_service_ind=1, + parent=ordered_parent, + ) + zebra_child = Service( + service_code="ORDERED-ZEBRA", + service_name="Zebra Child", + service_desc="Zebra child service", + prefix="O", + display_dashboard_ind=1, + actual_service_ind=1, + parent=ordered_parent, + ) + deleted_child = Service( + service_code="ORDERED-DELETED", + service_name="Deleted Child", + service_desc="Deleted child service", + prefix="O", + display_dashboard_ind=1, + actual_service_ind=1, + parent=ordered_parent, + deleted=datetime.now(timezone.utc), + ) + other_office_only = Service( + service_code="ORDERED-OTHER", + service_name="Other Office Only", + service_desc="Service available only in the limited office", + prefix="O", + display_dashboard_ind=1, + actual_service_ind=1, + parent=ordered_parent, + ) + + db.session.add_all( + [ + ordered_parent, + alpha_child, + zebra_child, + deleted_child, + other_office_only, + ] + ) + db.session.flush() + + test_office.services.extend( + [ordered_parent, alpha_child, zebra_child, deleted_child] + ) + limited_office.services.append(other_office_only) + db.session.add_all([test_office, limited_office]) + db.session.commit() + + response = internal_ga_client.get( + f"/services/?office_id={seeded_data['office_ids']['test_office']}" + ) + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, SERVICE_LIST_RESPONSE_SCHEMA) + + service_names = [service["service_name"] for service in body["services"]] + assert "Deleted Child" not in service_names + assert "Other Office Only" not in service_names + assert service_names.index("Ordered Category") < service_names.index("Alpha Child") + assert service_names.index("Alpha Child") < service_names.index("Zebra Child") + + +def test_offices_contract_includes_timezone_counters_and_timeslots(internal_ga_client): + """Assert that office responses preserve nested timezone, counter, and timeslot data.""" + response = internal_ga_client.get("/offices/") + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, OFFICE_LIST_RESPONSE_SCHEMA) + + office = next( + office for office in body["offices"] if office["office_name"] == "Test Office" + ) + assert office["timezone"]["timezone_name"] + assert office["counters"] + assert "timeslots" in office + + +def test_rooms_contract_includes_room_metadata(internal_ga_client): + """Assert that room responses preserve the room metadata needed by booking screens.""" + response = internal_ga_client.get("/rooms/") + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, ROOM_LIST_RESPONSE_SCHEMA) + assert any(room["room_name"] == "Boardroom 1" for room in body["rooms"]) + + +def test_rooms_contract_can_be_scoped_to_an_office_and_excludes_deleted_rooms( + internal_ga_client, seeded_data, app +): + """Assert that room-list filtering keeps only active rooms for the selected office.""" + with app.app_context(): + from app.models.bookings import Room + from qsystem import db + + db.session.add_all( + [ + Room( + office_id=seeded_data["office_ids"]["test_office"], + room_name="Scoped Contract Room", + capacity=4, + color="#00AA66", + ), + Room( + office_id=seeded_data["office_ids"]["limited_office"], + room_name="Other Office Room", + capacity=4, + color="#AA6600", + ), + Room( + office_id=seeded_data["office_ids"]["test_office"], + room_name="Deleted Contract Room", + capacity=4, + color="#AA0066", + deleted=datetime.now(timezone.utc), + ), + ] + ) + db.session.commit() + + response = internal_ga_client.get( + f"/rooms/?office_id={seeded_data['office_ids']['test_office']}" + ) + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, ROOM_LIST_RESPONSE_SCHEMA) + + room_names = [room["room_name"] for room in body["rooms"]] + assert "Scoped Contract Room" in room_names + assert "Other Office Room" not in room_names + assert "Deleted Contract Room" not in room_names + + +def test_invigilators_contract_includes_shadow_flags(internal_ga_client): + """Assert that invigilator responses preserve shadow-count and contact fields.""" + response = internal_ga_client.get("/invigilators/") + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, INVIGILATOR_LIST_RESPONSE_SCHEMA) + + invigilator = next( + invigilator + for invigilator in body["invigilators"] + if invigilator["invigilator_name"] == "Homer Simpson" + ) + assert invigilator["shadow_count"] == 2 + assert invigilator["shadow_flag"] == "Y" + + +def test_invigilators_offsite_contract_is_scoped_to_the_pesticide_office( + internal_ga_client, seeded_data +): + """Assert that the offsite invigilator payload stays limited to the pesticide office.""" + response = internal_ga_client.get("/invigilators/offsite/") + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, INVIGILATOR_LIST_RESPONSE_SCHEMA) + + names = {invigilator["invigilator_name"] for invigilator in body["invigilators"]} + assert names >= {"Pest 1", "Pest 2"} + assert "Homer Simpson" not in names + assert all( + invigilator["office_id"] == seeded_data["office_ids"]["pesticide_office"] + for invigilator in body["invigilators"] + ) + + +def test_exam_types_contract_includes_duration_and_group_flags(internal_ga_client): + """Assert that exam-type responses preserve duration and grouping metadata.""" + response = internal_ga_client.get("/exam_types/") + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, EXAM_TYPE_LIST_RESPONSE_SCHEMA) + assert any(exam_type["exam_type_name"] for exam_type in body["exam_types"]) + + +def test_csrs_contract_filters_deleted_users(internal_ga_client, app): + """Assert that the CSR list keeps stable fields while excluding deleted users.""" + with app.app_context(): + from app.models.theq import CSR + from qsystem import db + + csr = CSR.query.filter_by(username="cfms-postman-non-operator").first() + csr.deleted = datetime.now(timezone.utc) + db.session.add(csr) + db.session.commit() + + response = internal_ga_client.get("/csrs/") + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, CSR_LIST_RESPONSE_SCHEMA) + + usernames = {csr["username"] for csr in body["csrs"]} + assert "cfms-postman-operator" in usernames + assert "cfms-postman-non-operator" not in usernames + + +def test_csrs_contract_allows_support_but_rejects_other_internal_roles( + internal_ga_client, internal_nonqtxn_client, app +): + """Assert that only GA and SUPPORT users can reach the office CSR list.""" + forbidden_response = internal_nonqtxn_client.get("/csrs/") + assert forbidden_response.status_code == 403 + + promote_internal_csr_to_support(app, username="cfms-postman-operator") + response = internal_ga_client.get("/csrs/") + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, CSR_LIST_RESPONSE_SCHEMA) + assert any(csr["role"]["role_code"] == "SUPPORT" for csr in body["csrs"]) + + +def test_csr_me_contract_includes_role_office_and_designate_flags(internal_ga_client): + """Assert that the csr-self payload preserves nested office and designate flag fields.""" + response = internal_ga_client.get("/csrs/me/") + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, CSR_ME_RESPONSE_SCHEMA) + + csr = body["csr"] + assert csr["role"]["role_code"] == "GA" + assert csr["office"]["office_name"] == "Test Office" + assert "finance_designate" in csr + assert "ita2_designate" in csr + assert "pesticide_designate" in csr + + +def test_smartboard_side_menu_contract_returns_the_frontend_office_payload( + bare_client, seeded_data +): + """Assert that the smartboard side menu keeps returning the nested office payload the UI consumes.""" + response = bare_client.get( + f"/smardboard/side-menu/{seeded_data['office_numbers']['test_office']}" + ) + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, SMARTBOARD_SIDE_MENU_RESPONSE_SCHEMA) + + office = body["office"] + assert office["office_number"] == seeded_data["office_numbers"]["test_office"] + assert office["timezone"]["timezone_name"] == seeded_data["office_timezones"]["test_office"] + assert "currently_waiting" in office diff --git a/api/app/tests/contracts/test_reminder_contracts.py b/api/app/tests/contracts/test_reminder_contracts.py new file mode 100644 index 000000000..f999fd2d8 --- /dev/null +++ b/api/app/tests/contracts/test_reminder_contracts.py @@ -0,0 +1,64 @@ +import pytest +from app.tests.api_test_support import assert_json_response, json_of +from app.tests.auth.auth_support import create_public_appointment +from app.tests.contracts.conftest import validate_schema +from app.tests.contracts.schemas import REMINDER_RESPONSE_SCHEMA +from app.tests.helpers.appointments import ( + align_current_pacific_time_for_appointment, + configure_public_user_reminders, + create_internal_reminder_appointment, +) + +pytestmark = [pytest.mark.contracts, pytest.mark.usefixtures("seeded_database")] + + +def test_email_reminder_response_matches_the_contract( + internal_ga_client, monkeypatch, reminder_job_client, seeded_data +): + """Assert that email reminders return the stable payload contract for anonymous appointments.""" + appointment = create_internal_reminder_appointment( + internal_ga_client, + seeded_data, + contact_information="anonymous@example.com", + ) + align_current_pacific_time_for_appointment( + monkeypatch, + appointment["start_time"], + seeded_data["office_timezones"]["test_office"], + ) + + response = reminder_job_client.get("/appointment/reminders/email/") + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, REMINDER_RESPONSE_SCHEMA) + assert any(item["email"] == "anonymous@example.com" for item in body["appointments"]) + + +def test_sms_reminder_response_matches_the_contract( + monkeypatch, public_client, reminder_job_client, seeded_data +): + """Assert that SMS reminders return the stable payload contract for opted-in public users.""" + user = configure_public_user_reminders( + public_client, + email="public@example.com", + telephone="2505550100", + send_sms_reminders=True, + ) + appointment = create_public_appointment(public_client, seeded_data) + align_current_pacific_time_for_appointment( + monkeypatch, + appointment["start_time"], + seeded_data["office_timezones"]["limited_office"], + ) + + response = reminder_job_client.get("/appointment/reminders/sms/") + body = json_of(response) + + assert_json_response(response, 200) + validate_schema(body, REMINDER_RESPONSE_SCHEMA) + assert any( + item["display_name"] == user["display_name"] + and item["user_telephone"] == "2505550100" + for item in body["appointments"] + ) diff --git a/api/app/tests/fixtures/__init__.py b/api/app/tests/fixtures/__init__.py new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/api/app/tests/fixtures/__init__.py @@ -0,0 +1 @@ + diff --git a/api/app/tests/fixtures/auth.py b/api/app/tests/fixtures/auth.py new file mode 100644 index 000000000..89ed446dd --- /dev/null +++ b/api/app/tests/fixtures/auth.py @@ -0,0 +1,50 @@ +import pytest +from app.tests.api_test_support import ApiClient + + +@pytest.fixture() +def api_client_factory(app): + def factory(identity_name=None, token="theq-test-token"): + return ApiClient(app.test_client(), identity_name, token) + + return factory + + +@pytest.fixture() +def internal_ga_client(api_client_factory): + return api_client_factory("internal_ga") + + +@pytest.fixture() +def internal_nonqtxn_client(api_client_factory): + return api_client_factory("internal_nonqtxn") + + +@pytest.fixture() +def public_client(api_client_factory): + return api_client_factory("public_user") + + +@pytest.fixture() +def public_client_alt(api_client_factory): + return api_client_factory("public_user_alt") + + +@pytest.fixture() +def public_client_malformed(api_client_factory): + return api_client_factory("public_user_malformed") + + +@pytest.fixture() +def public_client_missing_username(api_client_factory): + return api_client_factory("public_user_missing_username") + + +@pytest.fixture() +def reminder_job_client(api_client_factory): + return api_client_factory("reminder_job") + + +@pytest.fixture() +def bare_client(api_client_factory): + return api_client_factory(identity_name=None, token=None) diff --git a/api/app/tests/fixtures/db.py b/api/app/tests/fixtures/db.py new file mode 100644 index 000000000..c68788bf4 --- /dev/null +++ b/api/app/tests/fixtures/db.py @@ -0,0 +1,489 @@ +import copy +import importlib +import os +import sys +import uuid +from contextlib import closing +from functools import wraps + +import pytest + +try: + import psycopg2 + from psycopg2 import sql +except ImportError: # pragma: no cover - handled by session skip + psycopg2 = None + sql = None + + +TEST_IDENTITIES = { + "internal_ga": { + "username": "cfms-postman-operator", + "identity_provider": "idir", + "realm_access": {"roles": ["internal_user"]}, + "email": "ga@example.com", + "display_name": "GA User", + "family_name": "GA", + }, + "internal_nonqtxn": { + "username": "cfms-postman-non-operator", + "identity_provider": "idir", + "realm_access": {"roles": ["internal_user"]}, + "email": "csr@example.com", + "display_name": "CSR User", + "family_name": "CSR", + }, + "public_user": { + "username": "theq-public-user", + "identity_provider": "bceid", + "realm_access": {"roles": ["online_appointment_user"]}, + "email": "public@example.com", + "display_name": "Public User", + "family_name": "Public", + }, + "public_user_alt": { + "username": "theq-public-user-alt", + "identity_provider": "bceid", + "realm_access": {"roles": ["online_appointment_user"]}, + "email": "public-alt@example.com", + "display_name": "Public Alt User", + "family_name": "PublicAlt", + }, + "public_user_malformed": { + "username": " ", + "identity_provider": "bceid", + "realm_access": {"roles": ["online_appointment_user"]}, + "email": "public-malformed@example.com", + "display_name": "Public Malformed User", + "family_name": "PublicMalformed", + }, + "public_user_missing_username": { + "identity_provider": "bceid", + "realm_access": {"roles": ["online_appointment_user"]}, + "email": "public-missing-username@example.com", + "display_name": "Public Missing Username User", + "family_name": "PublicMissingUsername", + }, + "reminder_job": { + "username": "theq-reminder-job", + "identity_provider": "idir", + "realm_access": {"roles": ["reminder_job"]}, + "email": "reminder-job@example.com", + "display_name": "Reminder Job", + "family_name": "Reminder", + }, +} + + +def _db_settings(): + return { + "engine": os.getenv("TEST_DATABASE_ENGINE", "postgresql+psycopg2"), + "host": os.getenv( + "TEST_DATABASE_HOST", os.getenv("DATABASE_HOST", "127.0.0.1") + ), + "port": os.getenv("TEST_DATABASE_PORT", os.getenv("DATABASE_PORT", "5432")), + "user": os.getenv( + "TEST_DATABASE_USERNAME", os.getenv("DATABASE_USERNAME", "postgres") + ), + "password": os.getenv( + "TEST_DATABASE_PASSWORD", os.getenv("DATABASE_PASSWORD", "root") + ), + "admin_db": os.getenv("TEST_DATABASE_ADMIN_DB", "postgres"), + } + + +def _connect(database_name): + settings = _db_settings() + return psycopg2.connect( + dbname=database_name, + user=settings["user"], + password=settings["password"], + host=settings["host"], + port=settings["port"], + ) + + +def _skip_or_exit_for_missing_db(pytestconfig, message): + if pytestconfig.getoption("--require-integration-db"): + pytest.exit(message, returncode=2) + pytest.skip(message) + + +def _patch_jwt_manager(): + from flask import abort, g + from flask_jwt_oidc import JwtManager + + if getattr(JwtManager, "_theq_pytest_patched", False): + return + + def _require_identity(): + token_info = getattr(g, "jwt_oidc_token_info", None) + if token_info is None: + abort(401) + return token_info + + def _wrap_with_auth(func, roles=None): + @wraps(func) + def wrapped(*args, **kwargs): + token_info = _require_identity() + if roles is not None: + token_roles = token_info.get("realm_access", {}).get("roles", []) + if not any(role in token_roles for role in roles): + abort(403) + return func(*args, **kwargs) + + return wrapped + + def requires_auth(self, *decorator_args, **decorator_kwargs): + del self, decorator_kwargs + if decorator_args and callable(decorator_args[0]) and len(decorator_args) == 1: + return _wrap_with_auth(decorator_args[0]) + + def decorator(func): + return _wrap_with_auth(func) + + return decorator + + def has_one_of_roles(self, roles): + del self + + def decorator(func): + return _wrap_with_auth(func, roles=roles) + + return decorator + + def init_app(self, app): + app.extensions["theq_test_jwt"] = self + + JwtManager.has_one_of_roles = has_one_of_roles + JwtManager.requires_auth = requires_auth + JwtManager.requires_auth_cookie = requires_auth + JwtManager.init_app = init_app + JwtManager._theq_pytest_patched = True + + +def _install_identity_loader(app): + if app.config.get("THEQ_TEST_IDENTITY_LOADER"): + return + + from flask import g, request + + app.config["TEST_IDENTITIES"] = TEST_IDENTITIES + app.config["DISABLE_AUTO_REFRESH"] = True + + @app.before_request + def _load_theq_test_identity(): + identity_name = request.headers.get("X-TheQ-Test-Identity") + identity = app.config["TEST_IDENTITIES"].get(identity_name) + if identity: + g.jwt_oidc_token_info = copy.deepcopy(identity) + + app.config["THEQ_TEST_IDENTITY_LOADER"] = True + + +def _stub_integrations(): + import qsystem + from app.utilities.snowplow import SnowPlow + + qsystem.socketio.emit = lambda *args, **kwargs: None + + for method_name in ( + "add_citizen", + "choose_service", + "snowplow_event", + "snowplow_appointment", + ): + setattr(SnowPlow, method_name, staticmethod(lambda *args, **kwargs: None)) + + def email_stub(*args, **kwargs): + return None + + def email_contents_stub(*args, **kwargs): + return ("test@example.com", "Subject", "Body") + + def sms_stub(*args, **kwargs): + return True + + patch_targets = { + "app.resources.theq.citizen.citizen_add_to_queue": { + "send_email": email_stub, + "get_walkin_spot_confirmation_email_contents": email_contents_stub, + "send_walkin_spot_confirmation_sms": sms_stub, + }, + "app.resources.theq.citizen.citizen_detail": { + "send_email": email_stub, + "get_walkin_reminder_email_contents": email_contents_stub, + "send_walkin_reminder_sms": sms_stub, + }, + "app.resources.theq.user.user": { + "send_sms": sms_stub, + }, + "app.resources.bookings.appointment.appointment_post": { + "send_email": email_stub, + "get_confirmation_email_contents": email_contents_stub, + "get_blackout_email_contents": email_contents_stub, + "send_sms": sms_stub, + }, + "app.resources.bookings.appointment.appointment_put": { + "send_email": email_stub, + "get_confirmation_email_contents": email_contents_stub, + "send_sms": sms_stub, + }, + "app.resources.bookings.appointment.appointment_delete": { + "send_email": email_stub, + "get_cancel_email_contents": email_contents_stub, + }, + } + + for module_name, attributes in patch_targets.items(): + module = importlib.import_module(module_name) + for attribute_name, value in attributes.items(): + setattr(module, attribute_name, value) + + +@pytest.fixture(scope="session") +def postgres_database(pytestconfig): + if psycopg2 is None: + _skip_or_exit_for_missing_db( + pytestconfig, "psycopg2 is required for the integration suite" + ) + + database_name = f"qsystem_sqlalchemy_smoke_{uuid.uuid4().hex[:12]}" + settings = _db_settings() + + try: + with closing(_connect(settings["admin_db"])) as connection: + connection.autocommit = True + with connection.cursor() as cursor: + cursor.execute( + sql.SQL("CREATE DATABASE {}").format(sql.Identifier(database_name)) + ) + except Exception as exc: # pragma: no cover - depends on local services + _skip_or_exit_for_missing_db( + pytestconfig, f"unable to create disposable Postgres database: {exc}" + ) + + original_env = { + key: os.environ.get(key) + for key in ( + "FLASK_CONFIGURATION", + "DATABASE_ENGINE", + "DATABASE_HOST", + "DATABASE_PORT", + "DATABASE_USERNAME", + "DATABASE_PASSWORD", + "DATABASE_NAME", + "JWT_OIDC_WELL_KNOWN_CONFIG", + "JWT_OIDC_JWKS_URI", + "JWT_OIDC_ISSUER", + "JWT_OIDC_AUDIENCE", + ) + } + + os.environ.update( + { + "FLASK_CONFIGURATION": "localhost", + "DATABASE_ENGINE": settings["engine"], + "DATABASE_HOST": settings["host"], + "DATABASE_PORT": settings["port"], + "DATABASE_USERNAME": settings["user"], + "DATABASE_PASSWORD": settings["password"], + "DATABASE_NAME": database_name, + "JWT_OIDC_WELL_KNOWN_CONFIG": "", + "JWT_OIDC_JWKS_URI": "https://example.com/jwks.json", + "JWT_OIDC_ISSUER": "https://example.com/", + "JWT_OIDC_AUDIENCE": "queue-api-tests", + } + ) + + try: + yield { + "database_name": database_name, + "database_uri": ( + f"{settings['engine']}://{settings['user']}:{settings['password']}" + f"@{settings['host']}:{settings['port']}/{database_name}" + ), + } + finally: + for module_name in ("manage", "qsystem"): + module = sys.modules.get(module_name) + if module is not None and hasattr(module, "db"): + try: + module.db.session.remove() + if hasattr(module, "application"): + with module.application.app_context(): + module.db.engine.dispose() + except Exception: + pass + + for module_name in list(sys.modules): + if ( + module_name == "app" + or module_name.startswith("app.") + or module_name in ("manage", "qsystem") + ): + sys.modules.pop(module_name, None) + + try: + with closing(_connect(settings["admin_db"])) as connection: + connection.autocommit = True + with connection.cursor() as cursor: + cursor.execute( + sql.SQL( + "SELECT pg_terminate_backend(pid) " + "FROM pg_stat_activity WHERE datname = %s AND pid <> pg_backend_pid()" + ), + (database_name,), + ) + cursor.execute( + sql.SQL("DROP DATABASE IF EXISTS {}").format( + sql.Identifier(database_name) + ) + ) + finally: + for key, value in original_env.items(): + if value is None: + os.environ.pop(key, None) + else: + os.environ[key] = value + + +@pytest.fixture(scope="session") +def app_module(postgres_database): + del postgres_database + _patch_jwt_manager() + module = importlib.import_module("manage") + _install_identity_loader(module.application) + _stub_integrations() + return module + + +@pytest.fixture(scope="session") +def app(app_module): + return app_module.application + + +@pytest.fixture(scope="session") +def db(app_module): + return app_module.db + + +@pytest.fixture(scope="session") +def cli_runner(app): + return app.test_cli_runner() + + +@pytest.fixture(scope="session") +def client(app): + return app.test_client() + + +@pytest.fixture(scope="session") +def migrated_database(cli_runner): + result = cli_runner.invoke(args=["db", "upgrade"]) + assert result.exit_code == 0, result.output + return result + + +@pytest.fixture() +def seeded_database(cli_runner, migrated_database, app): + del migrated_database + + with app.app_context(): + from qsystem import db + + db.session.remove() + + result = cli_runner.invoke(args=["bootstrap"]) + assert result.exit_code == 0, result.output + + with app.app_context(): + from qsystem import cache, db + + db.session.remove() + cache.clear() + + return result + + +@pytest.fixture() +def seeded_data(seeded_database, app): + del seeded_database + + with app.app_context(): + from app.models.bookings import ExamType, Invigilator, Room + from app.models.theq import CSR, Channel, Counter, Office, Service + + office_test = Office.query.filter_by(office_name="Test Office").first() + office_limited = Office.query.filter_by(office_name="100 Mile House").first() + office_victoria = Office.query.filter_by(office_name="Victoria").first() + office_pesticide = Office.query.filter_by( + office_name="Pesticide Offsite" + ).first() + quick_trans = Counter.query.filter_by(counter_name="Quick Trans").first() + counter = Counter.query.filter_by(counter_name="Counter").first() + phone_channel = Channel.query.filter_by(channel_name="Phone").first() + email_channel = Channel.query.filter_by(channel_name="Email/Fax/Mail").first() + msp_service = Service.query.filter_by(service_name="Payment - MSP").first() + ptax_service = Service.query.filter_by(service_name="Other - PTAX").first() + ptax_category = Service.query.filter_by(service_name="Property Tax").first() + dlkt_service = Service.query.filter_by( + service_name="Knowledge Test Set-Up/Result" + ).first() + limited_office_service = Service.query.filter_by( + service_name="Deferment Application" + ).first() + room = Room.query.filter_by(room_name="Boardroom 1").first() + invigilators = ( + Invigilator.query.filter_by(office_id=office_test.office_id) + .order_by(Invigilator.invigilator_id) + .all() + ) + exam_type = ExamType.query.order_by(ExamType.exam_type_id).first() + ga = CSR.query.filter_by(username="cfms-postman-operator").first() + non_qtxn = CSR.query.filter_by(username="cfms-postman-non-operator").first() + + return { + "office_ids": { + "test_office": office_test.office_id, + "limited_office": office_limited.office_id, + "victoria": office_victoria.office_id, + "pesticide_office": office_pesticide.office_id, + }, + "office_numbers": { + "test_office": office_test.office_number, + "limited_office": office_limited.office_number, + "victoria": office_victoria.office_number, + "pesticide_office": office_pesticide.office_number, + }, + "office_timezones": { + "test_office": office_test.timezone.timezone_name, + "limited_office": office_limited.timezone.timezone_name, + "victoria": office_victoria.timezone.timezone_name, + "pesticide_office": office_pesticide.timezone.timezone_name, + }, + "counter_ids": { + "quick_trans": quick_trans.counter_id, + "counter": counter.counter_id, + }, + "channel_ids": { + "phone": phone_channel.channel_id, + "email": email_channel.channel_id, + }, + "service_ids": { + "msp": msp_service.service_id, + "ptax": ptax_service.service_id, + "ptax_category": ptax_category.service_id, + "dlkt": dlkt_service.service_id, + "limited_office_service": limited_office_service.service_id, + }, + "csr_ids": { + "ga": ga.csr_id, + "non_qtxn": non_qtxn.csr_id, + }, + "room_id": room.room_id, + "invigilator_ids": [ + invigilator.invigilator_id for invigilator in invigilators + ], + "exam_type_id": exam_type.exam_type_id, + } diff --git a/api/app/tests/fixtures/smoke.py b/api/app/tests/fixtures/smoke.py new file mode 100644 index 000000000..c1bec85a4 --- /dev/null +++ b/api/app/tests/fixtures/smoke.py @@ -0,0 +1,10 @@ +from flask import Flask +import pytest + + +@pytest.fixture(scope="session") +def minimal_app(): + app = Flask(__name__) + app.config["TESTING"] = True + return app + diff --git a/api/app/tests/flows/__init__.py b/api/app/tests/flows/__init__.py new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/api/app/tests/flows/__init__.py @@ -0,0 +1 @@ + diff --git a/api/app/tests/flows/test_appointment_flows.py b/api/app/tests/flows/test_appointment_flows.py new file mode 100644 index 000000000..eb386b3d8 --- /dev/null +++ b/api/app/tests/flows/test_appointment_flows.py @@ -0,0 +1,328 @@ +from __future__ import annotations + +from uuid import uuid4 + +import pytest +from app.tests.api_test_support import ( + assert_json_response, + create_public_user, + future_utc_window, + first_day_with_slots, + json_of, + public_slot_payload, + slot_window_to_iso, + unique_name, +) +from app.tests.api_test_support import ( + create_internal_appointment as _create_internal_appointment, +) + +pytestmark = [pytest.mark.flows, pytest.mark.usefixtures("seeded_database")] + + +def _create_blackout_appointment(api_client, seeded_data, *, days_from_now: int) -> dict: + start_time, end_time = future_utc_window(days_from_now) + response = api_client.post( + "/appointments/", + json={ + "office_id": seeded_data["office_ids"]["test_office"], + "start_time": start_time, + "end_time": end_time, + "comments": "Blackout coverage", + "citizen_name": unique_name("blackout-appt"), + "contact_information": "blackout@example.com", + "blackout_flag": "Y", + }, + ) + assert_json_response(response, 201) + return json_of(response)["appointment"] + + +def test_internal_appointment_can_be_listed_and_retrieved( + internal_ga_client, seeded_data +): + """Assert that created internal appointments appear in list and detail responses.""" + appointment = _create_internal_appointment( + internal_ga_client, seeded_data, days_from_now=2 + ) + + list_response = internal_ga_client.get("/appointments/") + detail_response = internal_ga_client.get( + f"/appointments/{appointment['appointment_id']}/" + ) + + assert_json_response(list_response, 200) + assert_json_response(detail_response, 200) + assert any( + item["appointment_id"] == appointment["appointment_id"] + for item in json_of(list_response)["appointments"] + ) + assert ( + json_of(detail_response)["appointment"]["appointment_id"] + == appointment["appointment_id"] + ) + + +def test_internal_appointment_can_be_updated(internal_ga_client, seeded_data): + """Assert that internal appointments preserve comment updates.""" + appointment = _create_internal_appointment( + internal_ga_client, seeded_data, days_from_now=2 + ) + + response = internal_ga_client.put( + f"/appointments/{appointment['appointment_id']}/", + json={"comments": "Internal appointment updated"}, + ) + + assert_json_response(response, 200) + assert ( + json_of(response)["appointment"]["comments"] == "Internal appointment updated" + ) + + +def test_internal_appointment_can_be_deleted(internal_ga_client, seeded_data): + """Assert that internal appointments can be deleted from the API.""" + appointment = _create_internal_appointment( + internal_ga_client, seeded_data, days_from_now=2 + ) + + response = internal_ga_client.delete( + f"/appointments/{appointment['appointment_id']}/" + ) + + assert response.status_code == 204, response.get_data(as_text=True) + + +def test_blackout_appointment_update_skips_notifications( + monkeypatch, internal_ga_client, seeded_data +): + """Assert that service-less blackout updates do not invoke notification builders.""" + appointment = _create_blackout_appointment( + internal_ga_client, seeded_data, days_from_now=2 + ) + + def _unexpected(*args, **kwargs): + raise AssertionError("blackout appointments should not trigger notifications") + + monkeypatch.setattr( + "app.resources.bookings.appointment.appointment_put.get_confirmation_email_contents", + _unexpected, + ) + monkeypatch.setattr( + "app.resources.bookings.appointment.appointment_put.send_sms", + _unexpected, + ) + + response = internal_ga_client.put( + f"/appointments/{appointment['appointment_id']}/", + json={ + "comments": "Blackout appointment updated", + "citizen_name": "Updated blackout", + "contact_information": "updated-blackout@example.com", + }, + ) + + assert_json_response(response, 200) + assert json_of(response)["appointment"]["comments"] == "Blackout appointment updated" + + +def test_blackout_appointment_delete_skips_notifications( + monkeypatch, internal_ga_client, seeded_data +): + """Assert that service-less blackout deletes do not invoke cancellation email builders.""" + appointment = _create_blackout_appointment( + internal_ga_client, seeded_data, days_from_now=2 + ) + + def _unexpected(*args, **kwargs): + raise AssertionError("blackout appointments should not trigger notifications") + + monkeypatch.setattr( + "app.resources.bookings.appointment.appointment_delete.get_cancel_email_contents", + _unexpected, + ) + + response = internal_ga_client.delete( + f"/appointments/{appointment['appointment_id']}/" + ) + + assert response.status_code == 204, response.get_data(as_text=True) + + +def test_recurring_appointment_update_applies_to_each_occurrence( + internal_ga_client, seeded_data +): + """Assert that recurring appointment updates apply across all matching occurrences.""" + recurring_uuid = str(uuid4()) + first_recurring = _create_internal_appointment( + internal_ga_client, + seeded_data, + days_from_now=3, + recurring_uuid=recurring_uuid, + ) + second_recurring = _create_internal_appointment( + internal_ga_client, + seeded_data, + days_from_now=4, + recurring_uuid=recurring_uuid, + ) + + recurring_update = internal_ga_client.put( + f"/appointments/recurring/{recurring_uuid}", + json={"comments": "Recurring appointment updated"}, + ) + final_list = internal_ga_client.get("/appointments/") + appointments = { + item["appointment_id"]: item for item in json_of(final_list)["appointments"] + } + + assert_json_response(recurring_update, 200) + assert_json_response(final_list, 200) + assert ( + appointments[first_recurring["appointment_id"]]["comments"] + == "Recurring appointment updated" + ) + assert ( + appointments[second_recurring["appointment_id"]]["comments"] + == "Recurring appointment updated" + ) + + +def test_recurring_appointment_delete_removes_each_occurrence( + internal_ga_client, seeded_data +): + """Assert that recurring appointment deletion removes every matching occurrence.""" + recurring_uuid = str(uuid4()) + first_recurring = _create_internal_appointment( + internal_ga_client, + seeded_data, + days_from_now=3, + recurring_uuid=recurring_uuid, + ) + second_recurring = _create_internal_appointment( + internal_ga_client, + seeded_data, + days_from_now=4, + recurring_uuid=recurring_uuid, + ) + + recurring_delete = internal_ga_client.delete( + f"/appointments/recurring/{recurring_uuid}" + ) + final_list = internal_ga_client.get("/appointments/") + remaining_ids = { + item["appointment_id"] for item in json_of(final_list)["appointments"] + } + + assert recurring_delete.status_code == 204, recurring_delete.get_data(as_text=True) + assert_json_response(final_list, 200) + assert first_recurring["appointment_id"] not in remaining_ids + assert second_recurring["appointment_id"] not in remaining_ids + + +def test_public_user_profile_can_be_created_and_updated(public_client): + """Assert that public-user profiles can be created and updated before booking.""" + created_user = create_public_user(public_client) + + update_user_response = public_client.put( + f"/users/{created_user['user_id']}/", + json={ + "email": "updated-public@example.com", + "telephone": "2505550100", + "send_email_reminders": True, + "send_sms_reminders": True, + }, + ) + get_me_response = public_client.get("/users/me/") + + assert_json_response(update_user_response, 200) + assert_json_response(get_me_response, 200) + assert json_of(update_user_response)[0]["email"] == "updated-public@example.com" + + +def test_public_user_appointment_appears_in_their_appointment_list( + public_client, seeded_data +): + """Assert that public bookings appear in the authenticated user's appointment list.""" + create_public_user(public_client) + + appointment_payload, _day_key, _slots = public_slot_payload( + public_client, seeded_data, minimum_slots=2 + ) + create_appointment_response = public_client.post( + "/appointments/", json=appointment_payload + ) + assert_json_response(create_appointment_response, 201) + appointment = json_of(create_appointment_response)["appointment"] + + list_response = public_client.get("/users/appointments/") + + assert_json_response(list_response, 200) + assert any( + item["appointment_id"] == appointment["appointment_id"] + for item in json_of(list_response)["appointments"] + ) + + +def test_public_user_appointment_limit_rejects_a_second_booking( + public_client, seeded_data +): + """Assert that the public appointment limit rejects a second booking on the same day.""" + create_public_user(public_client) + + appointment_payload, day_key, slots = public_slot_payload( + public_client, seeded_data, minimum_slots=2 + ) + first_response = public_client.post("/appointments/", json=appointment_payload) + assert_json_response(first_response, 201) + + second_start_time, second_end_time = slot_window_to_iso( + day_key, + slots[1], + seeded_data["office_timezones"]["limited_office"], + ) + max_limit_response = public_client.post( + "/appointments/", + json={ + **appointment_payload, + "start_time": second_start_time, + "end_time": second_end_time, + }, + ) + + assert_json_response(max_limit_response, 400) + assert json_of(max_limit_response)["code"] == "MAX_NO_OF_APPOINTMENTS_REACHED" + + +def test_public_user_can_cancel_their_appointment(public_client, seeded_data): + """Assert that public users can cancel their own appointment bookings.""" + create_public_user(public_client) + + appointment_payload, _day_key, _slots = public_slot_payload( + public_client, seeded_data, minimum_slots=1 + ) + create_appointment_response = public_client.post( + "/appointments/", json=appointment_payload + ) + assert_json_response(create_appointment_response, 201) + appointment = json_of(create_appointment_response)["appointment"] + + delete_response = public_client.delete( + f"/appointments/{appointment['appointment_id']}/" + ) + + assert delete_response.status_code == 204, delete_response.get_data(as_text=True) + + +def test_appointment_slots_endpoint_returns_available_capacity( + public_client, seeded_data +): + """Assert that the slots endpoint exposes at least one available slot with capacity metadata.""" + response = public_client.get( + f"/offices/{seeded_data['office_ids']['limited_office']}/slots/?service_id={seeded_data['service_ids']['limited_office_service']}" + ) + + assert_json_response(response, 200) + day_key, slots = first_day_with_slots(json_of(response)) + assert day_key + assert slots[0]["no_of_slots"] >= 1 diff --git a/api/app/tests/flows/test_booking_exam_flows.py b/api/app/tests/flows/test_booking_exam_flows.py new file mode 100644 index 000000000..4215a59e6 --- /dev/null +++ b/api/app/tests/flows/test_booking_exam_flows.py @@ -0,0 +1,356 @@ +from __future__ import annotations + +from datetime import datetime +from uuid import uuid4 +from zoneinfo import ZoneInfo + +import pytest +from app.tests.api_test_support import ( + assert_json_response, + json_of, +) +from app.tests.api_test_support import ( + create_booking as _create_booking, +) +from app.tests.api_test_support import ( + create_exam as _create_exam, +) + +pytestmark = [pytest.mark.flows, pytest.mark.usefixtures("seeded_database")] + + +def test_booking_can_be_listed_and_retrieved(internal_ga_client, seeded_data): + """Assert that created bookings appear in list and detail responses.""" + booking = _create_booking(internal_ga_client, seeded_data, days_from_now=2) + + list_response = internal_ga_client.get("/bookings/") + detail_response = internal_ga_client.get(f"/bookings/{booking['booking_id']}/") + + assert_json_response(list_response, 200) + assert_json_response(detail_response, 200) + assert any( + item["booking_id"] == booking["booking_id"] + for item in json_of(list_response)["bookings"] + ) + assert json_of(detail_response)["booking"]["booking_id"] == booking["booking_id"] + + +def test_booking_can_be_updated(internal_ga_client, seeded_data): + """Assert that booking updates preserve editable booking fields.""" + booking = _create_booking(internal_ga_client, seeded_data, days_from_now=2) + + response = internal_ga_client.put( + f"/bookings/{booking['booking_id']}/", + json={ + "booking_name": "Updated single booking", + "booking_contact_information": "updated-booking@example.com", + "invigilator_id": [seeded_data["invigilator_ids"][1]], + }, + ) + + assert_json_response(response, 200) + assert json_of(response)["booking"]["booking_name"] == "Updated single booking" + + +def test_booking_can_be_deleted(internal_ga_client, seeded_data): + """Assert that bookings can be deleted from the API.""" + booking = _create_booking(internal_ga_client, seeded_data, days_from_now=2) + + response = internal_ga_client.delete(f"/bookings/{booking['booking_id']}/") + + assert response.status_code == 204, response.get_data(as_text=True) + + +def test_recurring_booking_update_applies_to_each_occurrence( + internal_ga_client, seeded_data +): + """Assert that recurring booking updates apply to every matching occurrence.""" + recurring_uuid = str(uuid4()) + first_recurring = _create_booking( + internal_ga_client, + seeded_data, + days_from_now=3, + recurring_uuid=recurring_uuid, + ) + second_recurring = _create_booking( + internal_ga_client, + seeded_data, + days_from_now=4, + recurring_uuid=recurring_uuid, + ) + + recurring_update = internal_ga_client.put( + f"/bookings/recurring/{recurring_uuid}", + json={"booking_name": "Recurring booking updated"}, + ) + final_list = internal_ga_client.get("/bookings/") + bookings = {item["booking_id"]: item for item in json_of(final_list)["bookings"]} + + assert_json_response(recurring_update, 200) + assert_json_response(final_list, 200) + assert ( + bookings[first_recurring["booking_id"]]["booking_name"] + == "Recurring booking updated" + ) + assert ( + bookings[second_recurring["booking_id"]]["booking_name"] + == "Recurring booking updated" + ) + + +def test_recurring_booking_delete_removes_each_occurrence( + internal_ga_client, seeded_data +): + """Assert that recurring booking deletion removes every matching occurrence.""" + recurring_uuid = str(uuid4()) + first_recurring = _create_booking( + internal_ga_client, + seeded_data, + days_from_now=3, + recurring_uuid=recurring_uuid, + ) + second_recurring = _create_booking( + internal_ga_client, + seeded_data, + days_from_now=4, + recurring_uuid=recurring_uuid, + ) + + recurring_delete = internal_ga_client.delete( + f"/bookings/recurring/{recurring_uuid}" + ) + final_list = internal_ga_client.get("/bookings/") + final_booking_ids = {item["booking_id"] for item in json_of(final_list)["bookings"]} + + assert recurring_delete.status_code == 204, recurring_delete.get_data(as_text=True) + assert_json_response(final_list, 200) + assert first_recurring["booking_id"] not in final_booking_ids + assert second_recurring["booking_id"] not in final_booking_ids + + +def test_exam_can_be_listed_and_retrieved(internal_ga_client, seeded_data): + """Assert that created exams appear in list and detail responses.""" + booking = _create_booking(internal_ga_client, seeded_data, days_from_now=5) + exam = _create_exam( + internal_ga_client, seeded_data, booking["booking_id"], event_id="event-detail" + ) + + detail_response = internal_ga_client.get(f"/exams/{exam['exam_id']}/") + list_response = internal_ga_client.get("/exams/") + + assert_json_response(detail_response, 200) + assert_json_response(list_response, 200) + assert json_of(detail_response)["exam"]["exam_id"] == exam["exam_id"] + assert any( + item["exam_id"] == exam["exam_id"] for item in json_of(list_response)["exams"] + ) + + +def test_exam_create_accepts_iso_offset_exam_received_date( + internal_ga_client, seeded_data +): + """Assert exam creation accepts frontend ISO offset timestamps.""" + response = internal_ga_client.post( + "/exams/", + json={ + "exam_method": "paper", + "exam_received_date": "2026-04-17T07:00:00+00:00", + "expiry_date": "2026-05-22T07:00:00+00:00", + "exam_type_id": seeded_data["exam_type_id"], + "event_id": "test1234887", + "exam_name": "test exam", + "examinee_name": "test candidate", + "notes": "test notes", + "office_id": seeded_data["office_ids"]["test_office"], + "payee_ind": 0, + "receipt_sent_ind": 0, + "sbc_managed_ind": 0, + "exam_returned_ind": 0, + "exam_written_ind": 0, + "number_of_students": 1, + }, + ) + body = json_of(response) + + assert_json_response(response, 201) + assert body["exam"]["exam_received_date"] == "2026-04-17T07:00:00+00:00" + + +def test_exam_can_be_updated(internal_ga_client, seeded_data): + """Assert that exam updates preserve editable exam fields.""" + booking = _create_booking(internal_ga_client, seeded_data, days_from_now=5) + exam = _create_exam( + internal_ga_client, seeded_data, booking["booking_id"], event_id="event-update" + ) + + response = internal_ga_client.put( + f"/exams/{exam['exam_id']}/", + json={"exam_name": "Updated exam name", "notes": "Updated notes"}, + ) + + assert_json_response(response, 201) + assert json_of(response)["exam"]["exam_name"] == "Updated exam name" + + +def test_exam_update_accepts_iso_offset_exam_received_date( + internal_ga_client, seeded_data +): + """Assert exam updates accept frontend ISO offset timestamps.""" + booking = _create_booking(internal_ga_client, seeded_data, days_from_now=5) + exam = _create_exam( + internal_ga_client, + seeded_data, + booking["booking_id"], + event_id="event-upd-recv-date", + ) + + response = internal_ga_client.put( + f"/exams/{exam['exam_id']}/", + json={"exam_received_date": "2026-04-17T07:00:00+00:00"}, + ) + + assert_json_response(response, 201) + assert json_of(response)["exam"]["exam_received_date"] == ( + "2026-04-17T07:00:00+00:00" + ) + + +def test_exam_create_invalid_datetime_returns_validation_response( + internal_ga_client, seeded_data +): + """Assert schema load errors return a controlled JSON 422 response.""" + response = internal_ga_client.post( + "/exams/", + json={ + "exam_method": "paper", + "exam_received_date": "not-a-date", + "expiry_date": "2026-05-22T07:00:00+00:00", + "exam_type_id": seeded_data["exam_type_id"], + "event_id": "event-invalid-date", + "exam_name": "Invalid date exam", + "examinee_name": "test candidate", + "notes": "test notes", + "office_id": seeded_data["office_ids"]["test_office"], + "payee_ind": 0, + "receipt_sent_ind": 0, + "sbc_managed_ind": 0, + "exam_returned_ind": 0, + "exam_written_ind": 0, + "number_of_students": 1, + }, + ) + + assert_json_response(response, 422) + assert json_of(response) == { + "message": {"exam_received_date": ["Not a valid datetime."]} + } + + +def test_exam_event_lookup_returns_the_matching_exam(internal_ga_client, seeded_data): + """Assert that exam event lookups continue to find the matching exam.""" + booking = _create_booking(internal_ga_client, seeded_data, days_from_now=5) + event_id = str(9000 + booking["booking_id"]) + _create_exam( + internal_ga_client, seeded_data, booking["booking_id"], event_id=event_id + ) + + response = internal_ga_client.get(f"/exams/event_id/{event_id}/") + + assert_json_response(response, 200) + assert json_of(response)["message"] is True + + +def test_exam_export_contains_the_updated_exam(internal_ga_client, seeded_data): + """Assert that exam CSV exports include updated exam data for the requested office day.""" + booking = _create_booking(internal_ga_client, seeded_data, days_from_now=5) + event_id = str(9000 + booking["booking_id"]) + exam = _create_exam( + internal_ga_client, seeded_data, booking["booking_id"], event_id=event_id + ) + update_response = internal_ga_client.put( + f"/exams/{exam['exam_id']}/", + json={"exam_name": "Updated exam name", "notes": "Updated notes"}, + ) + assert_json_response(update_response, 201) + + booking_start = datetime.fromisoformat(booking["start_time"].replace("Z", "+00:00")) + export_date = ( + booking_start.astimezone( + ZoneInfo(seeded_data["office_timezones"]["test_office"]) + ) + .date() + .isoformat() + ) + export_response = internal_ga_client.get( + f"/exams/export/?start_date={export_date}&end_date={export_date}" + ) + + assert export_response.status_code == 200, export_response.get_data(as_text=True) + export_body = export_response.get_data(as_text=True) + assert "Office Name,Exam Type,Exam ID,Exam Name" in export_body + assert "Updated exam name" in export_body + + +def test_exam_can_be_deleted(internal_ga_client, seeded_data): + """Assert that exams can be deleted from the API.""" + booking = _create_booking(internal_ga_client, seeded_data, days_from_now=5) + exam = _create_exam( + internal_ga_client, seeded_data, booking["booking_id"], event_id="event-delete" + ) + + delete_response = internal_ga_client.delete(f"/exams/{exam['exam_id']}/") + post_delete_list = internal_ga_client.get("/exams/") + + assert delete_response.status_code == 204, delete_response.get_data(as_text=True) + assert_json_response(post_delete_list, 200) + assert all( + item["exam_id"] != exam["exam_id"] + for item in json_of(post_delete_list)["exams"] + ) + + +def test_invigilator_shadow_count_decrements(internal_ga_client): + """Assert that subtracting an invigilator shadow count preserves the remaining metadata.""" + list_response = internal_ga_client.get("/invigilators/") + assert_json_response(list_response, 200) + + first_invigilator = json_of(list_response)["invigilators"][0] + subtract_response = internal_ga_client.put( + f"/invigilator/{first_invigilator['invigilator_id']}/?subtract=True&add=False" + ) + + assert_json_response(subtract_response, 200) + subtracted = json_of(subtract_response)["invigilator"] + assert subtracted["invigilator_id"] == first_invigilator["invigilator_id"] + assert subtracted["contact_email"] == first_invigilator["contact_email"] + assert subtracted["contact_phone"] == first_invigilator["contact_phone"] + assert subtracted["invigilator_notes"] == first_invigilator["invigilator_notes"] + assert subtracted["shadow_count"] == 1 + assert subtracted["shadow_flag"] == "N" + + +def test_invigilator_shadow_count_increment_restores_the_original_value( + internal_ga_client, +): + """Assert that adding back a shadow count restores the original invigilator state.""" + list_response = internal_ga_client.get("/invigilators/") + assert_json_response(list_response, 200) + + first_invigilator = json_of(list_response)["invigilators"][0] + subtract_response = internal_ga_client.put( + f"/invigilator/{first_invigilator['invigilator_id']}/?subtract=True&add=False" + ) + assert_json_response(subtract_response, 200) + + add_response = internal_ga_client.put( + f"/invigilator/{first_invigilator['invigilator_id']}/?subtract=False&add=True" + ) + + assert_json_response(add_response, 200) + added_back = json_of(add_response)["invigilator"] + assert added_back["invigilator_id"] == first_invigilator["invigilator_id"] + assert added_back["contact_email"] == first_invigilator["contact_email"] + assert added_back["contact_phone"] == first_invigilator["contact_phone"] + assert added_back["invigilator_notes"] == first_invigilator["invigilator_notes"] + assert added_back["shadow_count"] == 2 + assert added_back["shadow_flag"] == "Y" diff --git a/api/app/tests/flows/test_booking_recurring_current_office_flows.py b/api/app/tests/flows/test_booking_recurring_current_office_flows.py new file mode 100644 index 000000000..72b2f389b --- /dev/null +++ b/api/app/tests/flows/test_booking_recurring_current_office_flows.py @@ -0,0 +1,96 @@ +from __future__ import annotations + +from datetime import datetime, timedelta, timezone +from uuid import uuid4 + +import pytest + +pytestmark = [pytest.mark.flows, pytest.mark.usefixtures("seeded_database")] + + +def _freeze_recurring_delete_today(monkeypatch, frozen_today: datetime): + from app.resources.bookings.booking import ( + booking_recurring_stat_delete as recurring_delete_module, + ) + + class FrozenDateTime(datetime): + @classmethod + def today(cls): + return frozen_today + + monkeypatch.setattr(recurring_delete_module, "datetime", FrozenDateTime) + + +def _create_booking_occurrence( + app, + *, + office_id: int, + recurring_uuid: str, + start_time: datetime, + booking_name: str, +) -> int: + with app.app_context(): + from app.models.bookings import Booking + from qsystem import db + + booking = Booking( + office_id=office_id, + room_id=None, + start_time=start_time, + end_time=start_time + timedelta(hours=2), + fees="false", + booking_name=booking_name, + booking_contact_information="booking@example.com", + recurring_uuid=recurring_uuid, + ) + db.session.add(booking) + db.session.commit() + return booking.booking_id + + +def test_current_office_recurring_delete_preserves_before_5am_rows_and_other_offices( + internal_ga_client, seeded_data, app, monkeypatch +): + """Assert that current-office recurring deletes only remove this office's non-exempt future rows.""" + _freeze_recurring_delete_today(monkeypatch, datetime(2024, 7, 10, 12, 0, 0)) + recurring_uuid = str(uuid4()) + + same_office_future_id = _create_booking_occurrence( + app, + office_id=seeded_data["office_ids"]["test_office"], + recurring_uuid=recurring_uuid, + start_time=datetime(2024, 7, 11, 17, 0, tzinfo=timezone.utc), + booking_name="Delete Me", + ) + same_office_before_5am_id = _create_booking_occurrence( + app, + office_id=seeded_data["office_ids"]["test_office"], + recurring_uuid=recurring_uuid, + start_time=datetime(2024, 7, 10, 5, 0, tzinfo=timezone.utc), + booking_name="Preserve Before 5am", + ) + other_office_future_id = _create_booking_occurrence( + app, + office_id=seeded_data["office_ids"]["victoria"], + recurring_uuid=recurring_uuid, + start_time=datetime(2024, 7, 11, 18, 0, tzinfo=timezone.utc), + booking_name="Other Office", + ) + + response = internal_ga_client.delete( + f"/bookings/recurring/current-office/{recurring_uuid}" + ) + + assert response.status_code == 204, response.get_data(as_text=True) + + with app.app_context(): + from app.models.bookings import Booking + + remaining_ids = { + booking.booking_id + for booking in Booking.query.filter_by(recurring_uuid=recurring_uuid).all() + } + + assert same_office_future_id not in remaining_ids + assert same_office_before_5am_id in remaining_ids + assert other_office_future_id in remaining_ids diff --git a/api/app/tests/flows/test_csr_dashboard_flows.py b/api/app/tests/flows/test_csr_dashboard_flows.py new file mode 100644 index 000000000..876a8927b --- /dev/null +++ b/api/app/tests/flows/test_csr_dashboard_flows.py @@ -0,0 +1,160 @@ +from __future__ import annotations + +from datetime import timedelta +from uuid import uuid4 + +import pytest +from app.tests.api_test_support import ( + assert_json_response, + create_booking, + create_exam, + create_service_ready_citizen, + json_of, +) + +pytestmark = [pytest.mark.flows, pytest.mark.usefixtures("seeded_database")] + + +def _exam_type_id( + app, + *, + group_exam_ind: int | None = None, + ita_ind: int | None = None, + pesticide_exam_ind: int | None = None, +): + with app.app_context(): + from app.models.bookings import ExamType + + query = ExamType.query + if group_exam_ind is not None: + query = query.filter_by(group_exam_ind=group_exam_ind) + if ita_ind is not None: + query = query.filter_by(ita_ind=ita_ind) + if pesticide_exam_ind is not None: + query = query.filter_by(pesticide_exam_ind=pesticide_exam_ind) + + exam_type = query.order_by(ExamType.exam_type_id).first() + assert exam_type is not None + return exam_type.exam_type_id + + +def test_csr_me_reports_active_citizens_for_the_logged_in_csr( + internal_ga_client, seeded_data +): + """Assert that csr-self lists in-progress citizens already being served by the caller.""" + citizen, _service_request = create_service_ready_citizen( + internal_ga_client, + seeded_data, + position=0, + name="Dashboard Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=1, + counter_id_key="counter", + ) + begin_service = internal_ga_client.post( + f"/citizens/{citizen['citizen_id']}/begin_service/" + ) + assert_json_response(begin_service, 200) + + response = internal_ga_client.get("/csrs/me/") + body = json_of(response) + + assert_json_response(response, 200) + assert body["attention_needed"] is False + assert citizen["citizen_id"] in { + active_citizen["citizen_id"] for active_citizen in body["active_citizens"] + } + + +def test_csr_me_flags_attention_for_stale_individual_exams( + app, internal_ga_client, seeded_data +): + """Assert that overdue individual exams surface the exam-manager attention banner.""" + booking = create_booking(internal_ga_client, seeded_data, days_from_now=5) + create_exam( + internal_ga_client, + seeded_data, + booking["booking_id"], + event_id=f"stale-{uuid4().hex[:8]}", + exam_type_id=_exam_type_id(app, group_exam_ind=0, ita_ind=1), + ) + + with app.app_context(): + from app.models.bookings import Booking + from qsystem import db + + booking_model = Booking.query.filter_by(booking_id=booking["booking_id"]).first() + duration = booking_model.end_time - booking_model.start_time + booking_model.start_time = booking_model.start_time - timedelta(days=10) + booking_model.end_time = booking_model.start_time + duration + db.session.add(booking_model) + db.session.commit() + + response = internal_ga_client.get("/csrs/me/") + + assert_json_response(response, 200) + assert json_of(response)["attention_needed"] is True + + +def test_csr_me_flags_attention_for_missing_pesticide_receipts( + app, internal_ga_client, seeded_data +): + """Assert that pesticide exams without a received date keep the dashboard alert active.""" + booking = create_booking(internal_ga_client, seeded_data, days_from_now=5) + exam = create_exam( + internal_ga_client, + seeded_data, + booking["booking_id"], + event_id=f"pest-{uuid4().hex[:8]}", + exam_type_id=_exam_type_id( + app, group_exam_ind=0, ita_ind=0, pesticide_exam_ind=1 + ), + ) + + with app.app_context(): + from app.models.bookings import Exam + from qsystem import db + + exam_model = Exam.query.filter_by(exam_id=exam["exam_id"]).first() + exam_model.is_pesticide = 1 + exam_model.exam_received_date = None + db.session.add(exam_model) + db.session.commit() + + response = internal_ga_client.get("/csrs/me/") + + assert_json_response(response, 200) + assert json_of(response)["attention_needed"] is True + + +@pytest.mark.parametrize( + ("student_count", "invigilator_count"), + [ + pytest.param(10, 0, id="small-group-requires-at-least-one-invigilator"), + pytest.param(25, 1, id="large-group-requires-two-invigilators"), + ], +) +def test_csr_me_flags_attention_for_group_exam_invigilator_thresholds( + app, internal_ga_client, seeded_data, student_count, invigilator_count +): + """Assert that the csr dashboard flags understaffed group-exam bookings.""" + booking = create_booking( + internal_ga_client, + seeded_data, + days_from_now=5, + invigilator_ids=seeded_data["invigilator_ids"][:invigilator_count], + ) + create_exam( + internal_ga_client, + seeded_data, + booking["booking_id"], + event_id=f"group-{student_count}-{uuid4().hex[:8]}", + exam_type_id=_exam_type_id(app, group_exam_ind=1, ita_ind=1), + number_of_students=student_count, + ) + + response = internal_ga_client.get("/csrs/me/") + + assert_json_response(response, 200) + assert json_of(response)["attention_needed"] is True diff --git a/api/app/tests/flows/test_csr_flows.py b/api/app/tests/flows/test_csr_flows.py new file mode 100644 index 000000000..66d9bc733 --- /dev/null +++ b/api/app/tests/flows/test_csr_flows.py @@ -0,0 +1,98 @@ +from __future__ import annotations + +import pytest +from app.tests.api_test_support import ( + assert_json_response, + create_service_ready_citizen, + json_of, +) + +pytestmark = [pytest.mark.flows, pytest.mark.usefixtures("seeded_database")] + + +def _csr_state_id(app, state_name: str) -> int: + with app.app_context(): + from app.models.theq import CSRState + + state = CSRState.query.filter_by(csr_state_name=state_name).first() + assert state is not None + return state.csr_state_id + + +def _persisted_csr_state(app, csr_id: int) -> str: + with app.app_context(): + from app.models.theq import CSR + + csr = CSR.query.filter_by(csr_id=csr_id).first() + assert csr is not None + return csr.csr_state.csr_state_name + + +def test_csr_can_transition_from_logout_to_break(internal_ga_client, seeded_data, app): + """Assert that a CSR can update their own state from Logout to Break.""" + break_state_id = _csr_state_id(app, "Break") + + response = internal_ga_client.put( + f"/csrs/{seeded_data['csr_ids']['ga']}/", + json={"csr_state_id": break_state_id}, + ) + + assert_json_response(response, 200) + assert json_of(response)["csr"]["csr_state"]["csr_state_name"] == "Break" + assert _persisted_csr_state(app, seeded_data["csr_ids"]["ga"]) == "Break" + + +def test_csr_can_transition_from_break_to_back_office( + internal_ga_client, seeded_data, app +): + """Assert that a CSR already on Break can transition themselves into Back Office work.""" + break_state_id = _csr_state_id(app, "Break") + back_office_state_id = _csr_state_id(app, "Back Office") + assert_json_response( + internal_ga_client.put( + f"/csrs/{seeded_data['csr_ids']['ga']}/", + json={"csr_state_id": break_state_id}, + ), + 200, + ) + + response = internal_ga_client.put( + f"/csrs/{seeded_data['csr_ids']['ga']}/", + json={"csr_state_id": back_office_state_id}, + ) + + assert_json_response(response, 200) + assert json_of(response)["csr"]["csr_state"]["csr_state_name"] == "Back Office" + assert _persisted_csr_state(app, seeded_data["csr_ids"]["ga"]) == "Back Office" + + +def test_csr_state_update_is_rejected_while_the_csr_has_an_open_ticket( + internal_ga_client, seeded_data, app +): + """Assert that CSR state edits are blocked while the CSR still owns an invited or active ticket.""" + break_state_id = _csr_state_id(app, "Break") + citizen, _service_request = create_service_ready_citizen( + internal_ga_client, + seeded_data, + position=0, + name="Open Ticket Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=1, + counter_id_key="quick_trans", + ) + assert_json_response( + internal_ga_client.post(f"/citizens/{citizen['citizen_id']}/begin_service/"), + 200, + ) + + response = internal_ga_client.put( + f"/csrs/{seeded_data['csr_ids']['ga']}/", + json={"csr_state_id": break_state_id}, + ) + + assert response.status_code == 403, response.get_data(as_text=True) + assert ( + json_of(response)["message"] == "CSR has an open ticket and cannot be edited." + ) + assert _persisted_csr_state(app, seeded_data["csr_ids"]["ga"]) == "Logout" diff --git a/api/app/tests/flows/test_draft_appointment_flows.py b/api/app/tests/flows/test_draft_appointment_flows.py new file mode 100644 index 000000000..5883b0f33 --- /dev/null +++ b/api/app/tests/flows/test_draft_appointment_flows.py @@ -0,0 +1,132 @@ +from __future__ import annotations + +from datetime import datetime, timedelta, timezone + +import pytest +from app.tests.api_test_support import ( + assert_json_response, + create_draft_appointment, + create_internal_appointment, + create_public_draft_and_payload, + create_public_user, + json_of, + public_slot_payload, + slot_window_to_iso, +) + +pytestmark = [pytest.mark.flows, pytest.mark.usefixtures("seeded_database")] + + +def _appointment_exists(app, appointment_id: int) -> bool: + with app.app_context(): + from app.models.bookings import Appointment + + return ( + Appointment.query.filter_by(appointment_id=appointment_id).first() + is not None + ) + + +def _backdate_appointment(app, appointment_id: int, *, minutes_ago: int) -> None: + with app.app_context(): + from app.models.bookings import Appointment + from qsystem import db + + appointment = Appointment.query.filter_by(appointment_id=appointment_id).first() + appointment.created_at = datetime.now(timezone.utc) - timedelta( + minutes=minutes_ago + ) + db.session.add(appointment) + db.session.commit() + + +def test_draft_create_persists_is_draft_and_anonymous_fallback_name( + bare_client, seeded_data, app +): + """Assert that anonymous draft creation stores the draft flag and the fallback citizen name.""" + payload, _day_key, _slots = public_slot_payload( + bare_client, seeded_data, minimum_slots=1 + ) + + response = bare_client.post("/appointments/draft", json=payload) + + assert_json_response(response, 201) + appointment = json_of(response)["appointment"] + assert appointment["is_draft"] is True + assert appointment["citizen_name"] == "Draft" + + with app.app_context(): + from app.models.bookings import Appointment + + persisted = Appointment.query.filter_by( + appointment_id=appointment["appointment_id"] + ).first() + assert persisted is not None + assert persisted.is_draft is True + assert persisted.citizen_name == "Draft" + + +def test_draft_delete_removes_the_draft_row(bare_client, seeded_data, app): + """Assert that deleting a draft appointment removes only the draft record from persistence.""" + draft = create_draft_appointment(bare_client, seeded_data) + + response = bare_client.delete(f"/appointments/draft/{draft['appointment_id']}/") + + assert response.status_code == 204, response.get_data(as_text=True) + assert _appointment_exists(app, draft["appointment_id"]) is False + + +def test_confirmed_appointment_creation_consumes_the_previous_draft( + public_client, seeded_data, app +): + """Assert that creating a confirmed appointment with an appointment_draft_id deletes the draft row.""" + create_public_user(public_client) + draft, payload = create_public_draft_and_payload(public_client, seeded_data) + + response = public_client.post("/appointments/", json=payload) + + assert_json_response(response, 201) + appointment = json_of(response)["appointment"] + assert appointment["is_draft"] is False + assert _appointment_exists(app, draft["appointment_id"]) is False + assert _appointment_exists(app, appointment["appointment_id"]) is True + + +def test_draft_flush_deletes_only_expired_drafts( + bare_client, internal_ga_client, seeded_data, app +): + """Assert that draft flushing removes only expired drafts while preserving fresh drafts and confirmed appointments.""" + expired_draft = create_draft_appointment(bare_client, seeded_data) + payload, day_key, slots = public_slot_payload( + bare_client, seeded_data, minimum_slots=2 + ) + fresh_start_time, fresh_end_time = slot_window_to_iso( + day_key, + slots[1], + seeded_data["office_timezones"]["limited_office"], + ) + fresh_response = bare_client.post( + "/appointments/draft", + json={ + **payload, + "start_time": fresh_start_time, + "end_time": fresh_end_time, + }, + ) + assert_json_response(fresh_response, 201) + fresh_draft = json_of(fresh_response)["appointment"] + confirmed_appointment = create_internal_appointment( + internal_ga_client, seeded_data, days_from_now=2 + ) + _backdate_appointment(app, expired_draft["appointment_id"], minutes_ago=20) + + response = bare_client.post("/appointments/draft/flush") + + assert_json_response(response, 200) + deleted_draft_ids = json_of(response)["deleted_draft_ids"] + assert expired_draft["appointment_id"] in deleted_draft_ids + assert fresh_draft["appointment_id"] not in deleted_draft_ids + assert confirmed_appointment["appointment_id"] not in deleted_draft_ids + assert _appointment_exists(app, expired_draft["appointment_id"]) is False + assert _appointment_exists(app, fresh_draft["appointment_id"]) is True + assert _appointment_exists(app, confirmed_appointment["appointment_id"]) is True diff --git a/api/app/tests/flows/test_exam_export_flows.py b/api/app/tests/flows/test_exam_export_flows.py new file mode 100644 index 000000000..84e0917fe --- /dev/null +++ b/api/app/tests/flows/test_exam_export_flows.py @@ -0,0 +1,180 @@ +from __future__ import annotations + +import csv +import io +from datetime import datetime, timedelta, timezone +from uuid import uuid4 +from zoneinfo import ZoneInfo + +import pytest +from app.tests.api_test_support import json_of + +pytestmark = [pytest.mark.flows, pytest.mark.usefixtures("seeded_database")] + + +def _set_finance_designate(app, *, username: str, enabled: int): + with app.app_context(): + from app.models.theq import CSR + from qsystem import db + + csr = CSR.query.filter_by(username=username).first() + csr.finance_designate = enabled + db.session.add(csr) + db.session.commit() + + +def _create_export_exam( + app, + seeded_data, + *, + office_id: int, + start_time: datetime, + exam_name: str, + booking_name: str, + room_id: int | None = None, + invigilator_ids: list[int] | None = None, +) -> dict[str, int]: + with app.app_context(): + from app.models.bookings import Booking, Exam, Invigilator + from qsystem import db + + booking = Booking( + office_id=office_id, + room_id=room_id, + start_time=start_time, + end_time=start_time + timedelta(hours=2), + fees="false", + booking_name=booking_name, + booking_contact_information="booking@example.com", + ) + if invigilator_ids: + booking.invigilators = ( + Invigilator.query.filter(Invigilator.invigilator_id.in_(invigilator_ids)) + .order_by(Invigilator.invigilator_id) + .all() + ) + db.session.add(booking) + db.session.flush() + + exam = Exam( + booking_id=booking.booking_id, + exam_type_id=seeded_data["exam_type_id"], + office_id=office_id, + event_id=f"event-{uuid4().hex[:8]}", + exam_name=exam_name, + examinee_name="Codex Examinee", + expiry_date=start_time + timedelta(days=30), + notes="Export flow", + number_of_students=1, + exam_method="paper", + exam_written_ind=0, + offsite_location="Test Office", + ) + db.session.add(exam) + db.session.commit() + return {"booking_id": booking.booking_id, "exam_id": exam.exam_id} + + +def _export_rows(response) -> list[list[str]]: + return list(csv.reader(io.StringIO(response.get_data(as_text=True)))) + + +def _row_for_exam(rows: list[list[str]], exam_name: str) -> list[str]: + return next(row for row in rows[1:] if row[3] == exam_name) + + +def test_exam_export_rejects_missing_or_invalid_dates(internal_ga_client): + """Assert that export validation fails loudly for missing and malformed date parameters.""" + missing_dates = internal_ga_client.get("/exams/export/?end_date=2024-07-15") + invalid_dates = internal_ga_client.get( + "/exams/export/?start_date=2024-13-40&end_date=2024-07-15" + ) + + assert missing_dates.status_code == 422, missing_dates.get_data(as_text=True) + assert json_of(missing_dates)["message"] == "Must provide both start and end time" + + assert invalid_dates.status_code == 422, invalid_dates.get_data(as_text=True) + assert json_of(invalid_dates)["message"] == "Unable to return date time string" + + +def test_exam_export_localizes_times_and_leaves_blank_room_and_invigilator_columns( + internal_ga_client, seeded_data, app +): + """Assert that CSV rows keep localized timestamps while tolerating bookings without room or invigilator data.""" + start_time = datetime(2024, 7, 15, 17, 0, tzinfo=timezone.utc) + _create_export_exam( + app, + seeded_data, + office_id=seeded_data["office_ids"]["test_office"], + start_time=start_time, + exam_name="No Room Exam", + booking_name="No Room Booking", + room_id=None, + invigilator_ids=[], + ) + + export_date = ( + start_time.astimezone( + ZoneInfo(seeded_data["office_timezones"]["test_office"]) + ) + .date() + .isoformat() + ) + response = internal_ga_client.get( + f"/exams/export/?start_date={export_date}&end_date={export_date}" + ) + + assert response.status_code == 200, response.get_data(as_text=True) + row = _row_for_exam(_export_rows(response), "No Room Exam") + + expected_start = start_time.astimezone( + ZoneInfo(seeded_data["office_timezones"]["test_office"]) + ).strftime("%Y-%m-%d %I:%M %p") + expected_end = (start_time + timedelta(hours=2)).astimezone( + ZoneInfo(seeded_data["office_timezones"]["test_office"]) + ).strftime("%Y-%m-%d %I:%M %p") + + assert row[6] == "" + assert row[7] == "" + assert row[10] == f'="{expected_start}"' + assert row[11] == f'="{expected_end}"' + + +def test_exam_export_limits_non_designates_to_their_own_office_but_allows_designates_to_export_all_offices( + internal_ga_client, internal_nonqtxn_client, seeded_data, app +): + """Assert that finance designates can export rows from other offices while non-designates stay office-scoped.""" + start_time = datetime(2024, 7, 20, 17, 0, tzinfo=timezone.utc) + _create_export_exam( + app, + seeded_data, + office_id=seeded_data["office_ids"]["victoria"], + start_time=start_time, + exam_name="Victoria Export Exam", + booking_name="Victoria Export Booking", + ) + export_date = ( + start_time.astimezone(ZoneInfo(seeded_data["office_timezones"]["victoria"])) + .date() + .isoformat() + ) + + _set_finance_designate(app, username="cfms-postman-operator", enabled=0) + non_designate_response = internal_ga_client.get( + f"/exams/export/?start_date={export_date}&end_date={export_date}" + ) + + assert non_designate_response.status_code == 200, non_designate_response.get_data( + as_text=True + ) + non_designate_exam_names = {row[3] for row in _export_rows(non_designate_response)[1:]} + assert "Victoria Export Exam" not in non_designate_exam_names + + _set_finance_designate(app, username="cfms-postman-non-operator", enabled=1) + designate_response = internal_nonqtxn_client.get( + f"/exams/export/?start_date={export_date}&end_date={export_date}" + ) + + assert designate_response.status_code == 200, designate_response.get_data(as_text=True) + designate_exam_names = {row[3] for row in _export_rows(designate_response)[1:]} + assert "Victoria Export Exam" in designate_exam_names diff --git a/api/app/tests/flows/test_exam_integration_flows.py b/api/app/tests/flows/test_exam_integration_flows.py new file mode 100644 index 000000000..7402959c0 --- /dev/null +++ b/api/app/tests/flows/test_exam_integration_flows.py @@ -0,0 +1,111 @@ +import pytest +from app.tests.api_test_support import assert_json_response, json_of +from app.tests.auth.auth_support import ( + build_bcmp_exam_payload, + create_internal_exam_bundle, + patch_exam_integrations, +) +from app.tests.helpers.exams import ( + exam_invigilator_id, + exam_upload_received_ind, + seed_exam_bcmp_job, +) + +pytestmark = [pytest.mark.flows, pytest.mark.usefixtures("seeded_database")] + + +def test_bcmp_exam_create_returns_the_bcmp_job_id( + internal_ga_client, monkeypatch, seeded_data +): + """Assert that BCMP exam creation returns the created job id.""" + patch_exam_integrations( + monkeypatch, create_individual_response={"jobId": "bcmp-job-999"} + ) + + response = internal_ga_client.post( + "/exams/bcmp/", + json=build_bcmp_exam_payload(seeded_data), + ) + + assert_json_response(response, 201) + assert json_of(response)["bcmp_job_id"] == "bcmp-job-999" + + +def test_bcmp_status_marks_uploaded_exams_as_received( + app, internal_ga_client, monkeypatch, seeded_data +): + """Assert that BCMP bulk status updates persist upload_received_ind for matching exams.""" + _booking, exam = create_internal_exam_bundle(internal_ga_client, seeded_data) + seed_exam_bcmp_job( + app, + exam["exam_id"], + bcmp_job_id="bcmp-job-555", + upload_received_ind=0, + ) + patch_exam_integrations( + monkeypatch, + bulk_jobs=[{"jobId": "bcmp-job-555", "jobStatus": "RESPONSE_UPLOADED"}], + ) + + response = internal_ga_client.post("/exams/bcmp_status/", json={}) + + assert_json_response(response, 200) + assert json_of(response)["exams_updated"] == [exam["exam_id"]] + assert exam_upload_received_ind(app, exam["exam_id"]) == 1 + + +def test_exam_transfer_returns_the_bcmp_transfer_response( + internal_ga_client, monkeypatch, seeded_data +): + """Assert that exam transfer returns the accepted BCMP response payload.""" + _booking, exam = create_internal_exam_bundle(internal_ga_client, seeded_data) + patch_exam_integrations( + monkeypatch, transfer_response={"jobId": "transfer-job-999"} + ) + + response = internal_ga_client.post(f"/exams/{exam['exam_id']}/transfer/") + + assert_json_response(response, 202) + assert json_of(response)["bcmp"]["jobId"] == "transfer-job-999" + + +def test_exam_download_returns_the_generated_pdf( + internal_ga_client, monkeypatch, seeded_data +): + """Assert that exam downloads stream the generated PDF bytes when the package is ready.""" + _booking, exam = create_internal_exam_bundle(internal_ga_client, seeded_data) + patch_exam_integrations( + monkeypatch, + download_job={ + "jobStatus": "PACKAGE_GENERATED", + "jobProperties": {"EXAM_PACKAGE_URL": "https://example.com/package.pdf"}, + }, + download_bytes=b"exam-pdf", + ) + + response = internal_ga_client.get(f"/exams/{exam['exam_id']}/download/") + + assert response.status_code == 200, response.get_data(as_text=True) + assert response.mimetype == "application/pdf" + assert response.get_data() == b"exam-pdf" + + +def test_email_invigilator_updates_the_exam_record( + app, internal_ga_client, monkeypatch, seeded_data +): + """Assert that emailing the invigilator persists the selected invigilator on the exam.""" + _booking, exam = create_internal_exam_bundle(internal_ga_client, seeded_data) + patch_exam_integrations(monkeypatch, email_result=True) + + response = internal_ga_client.post( + f"/exams/{exam['exam_id']}/email_invigilator/", + json={ + "invigilator_id": seeded_data["invigilator_ids"][0], + "invigilator_name": "Homer Simpson", + "invigilator_email": "homer@example.com", + "invigilator_phone": "2505550100", + }, + ) + + assert_json_response(response, 200) + assert exam_invigilator_id(app, exam["exam_id"]) == seeded_data["invigilator_ids"][0] diff --git a/api/app/tests/flows/test_exam_variant_flows.py b/api/app/tests/flows/test_exam_variant_flows.py new file mode 100644 index 000000000..040aea6c9 --- /dev/null +++ b/api/app/tests/flows/test_exam_variant_flows.py @@ -0,0 +1,314 @@ +from __future__ import annotations + +import csv +import io +from datetime import datetime +from uuid import uuid4 +from zoneinfo import ZoneInfo + +import pytest +from app.tests.api_test_support import ( + assert_json_response, + create_booking, + create_exam, + json_of, +) + +pytestmark = [pytest.mark.flows, pytest.mark.usefixtures("seeded_database")] + + +def _exam_type_id( + app, + *, + exam_type_name: str | None = None, + group_exam_ind: int | None = None, + ita_ind: int | None = None, + pesticide_exam_ind: int | None = None, +) -> int: + with app.app_context(): + from app.models.bookings import ExamType + + query = ExamType.query + if exam_type_name is not None: + query = query.filter_by(exam_type_name=exam_type_name) + if group_exam_ind is not None: + query = query.filter_by(group_exam_ind=group_exam_ind) + if ita_ind is not None: + query = query.filter_by(ita_ind=ita_ind) + if pesticide_exam_ind is not None: + query = query.filter_by(pesticide_exam_ind=pesticide_exam_ind) + + exam_type = query.order_by(ExamType.exam_type_id).first() + assert exam_type is not None + return exam_type.exam_type_id + + +def _pesticide_office_id(app) -> int: + with app.app_context(): + from app.models.theq import Office + + office = Office.query.filter_by(office_name="Pesticide Offsite").first() + assert office is not None + return office.office_id + + +def _export_date(booking: dict, timezone_name: str) -> str: + booking_start = datetime.fromisoformat(booking["start_time"].replace("Z", "+00:00")) + return booking_start.astimezone(ZoneInfo(timezone_name)).date().isoformat() + + +def test_pesticide_individual_exam_preserves_type_and_sets_job_event_id( + app, monkeypatch, internal_ga_client, seeded_data +): + """Assert that pesticide individual exam creation keeps the chosen type and maps BCMP job ids to event ids.""" + from app.resources.bookings.exam.exam_post import ExamPost + + exam_type_id = _exam_type_id( + app, group_exam_ind=0, ita_ind=0, pesticide_exam_ind=1 + ) + monkeypatch.setattr( + ExamPost.bcmp_service, + "check_exam_status", + lambda exam: {"jobProperties": {"JOB_ID": f"job-{exam.exam_name}"}}, + ) + + response = internal_ga_client.post( + "/exams/", + json={ + "event_id": "placeholder", + "exam_method": "paper", + "exam_name": "Pesticide Individual", + "exam_type_id": exam_type_id, + "exam_written_ind": 0, + "examinee_name": "Codex Examinee", + "notes": "Pesticide individual flow", + "number_of_students": 1, + "office_id": seeded_data["office_ids"]["test_office"], + "offsite_location": "Test Office", + "expiry_date": datetime.now().isoformat(), + "is_pesticide": 1, + "sbc_managed": "sbc", + "ind_or_group": "individual", + "fees": "25.00", + "receipt_number": "R-100", + }, + ) + body = json_of(response) + + assert_json_response(response, 201) + assert body["exam"]["event_id"] == "job-Pesticide Individual" + + with app.app_context(): + from app.models.bookings import Exam + + exam = Exam.query.filter_by(exam_id=body["exam"]["exam_id"]).first() + assert exam.exam_type_id == exam_type_id + assert exam.office_id == seeded_data["office_ids"]["test_office"] + assert exam.receipt == "R-100" + assert exam.sbc_managed_ind == 1 + + +def test_pesticide_non_sbc_exam_is_reassigned_to_the_pesticide_offsite_office( + app, monkeypatch, internal_ga_client, seeded_data +): + """Assert that non-SBC pesticide exams move to the dedicated pesticide office before persistence.""" + from app.resources.bookings.exam.exam_post import ExamPost + + monkeypatch.setattr( + ExamPost.bcmp_service, + "check_exam_status", + lambda exam: {"jobProperties": {"JOB_ID": "job-non-sbc"}}, + ) + + response = internal_ga_client.post( + "/exams/", + json={ + "event_id": "placeholder", + "exam_method": "paper", + "exam_name": "Pesticide Non SBC", + "exam_type_id": _exam_type_id( + app, group_exam_ind=0, ita_ind=0, pesticide_exam_ind=1 + ), + "exam_written_ind": 0, + "examinee_name": "Codex Examinee", + "notes": "Pesticide non-SBC flow", + "number_of_students": 1, + "office_id": seeded_data["office_ids"]["test_office"], + "offsite_location": "Test Office", + "expiry_date": datetime.now().isoformat(), + "is_pesticide": 1, + "sbc_managed": "non-sbc", + "ind_or_group": "individual", + "fees": "25.00", + }, + ) + body = json_of(response) + + assert_json_response(response, 201) + + with app.app_context(): + from app.models.bookings import Exam + + exam = Exam.query.filter_by(exam_id=body["exam"]["exam_id"]).first() + assert exam.office_id == _pesticide_office_id(app) + assert exam.event_id == "job-non-sbc" + + +def test_pesticide_group_exam_normalizes_candidates_and_uses_group_environment_type( + app, monkeypatch, internal_ga_client, seeded_data +): + """Assert that pesticide group exam creation normalizes candidate payloads for persistence.""" + from app.resources.bookings.exam.exam_post import ExamPost + + monkeypatch.setattr( + ExamPost.bcmp_service, + "check_exam_status", + lambda exam: {"jobProperties": {"JOB_ID": "job-group"}}, + ) + candidate_exam_type_id = _exam_type_id( + app, group_exam_ind=0, ita_ind=0, pesticide_exam_ind=1 + ) + + response = internal_ga_client.post( + "/exams/", + json={ + "event_id": "placeholder", + "exam_method": "paper", + "exam_name": "Pesticide Group", + "exam_type_id": _exam_type_id( + app, exam_type_name="Group Environment Exam" + ), + "exam_written_ind": 0, + "examinee_name": "Codex Group", + "notes": "Pesticide group flow", + "number_of_students": 2, + "office_id": seeded_data["office_ids"]["test_office"], + "offsite_location": "Test Office", + "expiry_date": datetime.now().isoformat(), + "is_pesticide": 1, + "sbc_managed": "sbc", + "ind_or_group": "group", + "fees": "25.00", + "candidates": [ + { + "name": "Candidate One", + "email": "candidate-one@example.com", + "exam_type_id": candidate_exam_type_id, + "fees": "25.00", + "billTo": "candidate", + "receipt": "R-201", + "payeeName": "Candidate One", + "payeeEmail": "candidate-one@example.com", + }, + { + "name": "Candidate Two", + "email": "candidate-two@example.com", + "exam_type_id": candidate_exam_type_id, + "fees": "30.00", + "billTo": "employer", + "receipt": "R-202", + "payeeName": "Employer Two", + "payeeEmail": "employer-two@example.com", + }, + ], + }, + ) + body = json_of(response) + + assert_json_response(response, 201) + + with app.app_context(): + from app.models.bookings import Exam + + exam = Exam.query.filter_by(exam_id=body["exam"]["exam_id"]).first() + assert exam.exam_type.exam_type_name == "Group Environment Exam" + assert exam.event_id == "job-group" + assert exam.candidates_list == [ + { + "examinee_name": "Candidate One", + "examinee_email": "candidate-one@example.com", + "exam_type_id": candidate_exam_type_id, + "fees": "25.00", + "payee_ind": 1, + "receipt": "R-201", + "receipt_number": "R-201", + "payee_name": "Candidate One", + "payee_email": "candidate-one@example.com", + }, + { + "examinee_name": "Candidate Two", + "examinee_email": "candidate-two@example.com", + "exam_type_id": candidate_exam_type_id, + "fees": "30.00", + "payee_ind": 0, + "receipt": "R-202", + "receipt_number": "R-202", + "payee_name": "Employer Two", + "payee_email": "employer-two@example.com", + }, + ] + + +def test_exam_export_all_bookings_includes_non_exam_booking_rows( + internal_ga_client, seeded_data +): + """Assert that the all-bookings export includes rows for bookings without attached exams.""" + booking = create_booking( + internal_ga_client, + seeded_data, + days_from_now=5, + booking_name="Booking Without Exam", + ) + export_date = _export_date( + booking, seeded_data["office_timezones"]["test_office"] + ) + + response = internal_ga_client.get( + f"/exams/export/?start_date={export_date}&end_date={export_date}&exam_type=all_bookings" + ) + + assert response.status_code == 200, response.get_data(as_text=True) + export_body = response.get_data(as_text=True) + assert "Non Exam Booking" in export_body + assert "Booking Without Exam" in export_body + + +def test_exam_export_all_non_ita_excludes_ita_exam_rows( + app, internal_ga_client, seeded_data +): + """Assert that the non-ITA export omits ITA exam rows while preserving non-ITA rows.""" + ita_booking = create_booking(internal_ga_client, seeded_data, days_from_now=5) + non_ita_booking = create_booking(internal_ga_client, seeded_data, days_from_now=5) + + create_exam( + internal_ga_client, + seeded_data, + ita_booking["booking_id"], + event_id=f"ita-{uuid4().hex[:8]}", + exam_type_id=_exam_type_id(app, group_exam_ind=0, ita_ind=1, pesticide_exam_ind=0), + exam_name="ITA Exam", + ) + create_exam( + internal_ga_client, + seeded_data, + non_ita_booking["booking_id"], + event_id=f"nonita-{uuid4().hex[:8]}", + exam_type_id=_exam_type_id( + app, group_exam_ind=0, ita_ind=0, pesticide_exam_ind=0 + ), + exam_name="Non ITA Exam", + ) + + export_date = _export_date( + non_ita_booking, seeded_data["office_timezones"]["test_office"] + ) + response = internal_ga_client.get( + f"/exams/export/?start_date={export_date}&end_date={export_date}&exam_type=all_non_ita" + ) + + assert response.status_code == 200, response.get_data(as_text=True) + export_body = response.get_data(as_text=True) + rows = list(csv.reader(io.StringIO(export_body))) + exam_names = {row[3] for row in rows[1:]} + assert "Non ITA Exam" in exam_names + assert "ITA Exam" not in exam_names diff --git a/api/app/tests/flows/test_queue_flows.py b/api/app/tests/flows/test_queue_flows.py new file mode 100644 index 000000000..202ff8eeb --- /dev/null +++ b/api/app/tests/flows/test_queue_flows.py @@ -0,0 +1,753 @@ +from __future__ import annotations + +import pytest +from app.tests.api_test_support import ( + assert_json_response, + json_of, +) +from app.tests.api_test_support import ( + create_citizen as _create_citizen, +) +from app.tests.api_test_support import ( + create_queue_ready_citizen as _create_queue_ready_citizen, +) +from app.tests.api_test_support import ( + create_service_ready_citizen as _create_service_ready_citizen, +) +from app.tests.api_test_support import ( + create_service_request as _create_service_request, +) +from app.tests.contracts.conftest import validate_schema +from app.tests.contracts.schemas import CITIZEN_RESPONSE_SCHEMA +from sqlalchemy.orm import raiseload + +pytestmark = [pytest.mark.flows, pytest.mark.usefixtures("seeded_database")] + + +def _citizen_from_response(response, expected_status: int = 200): + assert_json_response(response, expected_status) + body = json_of(response) + validate_schema(body, CITIZEN_RESPONSE_SCHEMA) + return body["citizen"] + + +def _primary_service_request(citizen: dict) -> dict: + return citizen["service_reqs"][0] + + +def _period_names(citizen: dict) -> list[str]: + return [ + period["ps"]["ps_name"] + for period in _primary_service_request(citizen)["periods"] + ] + + +def _latest_period_name(record: dict) -> str: + return record["periods"][-1]["ps"]["ps_name"] + + +def _assert_period_count_delta(record: dict, previous_count: int, *, delta: int = 1): + assert len(record["periods"]) == previous_count + delta + + +def _queue_ids(api_client) -> list[int]: + response = api_client.get("/citizens/") + assert_json_response(response, 200) + return [citizen["citizen_id"] for citizen in json_of(response)["citizens"]] + + +def test_qt1_specific_invite_appends_an_invited_period(internal_ga_client, seeded_data): + """Assert that QT1 specific invites append an Invited period to the citizen's active request.""" + citizen, _service_request, queued_citizen = _create_queue_ready_citizen( + internal_ga_client, + seeded_data, + position=0, + name="QT1 Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=3, + counter_id_key="counter", + qt_xn_citizen_ind=0, + comments="Needs property tax", + ) + + queued_period_count = len(_primary_service_request(queued_citizen)["periods"]) + invited_citizen = _citizen_from_response( + internal_ga_client.post(f"/citizens/{citizen['citizen_id']}/invite/") + ) + + assert _latest_period_name(_primary_service_request(invited_citizen)) == "Invited" + _assert_period_count_delta( + _primary_service_request(invited_citizen), queued_period_count + ) + + +def test_generic_invite_accepts_an_empty_post_body( + internal_ga_client, seeded_data +): + """Assert that legacy empty-body invites still default to the CSR counter under Flask 3.""" + citizen, _service_request, queued_citizen = _create_queue_ready_citizen( + internal_ga_client, + seeded_data, + position=0, + name="Empty Body Invite Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=1, + counter_id_key="counter", + qt_xn_citizen_ind=0, + ) + + queued_period_count = len(_primary_service_request(queued_citizen)["periods"]) + invited_citizen = _citizen_from_response( + internal_ga_client.post("/citizens/invite/", data="") + ) + + assert invited_citizen["citizen_id"] == citizen["citizen_id"] + assert _latest_period_name(_primary_service_request(invited_citizen)) == "Invited" + _assert_period_count_delta( + _primary_service_request(invited_citizen), queued_period_count + ) + + +def test_qt1_begin_service_after_invite_appends_a_being_served_period( + internal_ga_client, seeded_data +): + """Assert that QT1 begin-service transitions append a Being Served period after a specific invite.""" + citizen, _service_request, _queued_citizen = _create_queue_ready_citizen( + internal_ga_client, + seeded_data, + position=0, + name="QT1 Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=3, + counter_id_key="counter", + qt_xn_citizen_ind=0, + comments="Needs property tax", + ) + + invited_citizen = _citizen_from_response( + internal_ga_client.post(f"/citizens/{citizen['citizen_id']}/invite/") + ) + invited_period_count = len(_primary_service_request(invited_citizen)["periods"]) + serving_citizen = _citizen_from_response( + internal_ga_client.post(f"/citizens/{citizen['citizen_id']}/begin_service/") + ) + + assert ( + _latest_period_name(_primary_service_request(serving_citizen)) == "Being Served" + ) + _assert_period_count_delta( + _primary_service_request(serving_citizen), invited_period_count + ) + + +def test_qt1_reactivate_service_request_restores_a_being_served_period( + internal_ga_client, seeded_data +): + """Assert that QT1 reactivation appends a fresh Being Served period to the original request.""" + citizen, first_service, _queued_citizen = _create_queue_ready_citizen( + internal_ga_client, + seeded_data, + position=0, + name="QT1 Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=3, + counter_id_key="counter", + qt_xn_citizen_ind=0, + comments="Needs property tax", + ) + + _citizen_from_response( + internal_ga_client.post(f"/citizens/{citizen['citizen_id']}/invite/") + ) + serving_citizen = _citizen_from_response( + internal_ga_client.post(f"/citizens/{citizen['citizen_id']}/begin_service/") + ) + serving_period_count = len(_primary_service_request(serving_citizen)["periods"]) + + second_service = _create_service_request( + internal_ga_client, + citizen["citizen_id"], + service_id=seeded_data["service_ids"]["msp"], + channel_id=seeded_data["channel_ids"]["email"], + quantity=1, + ) + reactivate_response = internal_ga_client.post( + f"/service_requests/{first_service['sr_id']}/activate/" + ) + + assert_json_response(reactivate_response, 200) + reactivated_request = json_of(reactivate_response)["service_request"] + + assert second_service["service_id"] == seeded_data["service_ids"]["msp"] + assert reactivated_request["sr_id"] == first_service["sr_id"] + assert _latest_period_name(reactivated_request) == "Being Served" + _assert_period_count_delta(reactivated_request, serving_period_count) + + +def test_qt1_finish_service_completes_both_requests_and_clears_the_queue( + internal_ga_client, seeded_data, app +): + """Assert that QT1 finish-service completes both requests, updates citizen state, and clears the queue.""" + citizen, first_service, _queued_citizen = _create_queue_ready_citizen( + internal_ga_client, + seeded_data, + position=0, + name="QT1 Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=3, + counter_id_key="counter", + qt_xn_citizen_ind=0, + comments="Needs property tax", + ) + + _citizen_from_response( + internal_ga_client.post(f"/citizens/{citizen['citizen_id']}/invite/") + ) + _citizen_from_response( + internal_ga_client.post(f"/citizens/{citizen['citizen_id']}/begin_service/") + ) + _create_service_request( + internal_ga_client, + citizen["citizen_id"], + service_id=seeded_data["service_ids"]["msp"], + channel_id=seeded_data["channel_ids"]["email"], + quantity=1, + ) + assert_json_response( + internal_ga_client.post( + f"/service_requests/{first_service['sr_id']}/activate/" + ), + 200, + ) + + finished_citizen = _citizen_from_response( + internal_ga_client.post(f"/citizens/{citizen['citizen_id']}/finish_service/") + ) + + assert [ + service_request["sr_state"]["sr_code"] + for service_request in finished_citizen["service_reqs"] + ] == [ + "Complete", + "Complete", + ] + assert finished_citizen["cs"]["cs_state_name"] == "Received Services" + assert _queue_ids(internal_ga_client) == [] + + with app.app_context(): + from app.models.theq import Citizen, ServiceReq + + citizen_model = Citizen.query.filter_by( + citizen_id=citizen["citizen_id"] + ).first() + sr_models = ( + ServiceReq.query.filter_by(citizen_id=citizen["citizen_id"]) + .order_by(ServiceReq.sr_number) + .all() + ) + assert citizen_model.cs.cs_state_name == "Received Services" + assert [service_request.sr_state.sr_code for service_request in sr_models] == [ + "Complete", + "Complete", + ] + + +def test_qt2_begin_service_appends_a_being_served_period( + internal_ga_client, seeded_data +): + """Assert that QT2 begin-service appends a Being Served period to the active request.""" + citizen, service_request = _create_service_ready_citizen( + internal_ga_client, + seeded_data, + position=0, + name="QT2 Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=2, + counter_id_key="counter", + ) + + initial_period_count = len(service_request["periods"]) + serving_citizen = _citizen_from_response( + internal_ga_client.post(f"/citizens/{citizen['citizen_id']}/begin_service/") + ) + + assert ( + _latest_period_name(_primary_service_request(serving_citizen)) == "Being Served" + ) + _assert_period_count_delta( + _primary_service_request(serving_citizen), initial_period_count + ) + + +def test_qt2_place_on_hold_appends_an_on_hold_period(internal_ga_client, seeded_data): + """Assert that QT2 place-on-hold appends an On hold period to the active request.""" + citizen, _service_request = _create_service_ready_citizen( + internal_ga_client, + seeded_data, + position=0, + name="QT2 Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=2, + counter_id_key="counter", + ) + + serving_citizen = _citizen_from_response( + internal_ga_client.post(f"/citizens/{citizen['citizen_id']}/begin_service/") + ) + serving_period_count = len(_primary_service_request(serving_citizen)["periods"]) + held_citizen = _citizen_from_response( + internal_ga_client.post(f"/citizens/{citizen['citizen_id']}/place_on_hold/") + ) + + assert _latest_period_name(_primary_service_request(held_citizen)) == "On hold" + _assert_period_count_delta( + _primary_service_request(held_citizen), serving_period_count + ) + + +def test_qt2_resume_service_appends_being_served_after_hold( + internal_ga_client, seeded_data +): + """Assert that QT2 resume transitions append Being Served after the existing hold history.""" + citizen, _service_request = _create_service_ready_citizen( + internal_ga_client, + seeded_data, + position=0, + name="QT2 Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=2, + counter_id_key="counter", + ) + + _citizen_from_response( + internal_ga_client.post(f"/citizens/{citizen['citizen_id']}/begin_service/") + ) + held_citizen = _citizen_from_response( + internal_ga_client.post(f"/citizens/{citizen['citizen_id']}/place_on_hold/") + ) + held_period_count = len(_primary_service_request(held_citizen)["periods"]) + resumed_citizen = _citizen_from_response( + internal_ga_client.post(f"/citizens/{citizen['citizen_id']}/begin_service/") + ) + + assert ( + _latest_period_name(_primary_service_request(resumed_citizen)) == "Being Served" + ) + _assert_period_count_delta( + _primary_service_request(resumed_citizen), held_period_count + ) + assert _period_names(resumed_citizen)[-3:] == [ + "Being Served", + "On hold", + "Being Served", + ] + + +def test_qt2_finish_service_marks_the_request_complete_and_clears_the_queue( + internal_ga_client, seeded_data +): + """Assert that QT2 finish-service leaves the request Complete and removes the citizen from the queue.""" + citizen, _service_request = _create_service_ready_citizen( + internal_ga_client, + seeded_data, + position=0, + name="QT2 Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=2, + counter_id_key="counter", + ) + + _citizen_from_response( + internal_ga_client.post(f"/citizens/{citizen['citizen_id']}/begin_service/") + ) + _citizen_from_response( + internal_ga_client.post(f"/citizens/{citizen['citizen_id']}/place_on_hold/") + ) + _citizen_from_response( + internal_ga_client.post(f"/citizens/{citizen['citizen_id']}/begin_service/") + ) + finished_citizen = _citizen_from_response( + internal_ga_client.post(f"/citizens/{citizen['citizen_id']}/finish_service/") + ) + + assert ( + _primary_service_request(finished_citizen)["sr_state"]["sr_code"] == "Complete" + ) + assert _queue_ids(internal_ga_client) == [] + + +def test_qt3_citizen_leaves_after_create(internal_ga_client, app): + """Assert that QT3 marks a newly created citizen as having left before service.""" + citizen = _create_citizen(internal_ga_client, 0, name="QT3 Citizen") + leave_response = internal_ga_client.post( + f"/citizens/{citizen['citizen_id']}/citizen_left/" + ) + + assert_json_response(leave_response, 200) + + with app.app_context(): + from app.models.theq import Citizen + + citizen_model = Citizen.query.filter_by( + citizen_id=citizen["citizen_id"] + ).first() + assert citizen_model.cs.cs_state_name == "Left before receiving services" + + +def test_qt4_citizen_leaves_after_waiting(internal_ga_client, seeded_data, app): + """Assert that QT4 preserves the left-state transition after the citizen joins the queue.""" + citizen, _service_request, _queued_citizen = _create_queue_ready_citizen( + internal_ga_client, + seeded_data, + position=0, + name="QT4 Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=1, + counter_id_key="counter", + qt_xn_citizen_ind=0, + ) + leave_response = internal_ga_client.post( + f"/citizens/{citizen['citizen_id']}/citizen_left/" + ) + + assert_json_response(leave_response, 200) + + with app.app_context(): + from app.models.theq import Citizen + + citizen_model = Citizen.query.filter_by( + citizen_id=citizen["citizen_id"] + ).first() + assert citizen_model.cs.cs_state_name == "Left before receiving services" + + +def test_qt5_update_service_request_quantity_and_service( + internal_ga_client, seeded_data, app +): + """Assert that QT5 preserves service-request updates while a citizen is being served.""" + citizen, service_request = _create_service_ready_citizen( + internal_ga_client, + seeded_data, + position=0, + name="QT5 Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=3, + ) + _citizen_from_response( + internal_ga_client.post(f"/citizens/{citizen['citizen_id']}/begin_service/") + ) + + quantity_update = internal_ga_client.put( + f"/service_requests/{service_request['sr_id']}/", json={"quantity": 5} + ) + service_update = internal_ga_client.put( + f"/service_requests/{service_request['sr_id']}/", + json={"service_id": seeded_data["service_ids"]["msp"]}, + ) + finish_response = internal_ga_client.post( + f"/citizens/{citizen['citizen_id']}/finish_service/" + ) + + assert_json_response(quantity_update, 200) + assert json_of(quantity_update)["service_request"]["quantity"] == 5 + assert_json_response(service_update, 200) + assert ( + json_of(service_update)["service_request"]["service_id"] + == seeded_data["service_ids"]["msp"] + ) + assert_json_response(finish_response, 200) + + with app.app_context(): + from app.models.theq import ServiceReq + + service_request_model = ServiceReq.query.filter_by( + sr_id=service_request["sr_id"] + ).first() + assert service_request_model.quantity == 5 + assert service_request_model.service_id == seeded_data["service_ids"]["msp"] + + +def test_qt6_first_generic_invite_prefers_the_quick_transaction_counter( + internal_ga_client, seeded_data +): + """Assert that QT6 generic invite selects the quick-transaction citizen before the standard queue.""" + _first_citizen, _first_service_request, _first_queued_citizen = ( + _create_queue_ready_citizen( + internal_ga_client, + seeded_data, + position=0, + name="QT6 First", + service_id_key="ptax", + channel_id_key="phone", + quantity=1, + counter_id_key="counter", + qt_xn_citizen_ind=0, + ) + ) + second_citizen, _second_service_request, second_queued_citizen = ( + _create_queue_ready_citizen( + internal_ga_client, + seeded_data, + position=1, + name="QT6 Second", + service_id_key="msp", + channel_id_key="email", + quantity=1, + counter_id_key="quick_trans", + qt_xn_citizen_ind=1, + ) + ) + + queued_period_count = len( + _primary_service_request(second_queued_citizen)["periods"] + ) + invited_citizen = _citizen_from_response( + internal_ga_client.post("/citizens/invite/", json={}) + ) + + assert invited_citizen["citizen_id"] == second_citizen["citizen_id"] + assert invited_citizen["qt_xn_citizen_ind"] == 1 + assert _latest_period_name(_primary_service_request(invited_citizen)) == "Invited" + _assert_period_count_delta( + _primary_service_request(invited_citizen), queued_period_count + ) + + +def test_generic_invite_snowplow_context_handles_raiseloaded_citizen( + internal_ga_client, seeded_data, app +): + """Assert that SnowPlow can build citizen context from the generic invite query shape.""" + citizen, _service_request, _queued_citizen = _create_queue_ready_citizen( + internal_ga_client, + seeded_data, + position=0, + name="SnowPlow Generic Invite Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=1, + counter_id_key="quick_trans", + qt_xn_citizen_ind=1, + ) + + with app.app_context(): + from app.models.theq import Citizen + from app.utilities.snowplow import SnowPlow + + citizen_model = ( + Citizen.query.options( + raiseload(Citizen.office), + raiseload(Citizen.counter), + raiseload(Citizen.user), + ) + .filter_by(citizen_id=citizen["citizen_id"]) + .first() + ) + + citizen_context = SnowPlow.get_citizen( + citizen_model, + "Counter", + svc_number=3, + ) + + assert citizen_context.data == { + "client_id": citizen["citizen_id"], + "service_count": 3, + "counter_type": "Quick Trans", + } + + +def test_qt6_second_generic_invite_returns_the_remaining_standard_queue_citizen( + internal_ga_client, seeded_data +): + """Assert that QT6 returns the remaining standard-queue citizen after the quick-transaction citizen finishes.""" + first_citizen, _first_service_request, first_queued_citizen = ( + _create_queue_ready_citizen( + internal_ga_client, + seeded_data, + position=0, + name="QT6 First", + service_id_key="ptax", + channel_id_key="phone", + quantity=1, + counter_id_key="counter", + qt_xn_citizen_ind=0, + ) + ) + second_citizen, _second_service_request, _second_queued_citizen = ( + _create_queue_ready_citizen( + internal_ga_client, + seeded_data, + position=1, + name="QT6 Second", + service_id_key="msp", + channel_id_key="email", + quantity=1, + counter_id_key="quick_trans", + qt_xn_citizen_ind=1, + ) + ) + + first_invited_citizen = _citizen_from_response( + internal_ga_client.post("/citizens/invite/", json={}) + ) + _citizen_from_response( + internal_ga_client.post( + f"/citizens/{second_citizen['citizen_id']}/begin_service/" + ) + ) + _citizen_from_response( + internal_ga_client.post( + f"/citizens/{second_citizen['citizen_id']}/finish_service/" + ) + ) + + queued_period_count = len(_primary_service_request(first_queued_citizen)["periods"]) + second_invited_citizen = _citizen_from_response( + internal_ga_client.post("/citizens/invite/", json={}) + ) + + assert first_invited_citizen["citizen_id"] == second_citizen["citizen_id"] + assert second_invited_citizen["citizen_id"] == first_citizen["citizen_id"] + assert second_invited_citizen["qt_xn_citizen_ind"] == 0 + assert ( + _latest_period_name(_primary_service_request(second_invited_citizen)) + == "Invited" + ) + _assert_period_count_delta( + _primary_service_request(second_invited_citizen), queued_period_count + ) + + assert_json_response( + internal_ga_client.post( + f"/citizens/{first_citizen['citizen_id']}/citizen_left/" + ), + 200, + ) + assert _queue_ids(internal_ga_client) == [] + + +def test_qt7_first_generic_invite_prefers_the_standard_counter( + internal_nonqtxn_client, seeded_data +): + """Assert that QT7 generic invite selects the standard-queue citizen for a non-quick-transaction CSR.""" + first_citizen, _first_service_request, first_queued_citizen = ( + _create_queue_ready_citizen( + internal_nonqtxn_client, + seeded_data, + position=0, + name="QT7 First", + service_id_key="ptax", + channel_id_key="phone", + quantity=1, + counter_id_key="counter", + qt_xn_citizen_ind=0, + ) + ) + _second_citizen, _second_service_request, _second_queued_citizen = ( + _create_queue_ready_citizen( + internal_nonqtxn_client, + seeded_data, + position=1, + name="QT7 Second", + service_id_key="msp", + channel_id_key="email", + quantity=1, + counter_id_key="quick_trans", + qt_xn_citizen_ind=1, + ) + ) + + queued_period_count = len(_primary_service_request(first_queued_citizen)["periods"]) + invited_citizen = _citizen_from_response( + internal_nonqtxn_client.post("/citizens/invite/", json={}) + ) + + assert invited_citizen["citizen_id"] == first_citizen["citizen_id"] + assert invited_citizen["qt_xn_citizen_ind"] == 0 + assert _latest_period_name(_primary_service_request(invited_citizen)) == "Invited" + _assert_period_count_delta( + _primary_service_request(invited_citizen), queued_period_count + ) + + +def test_qt7_second_generic_invite_returns_the_remaining_quick_transaction_citizen( + internal_nonqtxn_client, seeded_data +): + """Assert that QT7 returns the remaining quick-transaction citizen after the standard citizen finishes.""" + first_citizen, _first_service_request, _first_queued_citizen = ( + _create_queue_ready_citizen( + internal_nonqtxn_client, + seeded_data, + position=0, + name="QT7 First", + service_id_key="ptax", + channel_id_key="phone", + quantity=1, + counter_id_key="counter", + qt_xn_citizen_ind=0, + ) + ) + second_citizen, _second_service_request, second_queued_citizen = ( + _create_queue_ready_citizen( + internal_nonqtxn_client, + seeded_data, + position=1, + name="QT7 Second", + service_id_key="msp", + channel_id_key="email", + quantity=1, + counter_id_key="quick_trans", + qt_xn_citizen_ind=1, + ) + ) + + first_invited_citizen = _citizen_from_response( + internal_nonqtxn_client.post("/citizens/invite/", json={}) + ) + _citizen_from_response( + internal_nonqtxn_client.post( + f"/citizens/{first_citizen['citizen_id']}/begin_service/" + ) + ) + _citizen_from_response( + internal_nonqtxn_client.post( + f"/citizens/{first_citizen['citizen_id']}/finish_service/" + ) + ) + + queued_period_count = len( + _primary_service_request(second_queued_citizen)["periods"] + ) + second_invited_citizen = _citizen_from_response( + internal_nonqtxn_client.post("/citizens/invite/", json={}) + ) + + assert first_invited_citizen["citizen_id"] == first_citizen["citizen_id"] + assert second_invited_citizen["citizen_id"] == second_citizen["citizen_id"] + assert second_invited_citizen["qt_xn_citizen_ind"] == 1 + assert ( + _latest_period_name(_primary_service_request(second_invited_citizen)) + == "Invited" + ) + _assert_period_count_delta( + _primary_service_request(second_invited_citizen), queued_period_count + ) + + assert_json_response( + internal_nonqtxn_client.post( + f"/citizens/{second_citizen['citizen_id']}/citizen_left/" + ), + 200, + ) + assert _queue_ids(internal_nonqtxn_client) == [] diff --git a/api/app/tests/flows/test_reminder_flows.py b/api/app/tests/flows/test_reminder_flows.py new file mode 100644 index 000000000..3bd493728 --- /dev/null +++ b/api/app/tests/flows/test_reminder_flows.py @@ -0,0 +1,156 @@ +import pytest +from app.tests.api_test_support import assert_json_response, json_of +from app.tests.auth.auth_support import create_public_appointment +from app.tests.helpers.appointments import ( + align_current_pacific_time_for_appointment, + configure_public_user_reminders, + create_internal_reminder_appointment, +) +from app.tests.api_test_support import future_utc_window, unique_name + +pytestmark = [pytest.mark.flows, pytest.mark.usefixtures("seeded_database")] + + +def _create_blackout_reminder_appointment( + api_client, + seeded_data, + *, + contact_information: str, + days_from_now: int = 2, +) -> dict: + start_time, end_time = future_utc_window(days_from_now) + response = api_client.post( + "/appointments/", + json={ + "office_id": seeded_data["office_ids"]["test_office"], + "start_time": start_time, + "end_time": end_time, + "comments": "Blackout reminder coverage", + "citizen_name": unique_name("blackout-reminder"), + "contact_information": contact_information, + "blackout_flag": "Y", + }, + ) + assert_json_response(response, 201) + return json_of(response)["appointment"] + + +def test_email_reminders_include_opted_in_public_users( + monkeypatch, public_client, reminder_job_client, seeded_data +): + """Assert that opted-in public users appear in the email reminder payload.""" + user = configure_public_user_reminders( + public_client, + email="public@example.com", + send_email_reminders=True, + ) + appointment = create_public_appointment(public_client, seeded_data) + align_current_pacific_time_for_appointment( + monkeypatch, + appointment["start_time"], + seeded_data["office_timezones"]["limited_office"], + ) + + response = reminder_job_client.get("/appointment/reminders/email/") + + assert_json_response(response, 200) + assert any( + item["display_name"] == user["display_name"] + and item["email"] == "public@example.com" + for item in json_of(response)["appointments"] + ) + + +def test_sms_reminders_include_anonymous_phone_appointments( + internal_ga_client, monkeypatch, reminder_job_client, seeded_data +): + """Assert that anonymous appointments with a valid phone number appear in SMS reminders.""" + appointment = create_internal_reminder_appointment( + internal_ga_client, + seeded_data, + contact_information="2505550110", + ) + align_current_pacific_time_for_appointment( + monkeypatch, + appointment["start_time"], + seeded_data["office_timezones"]["test_office"], + ) + + response = reminder_job_client.get("/appointment/reminders/sms/") + + assert_json_response(response, 200) + assert any( + item["display_name"] == appointment["citizen_name"] + and item["user_telephone"] == "2505550110" + for item in json_of(response)["appointments"] + ) + + +def test_email_reminders_exclude_public_users_who_did_not_opt_in( + monkeypatch, public_client, reminder_job_client, seeded_data +): + """Assert that public users without email opt-in are excluded from reminder delivery.""" + configure_public_user_reminders( + public_client, + email="public@example.com", + send_email_reminders=False, + ) + appointment = create_public_appointment(public_client, seeded_data) + align_current_pacific_time_for_appointment( + monkeypatch, + appointment["start_time"], + seeded_data["office_timezones"]["limited_office"], + ) + + response = reminder_job_client.get("/appointment/reminders/email/") + + assert_json_response(response, 200) + assert json_of(response)["appointments"] == [] + + +def test_email_reminders_exclude_service_less_blackout_appointments( + internal_ga_client, monkeypatch, reminder_job_client, seeded_data +): + """Assert that blackout appointments without services are skipped by email reminders.""" + appointment = _create_blackout_reminder_appointment( + internal_ga_client, + seeded_data, + contact_information="blackout@example.com", + ) + align_current_pacific_time_for_appointment( + monkeypatch, + appointment["start_time"], + seeded_data["office_timezones"]["test_office"], + ) + + response = reminder_job_client.get("/appointment/reminders/email/") + + assert_json_response(response, 200) + assert not any( + item["display_name"] == appointment["citizen_name"] + for item in json_of(response)["appointments"] + ) + + +def test_sms_reminders_exclude_service_less_blackout_appointments( + internal_ga_client, monkeypatch, reminder_job_client, seeded_data +): + """Assert that blackout appointments without services are skipped by SMS reminders.""" + appointment = _create_blackout_reminder_appointment( + internal_ga_client, + seeded_data, + contact_information="2505550199", + ) + align_current_pacific_time_for_appointment( + monkeypatch, + appointment["start_time"], + seeded_data["office_timezones"]["test_office"], + ) + + response = reminder_job_client.get("/appointment/reminders/sms/") + + assert_json_response(response, 200) + assert not any( + item["display_name"] == appointment["citizen_name"] + for item in json_of(response)["appointments"] + ) diff --git a/api/app/tests/flows/test_service_refresh_flows.py b/api/app/tests/flows/test_service_refresh_flows.py new file mode 100644 index 000000000..7c5f01c9b --- /dev/null +++ b/api/app/tests/flows/test_service_refresh_flows.py @@ -0,0 +1,47 @@ +import pytest +from app.tests.api_test_support import assert_json_response, json_of +from app.tests.auth.auth_support import promote_internal_csr_to_support + +pytestmark = [pytest.mark.flows, pytest.mark.usefixtures("seeded_database")] + + +def test_ga_can_refresh_services_for_their_own_office( + internal_ga_client, seeded_data +): + """Assert that a GA can refresh the service lists for their own office.""" + response = internal_ga_client.get( + f"/services/refresh/?office_id={seeded_data['office_ids']['test_office']}" + ) + body = json_of(response) + + assert_json_response(response, 200) + assert body["office_id"] == seeded_data["office_ids"]["test_office"] + assert isinstance(body["quick_list"], list) + assert isinstance(body["back_office_list"], list) + + +def test_ga_is_rejected_when_refreshing_a_different_office( + internal_ga_client, seeded_data +): + """Assert that GAs cannot refresh service lists for a different office.""" + response = internal_ga_client.get( + f"/services/refresh/?office_id={seeded_data['office_ids']['limited_office']}" + ) + + assert response.status_code == 403, response.get_data(as_text=True) + assert "cannot refresh" in response.get_data(as_text=True) + + +def test_support_user_can_refresh_services_for_any_office( + app, internal_nonqtxn_client, seeded_data +): + """Assert that SUPPORT users can refresh service lists outside their home office.""" + promote_internal_csr_to_support(app) + + response = internal_nonqtxn_client.get( + f"/services/refresh/?office_id={seeded_data['office_ids']['limited_office']}" + ) + body = json_of(response) + + assert_json_response(response, 200) + assert body["office_id"] == seeded_data["office_ids"]["limited_office"] diff --git a/api/app/tests/flows/test_service_request_flows.py b/api/app/tests/flows/test_service_request_flows.py new file mode 100644 index 000000000..d0d42bc8a --- /dev/null +++ b/api/app/tests/flows/test_service_request_flows.py @@ -0,0 +1,202 @@ +from __future__ import annotations + +import re + +import pytest +from app.tests.api_test_support import ( + assert_json_response, + create_citizen, + create_service_ready_citizen, + json_of, +) + +pytestmark = [pytest.mark.flows, pytest.mark.usefixtures("seeded_database")] + + +def _service_request_payload( + citizen_id: int, + seeded_data, + *, + service_id: int, + channel_id_key: str = "phone", + quantity: int = 1, +): + return { + "service_request": { + "citizen_id": citizen_id, + "service_id": service_id, + "channel_id": seeded_data["channel_ids"][channel_id_key], + "quantity": quantity, + } + } + + +def test_service_request_create_rejects_missing_payload(internal_ga_client): + """Assert that the create endpoint returns a stable 400 when JSON input is missing.""" + response = internal_ga_client.post( + "/service_requests/", + data="null", + content_type="application/json", + ) + + assert response.status_code == 400, response.get_data(as_text=True) + assert json_of(response)["message"] == "No input data received for creating service request" + + +def test_service_request_create_rejects_category_selection( + internal_ga_client, seeded_data +): + """Assert that category ids are rejected so the frontend must submit a concrete service.""" + citizen = create_citizen(internal_ga_client, 0, name="Category Rejection Citizen") + response = internal_ga_client.post( + "/service_requests/", + json=_service_request_payload( + citizen["citizen_id"], + seeded_data, + service_id=seeded_data["service_ids"]["ptax_category"], + ), + ) + + assert response.status_code == 400, response.get_data(as_text=True) + assert "category" in json_of(response)["message"].lower() + + +def test_service_request_create_rejects_unknown_service_id( + internal_ga_client, seeded_data +): + """Assert that unknown service ids return a stable JSON 400 instead of an HTML 500.""" + citizen = create_citizen(internal_ga_client, 0, name="Invalid Service Citizen") + response = internal_ga_client.post( + "/service_requests/", + json=_service_request_payload( + citizen["citizen_id"], + seeded_data, + service_id=999999, + ), + ) + + assert_json_response(response, 400) + assert json_of(response)["message"] == "Could not find service for service_id: 999999" + + +def test_first_service_request_assigns_ticket_numbers_and_choose_service_event( + internal_ga_client, seeded_data, app, monkeypatch +): + """Assert that the first service request creates a ticket number and emits only the choose-service event.""" + from app.resources.theq import service_requests_list as service_requests_module + + choose_service_calls = [] + snowplow_events = [] + monkeypatch.setattr( + service_requests_module.SnowPlow, + "choose_service", + staticmethod( + lambda service_request, csr, event: choose_service_calls.append( + (service_request.sr_number, csr.username, event) + ) + ), + ) + monkeypatch.setattr( + service_requests_module.SnowPlow, + "snowplow_event", + staticmethod( + lambda citizen_id, csr, event, current_sr_number=None: snowplow_events.append( + (citizen_id, csr.username, event, current_sr_number) + ) + ), + ) + + citizen = create_citizen(internal_ga_client, 0, name="First Service Citizen") + response = internal_ga_client.post( + "/service_requests/", + json=_service_request_payload( + citizen["citizen_id"], + seeded_data, + service_id=seeded_data["service_ids"]["ptax"], + ), + ) + body = json_of(response) + + assert_json_response(response, 201) + assert body["service_request"]["sr_number"] == 1 + assert choose_service_calls == [(1, "cfms-postman-operator", "chooseservice")] + assert snowplow_events == [] + + with app.app_context(): + from app.models.theq import Citizen, Service + + citizen_model = Citizen.find_citizen_by_id(citizen["citizen_id"]) + service = Service.query.filter_by(service_id=seeded_data["service_ids"]["ptax"]).first() + + assert citizen_model.cs.cs_state_name == "Active" + assert citizen_model.ticket_number.startswith(service.prefix) + assert re.fullmatch(rf"{re.escape(service.prefix)}\d+", citizen_model.ticket_number) + + +def test_additional_service_request_completes_the_previous_request_and_emits_transition_events( + internal_ga_client, seeded_data, app, monkeypatch +): + """Assert that adding a second service closes the active request and emits the stop/additional Snowplow events.""" + from app.resources.theq import service_requests_list as service_requests_module + + choose_service_calls = [] + snowplow_events = [] + monkeypatch.setattr( + service_requests_module.SnowPlow, + "choose_service", + staticmethod( + lambda service_request, csr, event: choose_service_calls.append( + (service_request.sr_number, event) + ) + ), + ) + monkeypatch.setattr( + service_requests_module.SnowPlow, + "snowplow_event", + staticmethod( + lambda citizen_id, csr, event, current_sr_number=None: snowplow_events.append( + (event, current_sr_number) + ) + ), + ) + + citizen, first_service = create_service_ready_citizen( + internal_ga_client, + seeded_data, + position=0, + name="Additional Service Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=1, + ) + choose_service_calls.clear() + snowplow_events.clear() + + response = internal_ga_client.post( + "/service_requests/", + json=_service_request_payload( + citizen["citizen_id"], + seeded_data, + service_id=seeded_data["service_ids"]["msp"], + channel_id_key="email", + ), + ) + body = json_of(response) + + assert_json_response(response, 201) + assert body["service_request"]["sr_number"] == 2 + assert choose_service_calls == [(2, "chooseservice")] + assert snowplow_events == [("stopservice", 1), ("additionalservice", 2)] + + with app.app_context(): + from app.models.theq import ServiceReq + + requests = ( + ServiceReq.query.filter_by(citizen_id=citizen["citizen_id"]) + .order_by(ServiceReq.sr_number) + .all() + ) + + assert first_service["sr_id"] == requests[0].sr_id + assert [request.sr_state.sr_code for request in requests] == ["Complete", "Active"] + assert requests[1].sr_number == 2 diff --git a/api/app/tests/flows/test_walkin_smartboard_flows.py b/api/app/tests/flows/test_walkin_smartboard_flows.py new file mode 100644 index 000000000..8f54b20b9 --- /dev/null +++ b/api/app/tests/flows/test_walkin_smartboard_flows.py @@ -0,0 +1,377 @@ +from __future__ import annotations + +import re +from datetime import datetime, timedelta, timezone + +import pytest +from app.tests.api_test_support import ( + assert_json_response, + create_queue_ready_citizen, + json_of, +) +from app.tests.auth.auth_support import create_walkin_target + +pytestmark = [pytest.mark.flows, pytest.mark.usefixtures("seeded_database")] + + +def _configure_office( + app, + office_id: int, + *, + currently_waiting: int | None = None, + automatic_reminder_at: int | None = None, +) -> int: + with app.app_context(): + from app.models.theq import Office + from qsystem import db + + office = Office.find_by_id(office_id) + if currently_waiting is not None: + office.currently_waiting = currently_waiting + if automatic_reminder_at is not None: + office.automatic_reminder_at = automatic_reminder_at + db.session.add(office) + db.session.commit() + return office.office_number + + +def _insert_current_agenda_panel_appointment(app, seeded_data) -> int: + with app.app_context(): + from app.models.bookings import Appointment + from qsystem import db + + start_time = datetime.now(timezone.utc).replace(microsecond=0) + timedelta( + minutes=5 + ) + appointment = Appointment( + office_id=seeded_data["office_ids"]["test_office"], + service_id=seeded_data["service_ids"]["ptax"], + start_time=start_time, + end_time=start_time + timedelta(minutes=30), + citizen_name="Agenda Panel Citizen", + contact_information="agenda@example.com", + blackout_flag="N", + is_draft=False, + stat_flag=False, + ) + db.session.add(appointment) + db.session.commit() + return appointment.appointment_id + + +def _configure_walkin_citizen( + app, + citizen_id: int, + *, + notification_phone: str | None = None, + notification_email: str | None = None, + start_position: int | None = None, + start_time: datetime | None = None, +): + with app.app_context(): + from app.models.theq import Citizen + from qsystem import db + + citizen = Citizen.find_citizen_by_id(citizen_id) + if notification_phone is not None: + citizen.notification_phone = notification_phone + if notification_email is not None: + citizen.notification_email = notification_email + if start_position is not None: + citizen.start_position = start_position + if start_time is not None: + citizen.start_time = start_time + db.session.add(citizen) + db.session.commit() + + +def _place_citizen_on_hold(internal_ga_client, citizen_id: int): + begin_response = internal_ga_client.post(f"/citizens/{citizen_id}/begin_service/") + hold_response = internal_ga_client.post(f"/citizens/{citizen_id}/place_on_hold/") + assert_json_response(begin_response, 200) + assert_json_response(hold_response, 200) + + +def test_walkin_lookup_groups_booked_agenda_and_walkin_entries( + bare_client, internal_ga_client, seeded_data, app +): + """Assert that walk-in lookups keep booked, agenda, and walk-in entries in frontend order.""" + create_queue_ready_citizen( + internal_ga_client, + seeded_data, + position=0, + name="Booked Queue Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=1, + counter_id_key="counter", + qt_xn_citizen_ind=0, + comments="booked|||appointment", + ) + target_citizen, walkin_id = create_walkin_target( + app, internal_ga_client, seeded_data + ) + _insert_current_agenda_panel_appointment(app, seeded_data) + + response = bare_client.get(f"/citizen/all-walkin/{walkin_id}/") + body = json_of(response) + + assert_json_response(response, 200) + assert [entry["flag"] for entry in body["citizen"]] == [ + "booked_app", + "agenda_panel", + "walkin_app", + ] + assert body["citizen"][0]["ticket_number"] + assert re.fullmatch( + r"\d{2}/\d{2}/\d{4}, \d{2}:\d{2}:\d{2}", body["citizen"][1]["start_time"] + ) + assert body["citizen"][2]["walkin_unique_id"] == walkin_id + assert body["show_estimate"] in {True, False} + assert target_citizen["citizen_id"] > 0 + + +def test_waiting_queue_details_group_booked_and_walkin_rows( + bare_client, internal_ga_client, seeded_data, app +): + """Assert that waiting queue details preserve the booked-then-walkin grouping the smartboard renders.""" + create_queue_ready_citizen( + internal_ga_client, + seeded_data, + position=0, + name="Booked Queue Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=1, + counter_id_key="counter", + qt_xn_citizen_ind=0, + comments="booked|||appointment", + ) + walkin_citizen, _walkin_id = create_walkin_target(app, internal_ga_client, seeded_data) + office_number = _configure_office( + app, seeded_data["office_ids"]["test_office"], currently_waiting=1 + ) + + response = bare_client.get(f"/smardboard/Q-details/waiting/{office_number}") + body = json_of(response) + + assert_json_response(response, 200) + assert [entry["flag"] for entry in body["citizen_in_q"]] == [ + "booked_app", + "walkin_app", + ] + assert body["citizen_in_q"][0]["service_name"] == "Property Tax" + assert body["citizen_in_q"][1]["citizen_id"] == walkin_citizen["citizen_id"] + + +def test_upcoming_queue_details_return_localized_agenda_panel_rows( + bare_client, seeded_data, app +): + """Assert that upcoming queue details expose agenda-panel rows in display-ready format.""" + office_number = _configure_office( + app, seeded_data["office_ids"]["test_office"], currently_waiting=1 + ) + _insert_current_agenda_panel_appointment(app, seeded_data) + + response = bare_client.get(f"/smardboard/Q-details/upcoming/{office_number}") + body = json_of(response) + + assert_json_response(response, 200) + assert len(body["booked_not_checkin"]) == 1 + assert body["booked_not_checkin"][0]["flag"] == "agenda_panel" + assert re.fullmatch( + r"\d{2}/\d{2}/\d{4}, \d{2}:\d{2}:\d{2}", + body["booked_not_checkin"][0]["start_time"], + ) + + +def test_smartboard_returns_waiting_tickets_and_active_periods( + bare_client, internal_ga_client, seeded_data, app +): + """Assert that the public smartboard response carries ticket numbers and waiting-state periods.""" + _citizen, _service_request, queued_citizen = create_queue_ready_citizen( + internal_ga_client, + seeded_data, + position=0, + name="Smartboard Citizen", + service_id_key="ptax", + channel_id_key="phone", + quantity=1, + counter_id_key="counter", + qt_xn_citizen_ind=0, + ) + office_number = _configure_office( + app, seeded_data["office_ids"]["test_office"], currently_waiting=1 + ) + + response = bare_client.get(f"/smartboard/?office_number={office_number}") + body = json_of(response) + + assert_json_response(response, 200) + waiting_entry = next( + citizen + for citizen in body["citizens"] + if citizen["ticket_number"] == queued_citizen["ticket_number"] + ) + assert waiting_entry["active_period"]["ps"]["ps_name"] == "Waiting" + + +def test_send_line_walkin_reminder_updates_notification_flags( + internal_ga_client, seeded_data, app, monkeypatch +): + """Assert that walk-in reminders flip the persisted reminder flags once the SMS path runs.""" + from app.resources.bookings.walkin import walkin as walkin_module + + monkeypatch.setattr( + walkin_module, "send_walkin_reminder_sms", lambda *args, **kwargs: True + ) + walkin_citizen, _walkin_id = create_walkin_target( + app, internal_ga_client, seeded_data + ) + _configure_office( + app, + seeded_data["office_ids"]["test_office"], + automatic_reminder_at=1, + ) + + response = internal_ga_client.post( + "/send-reminder/line-walkin/", + json={"previous_citizen_id": walkin_citizen["citizen_id"]}, + ) + + assert_json_response(response, 200) + + with app.app_context(): + from app.models.theq import Citizen + + citizen = Citizen.find_citizen_by_id(walkin_citizen["citizen_id"]) + assert citizen.automatic_reminder_flag == 1 + assert citizen.reminder_flag == 1 + assert citizen.notification_sent_time is not None + + +def test_walkin_lookup_includes_later_walkins_when_the_target_citizen_is_on_hold( + bare_client, internal_ga_client, seeded_data, app +): + """Assert that on-hold citizens continue to see later walk-ins in the lookup payload.""" + target_citizen, walkin_id = create_walkin_target(app, internal_ga_client, seeded_data) + later_citizen, later_walkin_id = create_walkin_target( + app, internal_ga_client, seeded_data + ) + _configure_walkin_citizen( + app, + later_citizen["citizen_id"], + start_time=datetime.now(timezone.utc) + timedelta(minutes=30), + ) + + initial_response = bare_client.get(f"/citizen/all-walkin/{walkin_id}/") + initial_walkin_ids = { + entry.get("walkin_unique_id") + for entry in json_of(initial_response)["citizen"] + if entry.get("flag") == "walkin_app" + } + assert later_walkin_id not in initial_walkin_ids + + _place_citizen_on_hold(internal_ga_client, target_citizen["citizen_id"]) + held_response = bare_client.get(f"/citizen/all-walkin/{walkin_id}/") + held_walkin_ids = { + entry.get("walkin_unique_id") + for entry in json_of(held_response)["citizen"] + if entry.get("flag") == "walkin_app" + } + + assert_json_response(held_response, 200) + assert later_citizen["citizen_id"] > 0 + assert later_walkin_id in held_walkin_ids + + +def test_send_line_walkin_reminder_skips_notifications_before_the_threshold_position( + internal_ga_client, seeded_data, app, monkeypatch +): + """Assert that reminder side effects stay off until a citizen reaches the configured threshold.""" + first_citizen, _first_walkin_id = create_walkin_target(app, internal_ga_client, seeded_data) + second_citizen, _second_walkin_id = create_walkin_target( + app, internal_ga_client, seeded_data + ) + _configure_walkin_citizen(app, second_citizen["citizen_id"], start_position=1) + _configure_office( + app, + seeded_data["office_ids"]["test_office"], + automatic_reminder_at=2, + ) + + monkeypatch.setattr( + "app.resources.bookings.walkin.walkin.send_walkin_reminder_sms", + lambda *args, **kwargs: (_ for _ in ()).throw( + AssertionError("SMS reminder should not have been sent") + ), + ) + monkeypatch.setattr( + "app.resources.bookings.walkin.walkin.send_email", + lambda *args, **kwargs: (_ for _ in ()).throw( + AssertionError("Email reminder should not have been sent") + ), + ) + + response = internal_ga_client.post( + "/send-reminder/line-walkin/", + json={"previous_citizen_id": first_citizen["citizen_id"]}, + ) + + assert_json_response(response, 200) + + with app.app_context(): + from app.models.theq import Citizen + + refreshed = Citizen.find_citizen_by_id(second_citizen["citizen_id"]) + assert refreshed.automatic_reminder_flag in {None, 0} + assert refreshed.reminder_flag in {None, 0} + assert refreshed.notification_sent_time is None + + +def test_send_line_walkin_reminder_uses_email_when_no_phone_number_is_available( + internal_ga_client, seeded_data, app, monkeypatch +): + """Assert that the email reminder branch updates the persisted flags when SMS is unavailable.""" + email_calls = [] + monkeypatch.setattr( + "app.resources.bookings.walkin.walkin.get_walkin_reminder_email_contents", + lambda citizen, office: ("walkin@example.com", "Reminder", "Body"), + ) + monkeypatch.setattr( + "app.resources.bookings.walkin.walkin.send_email", + lambda token, *args: email_calls.append((token, args)), + ) + + walkin_citizen, _walkin_id = create_walkin_target( + app, internal_ga_client, seeded_data + ) + _configure_walkin_citizen( + app, + walkin_citizen["citizen_id"], + notification_phone="", + notification_email="walkin@example.com", + start_position=1, + ) + _configure_office( + app, + seeded_data["office_ids"]["test_office"], + automatic_reminder_at=1, + ) + + response = internal_ga_client.post( + "/send-reminder/line-walkin/", + json={"previous_citizen_id": walkin_citizen["citizen_id"]}, + ) + + assert_json_response(response, 200) + assert len(email_calls) == 1 + assert email_calls[0][0] == "theq-test-token" + + with app.app_context(): + from app.models.theq import Citizen + + citizen = Citizen.find_citizen_by_id(walkin_citizen["citizen_id"]) + assert citizen.automatic_reminder_flag == 1 + assert citizen.reminder_flag == 1 + assert citizen.notification_sent_time is not None diff --git a/api/app/tests/helpers/__init__.py b/api/app/tests/helpers/__init__.py new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/api/app/tests/helpers/__init__.py @@ -0,0 +1 @@ + diff --git a/api/app/tests/helpers/appointments.py b/api/app/tests/helpers/appointments.py new file mode 100644 index 000000000..4ec17fd65 --- /dev/null +++ b/api/app/tests/helpers/appointments.py @@ -0,0 +1,71 @@ +from __future__ import annotations + +from datetime import datetime, timedelta +from zoneinfo import ZoneInfo + +from app.tests.api_test_support import ( + assert_json_response, + create_public_user, + future_utc_window, + json_of, + unique_name, +) + + +def align_current_pacific_time_for_appointment( + monkeypatch, appointment_start_time: str, timezone_name: str +): + appointment_local = datetime.fromisoformat( + appointment_start_time.replace("Z", "+00:00") + ).astimezone(ZoneInfo(timezone_name)) + now_local = appointment_local - timedelta(days=1) + monkeypatch.setattr( + "app.models.bookings.appointments.current_pacific_time", lambda: now_local + ) + + +def configure_public_user_reminders( + public_client, + *, + email: str, + telephone: str | None = None, + send_email_reminders: bool = False, + send_sms_reminders: bool = False, +) -> dict: + user = create_public_user(public_client) + response = public_client.put( + f"/users/{user['user_id']}/", + json={ + "email": email, + "telephone": telephone, + "send_email_reminders": send_email_reminders, + "send_sms_reminders": send_sms_reminders, + }, + ) + assert_json_response(response, 200) + return json_of(response)[0] + + +def create_internal_reminder_appointment( + api_client, + seeded_data, + *, + contact_information: str, + days_from_now: int = 2, + citizen_name: str = "Reminder Appointment", +) -> dict: + start_time, end_time = future_utc_window(days_from_now) + response = api_client.post( + "/appointments/", + json={ + "service_id": seeded_data["service_ids"]["msp"], + "office_id": seeded_data["office_ids"]["test_office"], + "start_time": start_time, + "end_time": end_time, + "comments": "Reminder coverage", + "citizen_name": unique_name(citizen_name), + "contact_information": contact_information, + }, + ) + assert_json_response(response, 201) + return json_of(response)["appointment"] diff --git a/api/app/tests/helpers/exams.py b/api/app/tests/helpers/exams.py new file mode 100644 index 000000000..d80f2e0a8 --- /dev/null +++ b/api/app/tests/helpers/exams.py @@ -0,0 +1,30 @@ +from __future__ import annotations + + +def seed_exam_bcmp_job(app, exam_id: int, *, bcmp_job_id: str, upload_received_ind: int): + with app.app_context(): + from app.models.bookings import Exam + from qsystem import db + + exam = Exam.query.filter_by(exam_id=exam_id).first() + exam.bcmp_job_id = bcmp_job_id + exam.upload_received_ind = upload_received_ind + db.session.add(exam) + db.session.commit() + return exam.exam_id + + +def exam_upload_received_ind(app, exam_id: int) -> int | None: + with app.app_context(): + from app.models.bookings import Exam + + exam = Exam.query.filter_by(exam_id=exam_id).first() + return exam.upload_received_ind + + +def exam_invigilator_id(app, exam_id: int) -> int | None: + with app.app_context(): + from app.models.bookings import Exam + + exam = Exam.query.filter_by(exam_id=exam_id).first() + return exam.invigilator_id diff --git a/api/app/tests/test.py b/api/app/tests/test.py deleted file mode 100644 index cf747fc27..000000000 --- a/api/app/tests/test.py +++ /dev/null @@ -1,40 +0,0 @@ -import json -import os -import tempfile -import unittest - -from qsystem import db, application -from app.models import theq -from app.schemas.theq import ServiceReqSchema - - -class QSystemTestCase(unittest.TestCase): - - def setUp(self): - self.db_fd, application.config['DATABASE'] = tempfile.mkstemp() - application.testing = True - self.app = application.test_client() - - with application.app_context(): - db.init_app(application) - db.drop_all() - db.create_all() - - def test_create_edit_delete_note(self): - with application.app_context(): - service_request_schema = ServiceReqSchema() - - json_data = {'service_id': 12, 'citizen_id': '', 'quantity': 3, 'channel_id': 2} - - service_request = service_request_schema.load(json_data) - - # Confirm a marshmallow bug, returns a dict when invalid data passed in. - assert type(service_request) is dict - - - def tearDown(self): - os.close(self.db_fd) - os.unlink(application.config['DATABASE']) - -if __name__ == '__main__': - unittest.main() diff --git a/api/app/tests/test_availability_service.py b/api/app/tests/test_availability_service.py new file mode 100644 index 000000000..3ea0ebe1b --- /dev/null +++ b/api/app/tests/test_availability_service.py @@ -0,0 +1,248 @@ +from __future__ import annotations + +from dataclasses import dataclass +from datetime import datetime, time, timedelta, timezone +import importlib +from zoneinfo import ZoneInfo + +import pytest +from app.utilities.yesno import YesNo + +pytestmark = [pytest.mark.flows, pytest.mark.integration] + + +@dataclass +class FakeTimezone: + timezone_name: str + + +@dataclass +class FakeTimeslot: + day_of_week: list[str] + start_time: time + end_time: time + no_of_slots: int + + +@dataclass +class FakeService: + is_dlkt: object = None + timeslot_duration: int | None = None + + +@dataclass +class FakeOffice: + office_id: int + timezone: FakeTimezone + timeslots: list[FakeTimeslot] + appointments_enabled_ind: int = 1 + appointment_duration: int = 30 + soonest_appointment: int = 0 + number_of_dlkt: int = 0 + + +@dataclass +class FakeAppointment: + start_time: datetime + end_time: datetime + blackout_flag: str = "N" + stat_flag: bool = False + service: FakeService | None = None + + +def _freeze_now(monkeypatch, frozen_now: datetime): + availability_module = importlib.import_module("app.services.availability_service") + + class FrozenDateTime(datetime): + @classmethod + def now(cls, tz=None): + if tz is None: + return frozen_now + return frozen_now.astimezone(tz) + + monkeypatch.setattr(availability_module.datetime, "datetime", FrozenDateTime) + + +def _patch_appointments(monkeypatch, appointments: list[FakeAppointment]): + availability_module = importlib.import_module("app.services.availability_service") + monkeypatch.setattr( + availability_module.Appointment, + "find_appointment_availability", + lambda **kwargs: appointments, + ) + + +def _local_day(year: int, month: int, day: int, timezone_name: str) -> datetime: + return datetime(year, month, day, tzinfo=ZoneInfo(timezone_name)) + + +def _office( + *, + timezone_name: str = "America/Vancouver", + day_names: list[str] | None = None, + start_hour: int = 9, + end_hour: int = 12, + no_of_slots: int = 1, + appointment_duration: int = 30, + soonest_appointment: int = 0, + number_of_dlkt: int = 0, +) -> FakeOffice: + if day_names is None: + day_names = ["Wednesday"] + return FakeOffice( + office_id=1, + timezone=FakeTimezone(timezone_name), + timeslots=[ + FakeTimeslot( + day_of_week=day_names, + start_time=time(start_hour, 0), + end_time=time(end_hour, 0), + no_of_slots=no_of_slots, + ) + ], + appointment_duration=appointment_duration, + soonest_appointment=soonest_appointment, + number_of_dlkt=number_of_dlkt, + ) + + +def test_group_appointments_keeps_local_times_across_dst_boundaries(app): + """Assert that grouped appointment rows preserve local wall-clock times across DST changes.""" + del app + AvailabilityService = importlib.import_module( + "app.services.availability_service" + ).AvailabilityService + appointments = [ + FakeAppointment( + start_time=datetime(2024, 3, 10, 9, 30, tzinfo=timezone.utc), + end_time=datetime(2024, 3, 10, 10, 0, tzinfo=timezone.utc), + ), + FakeAppointment( + start_time=datetime(2024, 3, 10, 10, 30, tzinfo=timezone.utc), + end_time=datetime(2024, 3, 10, 11, 0, tzinfo=timezone.utc), + ), + ] + + grouped = AvailabilityService.group_appointments(appointments, "America/Vancouver") + + assert "03/10/2024" in grouped + assert [slot["start_time"].strftime("%H:%M") for slot in grouped["03/10/2024"]] == [ + "01:30", + "03:30", + ] + + +def test_get_available_slots_respects_soonest_appointment_cutoffs(app, monkeypatch): + """Assert that slots earlier than the office soonest-appointment window are suppressed.""" + del app + AvailabilityService = importlib.import_module( + "app.services.availability_service" + ).AvailabilityService + _freeze_now(monkeypatch, datetime(2024, 7, 10, 9, 0, tzinfo=timezone.utc)) + _patch_appointments(monkeypatch, []) + + office = _office(timezone_name="UTC", soonest_appointment=90) + slots = AvailabilityService.get_available_slots( + office, + [_local_day(2024, 7, 10, office.timezone.timezone_name)], + ) + + assert [slot["start_time"] for slot in slots["07/10/2024"]] == [ + "10:30", + "11:00", + "11:30", + ] + + +def test_get_available_slots_prunes_blackout_rows(app, monkeypatch): + """Assert that blackout appointments remove conflicting slots from the availability map.""" + del app + AvailabilityService = importlib.import_module( + "app.services.availability_service" + ).AvailabilityService + _freeze_now(monkeypatch, datetime(2024, 7, 10, 8, 0, tzinfo=timezone.utc)) + _patch_appointments( + monkeypatch, + [ + FakeAppointment( + start_time=datetime(2024, 7, 10, 10, 0, tzinfo=timezone.utc), + end_time=datetime(2024, 7, 10, 10, 30, tzinfo=timezone.utc), + blackout_flag="Y", + ) + ], + ) + + office = _office(timezone_name="UTC", end_hour=11, no_of_slots=1) + slots = AvailabilityService.get_available_slots( + office, + [_local_day(2024, 7, 10, office.timezone.timezone_name)], + ) + + assert [slot["start_time"] for slot in slots["07/10/2024"]] == [ + "09:00", + "09:30", + "10:30", + ] + + +def test_has_available_slots_rejects_overlaps_but_allows_open_following_windows( + app, monkeypatch +): + """Assert that conflict checks fail for occupied windows and pass for later open windows.""" + del app + AvailabilityService = importlib.import_module( + "app.services.availability_service" + ).AvailabilityService + _freeze_now(monkeypatch, datetime(2024, 7, 10, 8, 0, tzinfo=timezone.utc)) + _patch_appointments( + monkeypatch, + [ + FakeAppointment( + start_time=datetime(2024, 7, 10, 9, 0, tzinfo=timezone.utc), + end_time=datetime(2024, 7, 10, 10, 0, tzinfo=timezone.utc), + ) + ], + ) + + office = _office( + timezone_name="UTC", end_hour=11, no_of_slots=1, appointment_duration=60 + ) + service = FakeService() + + blocked = AvailabilityService.has_available_slots( + office, + datetime(2024, 7, 10, 9, 30, tzinfo=timezone.utc), + datetime(2024, 7, 10, 9, 45, tzinfo=timezone.utc), + service, + ) + open_window = AvailabilityService.has_available_slots( + office, + datetime(2024, 7, 10, 10, 0, tzinfo=timezone.utc), + datetime(2024, 7, 10, 10, 30, tzinfo=timezone.utc), + service, + ) + + assert blocked is False + assert open_window is True + + +def test_get_available_slots_caps_dlkt_capacity_to_the_office_limit( + app, monkeypatch +): + """Assert that DLKT availability honors the office-specific DLKT cap per slot.""" + del app + AvailabilityService = importlib.import_module( + "app.services.availability_service" + ).AvailabilityService + _freeze_now(monkeypatch, datetime(2024, 7, 10, 8, 0, tzinfo=timezone.utc)) + _patch_appointments(monkeypatch, []) + + office = _office(timezone_name="UTC", no_of_slots=3, number_of_dlkt=1) + dlkt_service = FakeService(is_dlkt=YesNo.YES) + slots = AvailabilityService.get_available_slots( + office, + [_local_day(2024, 7, 10, office.timezone.timezone_name)], + service=dlkt_service, + ) + + assert {slot["no_of_slots"] for slot in slots["07/10/2024"]} == {1} diff --git a/api/app/tests/test_config.py b/api/app/tests/test_config.py new file mode 100644 index 000000000..3332af1da --- /dev/null +++ b/api/app/tests/test_config.py @@ -0,0 +1,45 @@ +import importlib + +import pytest +from sqlalchemy.engine import make_url + +pytestmark = [pytest.mark.smoke] + + +CONFIG_ENV_VARS = ( + "DATABASE_ENGINE", + "DATABASE_USERNAME", + "DATABASE_PASSWORD", + "DATABASE_HOST", + "DATABASE_PORT", + "DATABASE_NAME", +) + + +def _reload_config_module(): + config_module = importlib.import_module("config") + return importlib.reload(config_module) + + +def test_development_config_encodes_database_password_special_characters(): + with pytest.MonkeyPatch.context() as monkeypatch: + for key in CONFIG_ENV_VARS: + monkeypatch.delenv(key, raising=False) + + monkeypatch.setenv("DATABASE_ENGINE", "postgres") + monkeypatch.setenv("DATABASE_USERNAME", "queue_user") + monkeypatch.setenv("DATABASE_PASSWORD", "abc@123") + monkeypatch.setenv("DATABASE_HOST", "db.internal") + monkeypatch.setenv("DATABASE_PORT", "5432") + monkeypatch.setenv("DATABASE_NAME", "queue_db") + + config_module = _reload_config_module() + uri = config_module.DevelopmentConfig.SQLALCHEMY_DATABASE_URI + parsed = make_url(uri) + + assert "%40" in uri + assert parsed.password == "abc@123" + assert parsed.host == "db.internal" + assert parsed.drivername == "postgresql+psycopg2" + + _reload_config_module() diff --git a/api/app/tests/test_flask3_admin.py b/api/app/tests/test_flask3_admin.py new file mode 100644 index 000000000..32945adc6 --- /dev/null +++ b/api/app/tests/test_flask3_admin.py @@ -0,0 +1,121 @@ +import inspect +from types import SimpleNamespace + +import pytest +from app.utilities.flask_admin_compat import apply_wtforms_compat +from flask_admin.contrib.sqla.fields import QuerySelectField +from flask_admin.contrib.sqla.validators import Unique +from flask_admin.form.fields import Select2Field +from flask_admin.form.validators import FieldListInputRequired +from wtforms import Form +from wtforms.fields import SelectFieldBase + + +def _unwrap(func): + return inspect.unwrap(func) + + +def test_application_url_map_contains_admin_and_healthz(app): + """Assert that the Flask 3 app still exposes the admin and health routes.""" + routes = {rule.rule for rule in app.url_map.iter_rules()} + + assert "/admin/" in routes + assert "/api/v1/healthz/" in routes + + +def test_admin_index_renders_without_bootstrap3_assets(client): + """Assert that the admin index renders without legacy Bootstrap 3 assets.""" + response = client.get("/admin/") + + assert response.status_code == 200 + + body = response.get_data(as_text=True) + + assert "Admin Console" in body + assert "bootstrap3" not in body + + +def test_login_resource_redirects_authenticated_users_to_admin(app, monkeypatch): + """Assert that authenticated login requests still redirect to the admin console.""" + from app.resources.theq import login as login_module + + fake_csr = SimpleNamespace(username="tester") + logged_in = [] + + monkeypatch.setattr(login_module, "get_username", lambda: "tester@idir") + monkeypatch.setattr(login_module.CSR, "find_by_username", lambda username: fake_csr) + monkeypatch.setattr(login_module, "login_user", lambda user: logged_in.append(user)) + + handler = _unwrap(login_module.Login.get) + + with app.test_request_context("/api/v1/login/"): + response = handler(login_module.Login()) + + assert logged_in == [fake_csr] + assert response.status_code == 302 + assert response.location.endswith("/admin/") + + +def test_apply_wtforms_compat_normalizes_legacy_tuple_flags(): + """Assert that legacy tuple-style field flags are normalized for WTForms 3.""" + FieldListInputRequired.field_flags = ("required",) + Unique.field_flags = ("unique",) + + apply_wtforms_compat() + + assert FieldListInputRequired.field_flags == {"required": True} + assert Unique.field_flags == {"unique": True} + + +def test_apply_wtforms_compat_normalizes_select2_iter_choices(): + """Assert that Select2 fields yield WTForms 3-compatible choice tuples.""" + + class TestForm(Form): + status = Select2Field(choices=[("1", "Active")]) + + apply_wtforms_compat() + + form = TestForm() + + assert list(form.status.iter_choices()) == [("1", "Active", False, {})] + + +def test_apply_wtforms_compat_normalizes_query_select_iter_choices(): + """Assert that query-backed select fields yield WTForms 3-compatible choice tuples.""" + + class Choice: + def __init__(self, identifier, label): + self.identifier = identifier + self.label = label + + class TestForm(Form): + role = QuerySelectField( + query_factory=lambda: [Choice(1, "CSR")], + get_pk=lambda obj: obj.identifier, + get_label=lambda obj: obj.label, + ) + + apply_wtforms_compat() + + form = TestForm() + + assert list(form.role.iter_choices()) == [("1", "CSR", False, {})] + + +def test_apply_wtforms_compat_allows_legacy_select_widgets_to_render(): + """Assert that legacy select widgets still render after the compatibility patch is applied.""" + + class LegacySelectField(SelectFieldBase): + widget = Select2Field.widget + + def iter_choices(self): + yield ("1", "Active", False) + + class TestForm(Form): + status = LegacySelectField() + + apply_wtforms_compat() + + form = TestForm() + + assert 'option value="1"' in form.status() diff --git a/api/app/tests/test_notification.py b/api/app/tests/test_notification.py new file mode 100644 index 000000000..6a55b3c3d --- /dev/null +++ b/api/app/tests/test_notification.py @@ -0,0 +1,40 @@ +import pytest +from app.utilities.notification_email import send_email +from flask import Flask + +pytestmark = pytest.mark.smoke + + +def test_send_email_posts_json_payload_with_timeout(monkeypatch): + """Assert that notification emails are sent as JSON with the expected auth header and timeout.""" + app = Flask(__name__) + app.config["NOTIFICATIONS_EMAIL_ENDPOINT"] = "https://example.com/email" + + recorded = {} + + class Response: + def raise_for_status(self): + return None + + def fake_post(url, headers=None, json=None, timeout=None): + recorded["url"] = url + recorded["headers"] = headers + recorded["json"] = json + recorded["timeout"] = timeout + return Response() + + monkeypatch.setattr("app.utilities.notification_email.requests.post", fake_post) + + with app.app_context(): + send_email( + "token-123", + "Subject", + "citizen@example.com", + "noreply@example.com", + "

Hello

", + ) + + assert recorded["url"] == "https://example.com/email" + assert recorded["headers"]["Authorization"] == "Bearer token-123" + assert recorded["json"]["subject"] == "Subject" + assert recorded["timeout"] == 30 diff --git a/api/app/tests/test_schema_compatibility.py b/api/app/tests/test_schema_compatibility.py new file mode 100644 index 000000000..071962516 --- /dev/null +++ b/api/app/tests/test_schema_compatibility.py @@ -0,0 +1,295 @@ +import ast +import importlib +import inspect +import pkgutil +import sys +from datetime import datetime, timezone + +import pytest + + +def _schema_classes(): + import app.schemas as schema_package + from app.schemas import BaseSchema + + schema_classes = [] + for _, module_name, _ in pkgutil.walk_packages( + schema_package.__path__, prefix=f"{schema_package.__name__}." + ): + module = importlib.import_module(module_name) + for value in module.__dict__.values(): + if ( + inspect.isclass(value) + and issubclass(value, BaseSchema) + and value is not BaseSchema + and value.__module__ == module_name + ): + schema_classes.append(value) + + return sorted(schema_classes, key=lambda schema_cls: schema_cls.__name__) + + +def test_all_schema_classes_instantiate(app, seeded_database): + """Assert that every Marshmallow schema class still instantiates with fields.""" + del seeded_database + + with app.app_context(): + schema_classes = _schema_classes() + assert schema_classes + + for schema_cls in schema_classes: + schema = schema_cls() + assert schema.fields + + +def test_schema_validate_is_safe_for_orm_objects(app, seeded_data): + """Assert that schema validation still accepts ORM instances under Marshmallow 4.""" + with app.app_context(): + from app.models.theq import Citizen, Service + from app.schemas.theq import CitizenSchema, ServiceSchema + from app.utilities.yesno import YesNo + + service = Service( + service_id=1002, + service_code="VALIDATE", + service_name="Validate Service", + service_desc="Validate service", + prefix="VL", + display_dashboard_ind=1, + actual_service_ind=1, + is_dlkt=YesNo.NO, + ) + citizens = Citizen.query.limit(2).all() + + assert ServiceSchema().validate(service) == {} + assert CitizenSchema(many=True).validate(citizens) == {} + + +def test_service_schema_serializes_parent_name(app, seeded_data): + """Assert that services still serialize parent names and DLKT flags correctly.""" + del seeded_data + + with app.app_context(): + from app.models.theq import Service + from app.schemas.theq import ServiceSchema + from app.utilities.yesno import YesNo + + parent = Service( + service_id=1000, + service_code="PARENT", + service_name="Parent Service", + service_desc="Parent service", + prefix="PR", + display_dashboard_ind=1, + actual_service_ind=1, + ) + service = Service( + service_id=1001, + service_code="CHILD", + service_name="Child Service", + service_desc="Child service", + prefix="CH", + display_dashboard_ind=1, + actual_service_ind=1, + is_dlkt=YesNo.YES, + parent=parent, + ) + + dumped = ServiceSchema().dump(service) + + assert dumped["parent"] == {"service_name": "Parent Service"} + assert dumped["is_dlkt"] is True + + +def test_exam_schema_uses_iso_exam_received_date_format(app, seeded_data): + """Assert that exam received dates use Marshmallow's normal ISO contract.""" + with app.app_context(): + from app.models.bookings import Exam, ExamType, Invigilator + from app.models.theq import Office + from app.schemas.bookings import ExamSchema + from qsystem import db + + office = db.session.get(Office, seeded_data["office_ids"]["test_office"]) + exam_type = db.session.get(ExamType, seeded_data["exam_type_id"]) + invigilator = db.session.get(Invigilator, seeded_data["invigilator_ids"][0]) + + exam = Exam( + exam_id=2001, + office_id=office.office_id, + office=office, + exam_type_id=exam_type.exam_type_id, + exam_type=exam_type, + invigilator_id=invigilator.invigilator_id, + invigilator=invigilator, + exam_name="Knowledge Test", + exam_method="paper", + exam_received_date=datetime(2026, 3, 25, 12, 30, tzinfo=timezone.utc), + exam_written_ind=0, + ) + exam.exam_received = 1 + exam.exam_returned_ind = 0 + exam.receipt_number = "R-001" + exam.fees = "10.00" + + dumped = ExamSchema().dump(exam) + + assert dumped["exam_received_date"] == "2026-03-25T12:30:00+00:00" + + +def test_exam_schema_accepts_iso_exam_received_date_inputs(app, seeded_data): + """Assert that frontend ISO offset dates load without strict literal-Z parsing.""" + with app.app_context(): + from app.schemas.bookings import ExamSchema + + base_payload = { + "exam_method": "paper", + "expiry_date": "2026-05-22T07:00:00+00:00", + "exam_type_id": seeded_data["exam_type_id"], + "event_id": "test1234887", + "exam_name": "test exam", + "examinee_name": "test candidate", + "notes": "test notes", + "office_id": seeded_data["office_ids"]["test_office"], + "payee_ind": 0, + "receipt_sent_ind": 0, + "sbc_managed_ind": 0, + "exam_returned_ind": 0, + "exam_written_ind": 0, + "number_of_students": 1, + } + + offset_exam = ExamSchema().load( + { + **base_payload, + "exam_received_date": "2026-04-17T07:00:00+00:00", + } + ) + z_exam = ExamSchema().load( + { + **base_payload, + "exam_received_date": "2026-04-17T07:00:00Z", + } + ) + + assert offset_exam.exam_received_date.isoformat() == ( + "2026-04-17T07:00:00+00:00" + ) + assert z_exam.exam_received_date.isoformat() == "2026-04-17T07:00:00+00:00" + + +def test_no_schema_explicitly_uses_strict_literal_z_datetime_format(app, seeded_database): + """Assert DateTime fields do not opt into literal-Z-only parsing.""" + del seeded_database + + with app.app_context(): + strict_fields = [] + for schema_cls in _schema_classes(): + source = inspect.getsource(sys.modules[schema_cls.__module__]) + tree = ast.parse(source) + for node in ast.walk(tree): + if not isinstance(node, ast.Call): + continue + if not ( + isinstance(node.func, ast.Attribute) + and node.func.attr == "DateTime" + and isinstance(node.func.value, ast.Name) + and node.func.value.id == "fields" + ): + continue + for keyword in node.keywords: + if ( + keyword.arg == "format" + and isinstance(keyword.value, ast.Constant) + and keyword.value.value == "%Y-%m-%dT%H:%M:%SZ" + ): + strict_fields.append(f"{schema_cls.__module__}:{node.lineno}") + + assert strict_fields == [] + + +def test_booking_schema_post_dump_supports_single_and_many(app, seeded_data): + """Assert that booking post-dump hooks normalize invigilators for single and many dumps.""" + with app.app_context(): + from app.models.bookings import Booking, Invigilator, Room + from app.models.theq import Office + from app.schemas.bookings import BookingSchema + from qsystem import db + + office = db.session.get(Office, seeded_data["office_ids"]["test_office"]) + room = db.session.get(Room, seeded_data["room_id"]) + invigilators = [ + db.session.get(Invigilator, invigilator_id) + for invigilator_id in seeded_data["invigilator_ids"][:2] + ] + + booking = Booking( + booking_id=3001, + office_id=office.office_id, + office=office, + room_id=room.room_id, + room=room, + start_time=datetime(2026, 3, 25, 16, 0, tzinfo=timezone.utc), + end_time=datetime(2026, 3, 25, 17, 0, tzinfo=timezone.utc), + booking_name="Board Meeting", + sbc_staff_invigilated=0, + stat_flag=False, + invigilators=invigilators, + ) + + schema = BookingSchema() + dumped_single = schema.dump(booking) + dumped_many = schema.dump([booking], many=True) + + expected_invigilators = [ + invigilator.invigilator_id for invigilator in invigilators + ] + assert dumped_single["invigilators"] == expected_invigilators + assert dumped_many[0]["invigilators"] == expected_invigilators + + +def test_csr_schema_post_dump_supports_single_and_many(app, seeded_data): + """Assert that CSR post-dump hooks preserve the counter alias for single and many dumps.""" + del seeded_data + + with app.app_context(): + from app.models.theq import CSR + from app.schemas.theq import CSRSchema + + csrs = CSR.query.order_by(CSR.csr_id).limit(2).all() + assert len(csrs) == 2 + + schema = CSRSchema() + dumped_single = schema.dump(csrs[0]) + dumped_many = schema.dump(csrs, many=True) + + assert dumped_single["counter"] == dumped_single["counter_id"] + assert [csr["counter"] for csr in dumped_many] == [ + csr["counter_id"] for csr in dumped_many + ] + + +def test_appointment_availability_schema_smoke(app, seeded_data): + """Assert that appointment availability schema dumps the core slot fields needed by the API.""" + with app.app_context(): + from app.models.bookings import Appointment + from app.schemas.bookings.appointment_availability_schema import ( + AppointmentAvailabilitySchema, + ) + + appointment = Appointment( + appointment_id=4001, + office_id=seeded_data["office_ids"]["test_office"], + service_id=seeded_data["service_ids"]["msp"], + citizen_id=1234, + start_time=datetime(2026, 3, 25, 18, 0, tzinfo=timezone.utc), + end_time=datetime(2026, 3, 25, 18, 30, tzinfo=timezone.utc), + citizen_name="Pat Citizen", + blackout_flag="N", + ) + + dumped = AppointmentAvailabilitySchema().dump(appointment) + + assert dumped["appointment_id"] == 4001 + assert dumped["office_id"] == seeded_data["office_ids"]["test_office"] + assert dumped["service_id"] == seeded_data["service_ids"]["msp"] + assert dumped["citizen_name"] == "Pat Citizen" diff --git a/api/app/tests/test_sqlalchemy.py b/api/app/tests/test_sqlalchemy.py new file mode 100644 index 000000000..4cdc0d820 --- /dev/null +++ b/api/app/tests/test_sqlalchemy.py @@ -0,0 +1,168 @@ +from datetime import datetime, timedelta, timezone + +import pytest +from sqlalchemy import text + +def test_app_boots_with_disposable_postgres(app, postgres_database): + """Assert that the Flask app boots against the disposable Postgres database.""" + assert app.config["SQLALCHEMY_DATABASE_URI"] == postgres_database["database_uri"] + + with app.app_context(): + assert app.extensions["sqlalchemy"] + + +def test_db_current_command_runs(cli_runner): + """Assert that the Alembic current command runs successfully in the test harness.""" + result = cli_runner.invoke(args=["db", "current"]) + + assert result.exit_code == 0, result.output + + +def test_db_upgrade_command_runs(migrated_database): + """Assert that database migrations upgrade cleanly in the smoke suite.""" + assert migrated_database.exit_code == 0, migrated_database.output + + +def test_healthz_uses_database_connection(client, migrated_database): + """Assert that the health endpoint confirms a working database connection.""" + response = client.get("/api/v1/healthz/") + + assert response.status_code == 200 + assert response.get_json() == {"message": "api is healthy"} + + +def test_appointment_crud_and_version_rows(app, db, migrated_database): + """Assert that appointment CRUD still writes versioning and transaction rows.""" + from app.models.bookings import Appointment + from app.models.theq.office import Office + from app.models.theq.smartboard import SmartBoard + from app.models.theq.timezone import Timezone + + with app.app_context(): + smartboard = SmartBoard(sb_type="callbyticket") + timezone_row = Timezone(timezone_name="Canada/Pacific") + db.session.add_all([smartboard, timezone_row]) + db.session.commit() + + office = Office( + office_name="SQLAlchemy Smoke Office", + office_number=9999, + sb_id=smartboard.sb_id, + exams_enabled_ind=0, + appointments_enabled_ind=1, + timezone_id=timezone_row.timezone_id, + ) + db.session.add(office) + db.session.commit() + + appointment = Appointment( + office_id=office.office_id, + start_time=datetime.now(timezone.utc), + end_time=datetime.now(timezone.utc) + timedelta(minutes=30), + citizen_name="Smoke Test Citizen", + contact_information="smoke@example.com", + ) + db.session.add(appointment) + db.session.commit() + + appointment.comments = "updated by smoke suite" + db.session.add(appointment) + db.session.commit() + + db.session.delete(appointment) + db.session.commit() + + version_count = db.session.execute( + text( + "SELECT COUNT(*) FROM appointment_version WHERE appointment_id = :appointment_id" + ), + {"appointment_id": appointment.appointment_id}, + ).scalar_one() + transaction_count = db.session.execute( + text("SELECT COUNT(*) FROM transaction") + ).scalar_one() + + assert version_count >= 2 + assert transaction_count >= 2 + + +def test_local_utc_type_round_trips_booking_appointment_and_citizen( + app, db, migrated_database +): + """Assert that LocalUTC-backed columns round-trip as UTC-aware datetimes.""" + from app.models.bookings import Appointment, Booking, Room + from app.models.theq.citizen import Citizen + from app.models.theq.citizen_state import CitizenState + from app.models.theq.office import Office + from app.models.theq.smartboard import SmartBoard + from app.models.theq.timezone import Timezone + + with app.app_context(): + smartboard = SmartBoard(sb_type="callbyticket") + timezone_row = Timezone(timezone_name="Canada/Pacific") + citizen_state = CitizenState(cs_state_name="Waiting", cs_state_desc="Waiting") + db.session.add_all([smartboard, timezone_row, citizen_state]) + db.session.commit() + + office = Office( + office_name="UTC Smoke Office", + office_number=9998, + sb_id=smartboard.sb_id, + exams_enabled_ind=0, + appointments_enabled_ind=1, + timezone_id=timezone_row.timezone_id, + ) + db.session.add(office) + db.session.commit() + + room = Room( + office_id=office.office_id, + room_name="UTC Smoke Room", + capacity=4, + color="blue", + ) + db.session.add(room) + db.session.commit() + + booking = Booking( + office_id=office.office_id, + room_id=room.room_id, + start_time=datetime(2026, 3, 25, 16, 0, tzinfo=timezone.utc), + end_time=datetime(2026, 3, 25, 17, 0, tzinfo=timezone.utc), + ) + citizen = Citizen( + office_id=office.office_id, + cs_id=citizen_state.cs_id, + start_time=datetime(2026, 3, 25, 15, 30, tzinfo=timezone.utc), + ) + appointment = Appointment( + office_id=office.office_id, + start_time=datetime(2026, 3, 25, 18, 0, tzinfo=timezone.utc), + end_time=datetime(2026, 3, 25, 18, 30, tzinfo=timezone.utc), + citizen_name="UTC Smoke Citizen", + contact_information="utc@example.com", + ) + db.session.add_all([booking, citizen, appointment]) + db.session.commit() + + appointment.comments = "updated" + db.session.add(appointment) + db.session.commit() + + booking_id = booking.booking_id + citizen_id = citizen.citizen_id + appointment_id = appointment.appointment_id + + db.session.expunge_all() + + saved_booking = db.session.get(Booking, booking_id) + saved_citizen = db.session.get(Citizen, citizen_id) + saved_appointment = db.session.get(Appointment, appointment_id) + + assert saved_booking.start_time.utcoffset().total_seconds() == 0 + assert saved_booking.end_time.utcoffset().total_seconds() == 0 + assert saved_citizen.created_at.utcoffset().total_seconds() == 0 + assert saved_appointment.start_time.utcoffset().total_seconds() == 0 + assert saved_appointment.end_time.utcoffset().total_seconds() == 0 + assert saved_appointment.created_at.utcoffset().total_seconds() == 0 + assert saved_appointment.updated_at.utcoffset().total_seconds() == 0 diff --git a/api/app/tests/test_timezone_helpers.py b/api/app/tests/test_timezone_helpers.py new file mode 100644 index 000000000..42f3be9fe --- /dev/null +++ b/api/app/tests/test_timezone_helpers.py @@ -0,0 +1,49 @@ +from datetime import datetime + +import pytest +from app.utilities.date_util import add_delta_to_time, current_pacific_time +from app.utilities.sqlalchemy_compat import utcnow +from app.utilities.timezone_utils import as_utc, get_timezone, localize + +pytestmark = pytest.mark.smoke + + +def test_localize_preserves_dst_offset_for_vancouver(): + """Assert that Vancouver localization keeps the pre-DST offset for naive wall times.""" + localized = localize(datetime(2026, 3, 8, 1, 30), "America/Vancouver") + + assert localized.tzinfo == get_timezone("America/Vancouver") + assert localized.utcoffset().total_seconds() == -8 * 3600 + + +def test_as_utc_marks_naive_datetimes_as_utc(): + """Assert that naive datetimes are treated as UTC by the compatibility helper.""" + converted = as_utc(datetime(2026, 3, 8, 9, 30)) + + assert converted.utcoffset().total_seconds() == 0 + assert converted.isoformat() == "2026-03-08T09:30:00+00:00" + + +def test_add_delta_to_time_returns_zoneinfo_backed_time(): + """Assert that time arithmetic returns a timezone-aware Vancouver time object.""" + shifted = add_delta_to_time( + datetime.strptime("08:30", "%H:%M").time(), "America/Vancouver", minutes=30 + ) + + assert shifted.strftime("%H:%M") == "09:00" + assert shifted.tzinfo == get_timezone("America/Vancouver") + + +def test_current_pacific_time_uses_vancouver_zone(): + """Assert that the Pacific-time helper uses the Vancouver zone definition.""" + pacific_now = current_pacific_time() + + assert pacific_now.tzinfo == get_timezone("America/Vancouver") + + +def test_utcnow_returns_aware_utc_datetime(): + """Assert that the SQLAlchemy compatibility helper returns an aware UTC datetime.""" + current = utcnow() + + assert current.utcoffset().total_seconds() == 0 + assert current.tzname() == "UTC" diff --git a/api/app/tests/test_websocket_smoke.py b/api/app/tests/test_websocket_smoke.py new file mode 100644 index 000000000..7e10cce19 --- /dev/null +++ b/api/app/tests/test_websocket_smoke.py @@ -0,0 +1,194 @@ +import inspect +from types import SimpleNamespace + +import pytest + + +def _unwrap(func): + return inspect.unwrap(func) + + +def _import_websocket(monkeypatch): + class Response: + def read(self): + return ( + b'{"jwks_uri":"https://example.com/jwks.json","issuer":"https://example.com/"}' + ) + + monkeypatch.setattr( + "flask_jwt_oidc.jwt_manager.urlopen", + lambda url: Response(), + ) + + from app.resources.theq import websocket + + return websocket + + +pytestmark = pytest.mark.smoke + + +def test_join_room_handler_emits_success_for_authenticated_csr(monkeypatch): + """Assert that websocket room joins still emit the expected success events.""" + websocket = _import_websocket(monkeypatch) + + joined_rooms = [] + emitted_events = [] + fake_csr = SimpleNamespace( + username="tester", + office=SimpleNamespace(office_name="Victoria"), + ) + + monkeypatch.setattr(websocket, "get_username", lambda: "tester@idir") + monkeypatch.setattr(websocket.CSR, "find_by_username", lambda username: fake_csr) + monkeypatch.setattr(websocket, "join_room", lambda room: joined_rooms.append(room)) + monkeypatch.setattr( + websocket, + "emit", + lambda event, payload=None: emitted_events.append((event, payload)), + ) + monkeypatch.setattr(websocket, "request", SimpleNamespace(sid="socket-1")) + + handler = _unwrap(websocket.on_join) + handler({}) + + assert joined_rooms == ["Victoria"] + assert emitted_events == [ + ("joinRoomSuccess", {"sucess": True}), + ("get_Csr_State_IDs", {"success": True}), + ("update_customer_list", {"success": True}), + ] + + +def test_join_room_handler_fails_without_a_username(monkeypatch): + """Assert that joinRoom fails cleanly when no authenticated username is present.""" + websocket = _import_websocket(monkeypatch) + + emitted_events = [] + + monkeypatch.setattr(websocket, "get_username", lambda: "") + monkeypatch.setattr( + websocket, + "emit", + lambda event, payload=None: emitted_events.append((event, payload)), + ) + + handler = _unwrap(websocket.on_join) + handler({}) + + assert emitted_events == [("joinRoomFail", {"success": False})] + + +def test_join_room_handler_fails_when_csr_lookup_misses(monkeypatch): + """Assert that joinRoom fails when the username does not resolve to a CSR.""" + websocket = _import_websocket(monkeypatch) + + emitted_events = [] + + monkeypatch.setattr(websocket, "get_username", lambda: "missing@idir") + monkeypatch.setattr(websocket.CSR, "find_by_username", lambda username: None) + monkeypatch.setattr( + websocket, + "emit", + lambda event, payload=None: emitted_events.append((event, payload)), + ) + + handler = _unwrap(websocket.on_join) + handler({}) + + assert emitted_events == [("joinRoomFail", {"success": False})] + + +def test_join_smartboard_room_success_joins_the_expected_room(monkeypatch): + """Assert that smartboard room joins use the office-scoped socket room name.""" + websocket = _import_websocket(monkeypatch) + + joined_rooms = [] + emitted_events = [] + + monkeypatch.setattr(websocket, "join_room", lambda room: joined_rooms.append(room)) + monkeypatch.setattr( + websocket, + "emit", + lambda event, payload=None: emitted_events.append((event, payload)), + ) + monkeypatch.setattr(websocket, "request", SimpleNamespace(sid="socket-2")) + + websocket.on_join_smartboard({"office_id": "7"}) + + assert joined_rooms == ["sb-7"] + assert emitted_events == [("joinSmartboardRoomSuccess", None)] + + +def test_join_smartboard_room_rejects_missing_office_id(monkeypatch): + """Assert that smartboard joins fail with a clear message when office_id is missing.""" + websocket = _import_websocket(monkeypatch) + + emitted_events = [] + + monkeypatch.setattr( + websocket, + "emit", + lambda event, payload=None: emitted_events.append((event, payload)), + ) + + websocket.on_join_smartboard({}) + + assert emitted_events == [ + ( + "joinSmartboardRoomFail", + {"sucess": False, "message": "office_id must be passed to this method"}, + ) + ] + + +def test_join_smartboard_room_rejects_non_integer_office_id(monkeypatch): + """Assert that smartboard joins fail when office_id is not numeric.""" + websocket = _import_websocket(monkeypatch) + + emitted_events = [] + + monkeypatch.setattr( + websocket, + "emit", + lambda event, payload=None: emitted_events.append((event, payload)), + ) + + websocket.on_join_smartboard({"office_id": "abc"}) + + assert emitted_events == [ + ( + "joinSmartboardRoomFail", + {"sucess": False, "message": "office_id must be an integer"}, + ) + ] + + +def test_clear_csr_user_id_updates_the_csr_cache(monkeypatch): + """Assert that the clear-cache websocket event delegates to CSR.update_user_cache.""" + websocket = _import_websocket(monkeypatch) + + updated_ids = [] + + monkeypatch.setattr( + websocket.CSR, "update_user_cache", lambda csr_id: updated_ids.append(csr_id) + ) + + websocket.clear_csr_user_id(42) + + assert updated_ids == [42] + + +def test_sync_offices_cache_clears_the_office_cache(monkeypatch): + """Assert that office cache sync delegates to Office.clear_offices_cache.""" + websocket = _import_websocket(monkeypatch) + + calls = [] + + monkeypatch.setattr( + websocket.Office, "clear_offices_cache", lambda: calls.append("cleared") + ) + + websocket.sync_offices_cache() + + assert calls == ["cleared"] diff --git a/api/app/tests/validation/__init__.py b/api/app/tests/validation/__init__.py new file mode 100644 index 000000000..ae01f8262 --- /dev/null +++ b/api/app/tests/validation/__init__.py @@ -0,0 +1 @@ +"""Validation tests for explicit route-level API error handling.""" diff --git a/api/app/tests/validation/test_appointment_validation.py b/api/app/tests/validation/test_appointment_validation.py new file mode 100644 index 000000000..c014c1106 --- /dev/null +++ b/api/app/tests/validation/test_appointment_validation.py @@ -0,0 +1,216 @@ +from __future__ import annotations + +import pytest +from app.tests.api_test_support import ( + assert_json_response, + create_public_user, + future_utc_window, + json_of, + public_slot_payload, + slot_window_to_iso, + unique_name, +) + +pytestmark = [pytest.mark.validation, pytest.mark.usefixtures("seeded_database")] + + +def test_anonymous_draft_create_rejects_a_conflicting_slot(bare_client, seeded_data): + """Assert that anonymous draft creation returns CONFLICT_APPOINTMENT when the slot is already reserved.""" + payload, _day_key, _slots = public_slot_payload( + bare_client, seeded_data, minimum_slots=1 + ) + assert_json_response(bare_client.post("/appointments/draft", json=payload), 201) + + response = bare_client.post("/appointments/draft", json=payload) + + assert_json_response(response, 400) + assert json_of(response)["code"] == "CONFLICT_APPOINTMENT" + + +def test_public_appointment_create_rejects_a_conflict_across_different_users( + public_client, public_client_alt, seeded_data +): + """Assert that one public user's appointment blocks a different public user from taking the same slot.""" + create_public_user(public_client) + create_public_user(public_client_alt) + payload, _day_key, _slots = public_slot_payload( + public_client, seeded_data, minimum_slots=1 + ) + assert_json_response(public_client.post("/appointments/", json=payload), 201) + + response = public_client_alt.post("/appointments/", json=payload) + + assert_json_response(response, 400) + assert json_of(response)["code"] == "CONFLICT_APPOINTMENT" + + +def test_public_appointment_update_rejects_moving_onto_another_users_slot( + public_client, public_client_alt, seeded_data +): + """Assert that updating a public appointment into another user's booked slot returns CONFLICT_APPOINTMENT.""" + create_public_user(public_client) + payload, day_key, slots = public_slot_payload( + public_client, seeded_data, minimum_slots=2 + ) + first_response = public_client.post("/appointments/", json=payload) + assert_json_response(first_response, 201) + taken_appointment = json_of(first_response)["appointment"] + + create_public_user(public_client_alt) + other_start_time, other_end_time = slot_window_to_iso( + day_key, + slots[1], + seeded_data["office_timezones"]["limited_office"], + ) + second_response = public_client_alt.post( + "/appointments/", + json={ + **payload, + "start_time": other_start_time, + "end_time": other_end_time, + }, + ) + assert_json_response(second_response, 201) + other_appointment = json_of(second_response)["appointment"] + + response = public_client_alt.put( + f"/appointments/{other_appointment['appointment_id']}/", + json={ + "comments": "Move into a conflicting slot", + "office_id": other_appointment["office_id"], + "service_id": other_appointment["service_id"], + "start_time": taken_appointment["start_time"], + "end_time": taken_appointment["end_time"], + }, + ) + + assert_json_response(response, 400) + assert json_of(response)["code"] == "CONFLICT_APPOINTMENT" + + +def test_public_user_cannot_update_another_users_appointment( + public_client, public_client_alt, seeded_data +): + """Assert that a public user receives 403 when attempting to update another public user's appointment.""" + create_public_user(public_client) + payload, day_key, slots = public_slot_payload( + public_client, seeded_data, minimum_slots=2 + ) + first_response = public_client.post("/appointments/", json=payload) + assert_json_response(first_response, 201) + appointment = json_of(first_response)["appointment"] + + create_public_user(public_client_alt) + alternate_start_time, alternate_end_time = slot_window_to_iso( + day_key, + slots[1], + seeded_data["office_timezones"]["limited_office"], + ) + response = public_client_alt.put( + f"/appointments/{appointment['appointment_id']}/", + json={ + "comments": "Attempted cross-user update", + "office_id": appointment["office_id"], + "service_id": appointment["service_id"], + "start_time": alternate_start_time, + "end_time": alternate_end_time, + }, + ) + + assert response.status_code == 403, response.get_data(as_text=True) + + +def test_public_user_create_rejects_when_the_daily_limit_is_reached( + public_client, seeded_data +): + """Assert that the public appointment create route freezes the daily booking limit error contract.""" + create_public_user(public_client) + payload, day_key, slots = public_slot_payload( + public_client, seeded_data, minimum_slots=2 + ) + first_response = public_client.post("/appointments/", json=payload) + assert_json_response(first_response, 201) + + alternate_start_time, alternate_end_time = slot_window_to_iso( + day_key, + slots[1], + seeded_data["office_timezones"]["limited_office"], + ) + response = public_client.post( + "/appointments/", + json={ + **payload, + "start_time": alternate_start_time, + "end_time": alternate_end_time, + }, + ) + + assert_json_response(response, 400) + assert json_of(response) == { + "code": "MAX_NO_OF_APPOINTMENTS_REACHED", + "message": "Maximum number of appointments reached", + } + + +def test_internal_appointment_create_rejects_unknown_service_id( + internal_ga_client, seeded_data +): + """Assert that internal appointment creation returns JSON 400 for invalid service ids.""" + start_time, end_time = future_utc_window(2) + response = internal_ga_client.post( + "/appointments/", + json={ + "service_id": 999999, + "office_id": seeded_data["office_ids"]["test_office"], + "start_time": start_time, + "end_time": end_time, + "comments": "Internal invalid service", + "citizen_name": unique_name("invalid-service"), + "contact_information": "internal@example.com", + }, + ) + + assert_json_response(response, 400) + assert json_of(response)["message"] == "Could not find service for service_id: 999999" + + +def test_internal_appointment_create_rejects_mismatched_office_as_json( + internal_ga_client, seeded_data +): + """Assert that internal appointment creation returns a JSON 403 when the payload office differs from the CSR office.""" + start_time, end_time = future_utc_window(2) + response = internal_ga_client.post( + "/appointments/", + json={ + "service_id": seeded_data["service_ids"]["msp"], + "office_id": seeded_data["office_ids"]["limited_office"], + "start_time": start_time, + "end_time": end_time, + "comments": "Internal mismatched office", + "citizen_name": unique_name("mismatched-office"), + "contact_information": "internal@example.com", + }, + ) + + assert_json_response(response, 403) + assert ( + json_of(response)["message"] + == "The Appointment Office ID and CSR Office ID do not match!" + ) + + +def test_public_appointment_create_rejects_unknown_service_id( + public_client, seeded_data +): + """Assert that public appointment creation returns JSON 400 for invalid service ids.""" + create_public_user(public_client) + payload, _day_key, _slots = public_slot_payload( + public_client, seeded_data, minimum_slots=1 + ) + response = public_client.post( + "/appointments/", + json={**payload, "service_id": 999999}, + ) + + assert_json_response(response, 400) + assert json_of(response)["message"] == "Could not find service for service_id: 999999" diff --git a/api/app/tests/validation/test_booking_validation.py b/api/app/tests/validation/test_booking_validation.py new file mode 100644 index 000000000..3242b56d9 --- /dev/null +++ b/api/app/tests/validation/test_booking_validation.py @@ -0,0 +1,37 @@ +import pytest +from app.tests.api_test_support import assert_json_response, future_utc_window, json_of + +pytestmark = [pytest.mark.validation, pytest.mark.usefixtures("seeded_database")] + + +def test_booking_create_rejects_an_empty_payload(internal_ga_client): + """Assert that booking creation rejects an empty JSON body with the stable 400 response.""" + response = internal_ga_client.post("/bookings/", json={}) + + assert_json_response(response, 400) + assert json_of(response)["message"] == "No input data received for creating a booking" + + +def test_booking_create_rejects_a_booking_for_a_different_office( + internal_ga_client, seeded_data +): + """Assert that non-designate CSRs cannot create bookings for a different office.""" + start_time, end_time = future_utc_window(2, duration_minutes=120) + response = internal_ga_client.post( + "/bookings/", + json={ + "booking_name": "Wrong office booking", + "booking_contact_information": "booking@example.com", + "fees": "false", + "office_id": seeded_data["office_ids"]["limited_office"], + "room_id": seeded_data["room_id"], + "start_time": start_time, + "end_time": end_time, + "invigilator_id": [seeded_data["invigilator_ids"][0]], + }, + ) + + assert_json_response(response, 403) + assert json_of(response)["message"] == ( + "The Booking Office ID and CSR Office ID do not match!" + ) diff --git a/api/app/tests/validation/test_csr_validation.py b/api/app/tests/validation/test_csr_validation.py new file mode 100644 index 000000000..da46c8c59 --- /dev/null +++ b/api/app/tests/validation/test_csr_validation.py @@ -0,0 +1,59 @@ +from __future__ import annotations + +import pytest +from app.tests.api_test_support import json_of + +pytestmark = [pytest.mark.validation, pytest.mark.usefixtures("seeded_database")] + + +def test_csr_update_rejects_an_empty_json_payload(internal_ga_client, seeded_data): + """Assert that the CSR update endpoint returns 400 when no editable fields are provided.""" + response = internal_ga_client.put( + f"/csrs/{seeded_data['csr_ids']['ga']}/", + json={}, + ) + + assert response.status_code == 400, response.get_data(as_text=True) + assert json_of(response)["message"] == "No input data received for updating CSR" + + +def test_csr_update_rejects_editing_a_different_csr( + internal_ga_client, seeded_data, app +): + """Assert that a CSR cannot edit another CSR's record.""" + with app.app_context(): + from app.models.theq import CSR + + original = CSR.query.filter_by( + csr_id=seeded_data["csr_ids"]["non_qtxn"] + ).first() + assert original is not None + original_receptionist_ind = original.receptionist_ind + + response = internal_ga_client.put( + f"/csrs/{seeded_data['csr_ids']['non_qtxn']}/", + json={"receptionist_ind": 0}, + ) + + assert response.status_code == 403, response.get_data(as_text=True) + assert json_of(response)["message"] == "You do not have permission to edit this CSR" + + with app.app_context(): + from app.models.theq import CSR + + persisted = CSR.query.filter_by( + csr_id=seeded_data["csr_ids"]["non_qtxn"] + ).first() + assert persisted is not None + assert persisted.receptionist_ind == original_receptionist_ind + + +def test_csr_update_rejects_an_invalid_csr_state_type(internal_ga_client, seeded_data): + """Assert that Marshmallow validation returns 422 when csr_state_id is not an integer.""" + response = internal_ga_client.put( + f"/csrs/{seeded_data['csr_ids']['ga']}/", + json={"csr_state_id": "not-an-integer"}, + ) + + assert response.status_code == 422, response.get_data(as_text=True) + assert "csr_state_id" in json_of(response)["message"] diff --git a/api/app/tests/validation/test_exam_validation.py b/api/app/tests/validation/test_exam_validation.py new file mode 100644 index 000000000..34d00038c --- /dev/null +++ b/api/app/tests/validation/test_exam_validation.py @@ -0,0 +1,47 @@ +import pytest +from app.tests.api_test_support import assert_json_response, json_of +from app.tests.auth.auth_support import create_internal_exam_bundle, patch_exam_integrations + +pytestmark = [pytest.mark.validation, pytest.mark.usefixtures("seeded_database")] + + +def test_exam_download_reports_when_the_package_is_not_ready( + internal_ga_client, monkeypatch, seeded_data +): + """Assert that exam downloads freeze the pending-package error contract.""" + _booking, exam = create_internal_exam_bundle(internal_ga_client, seeded_data) + patch_exam_integrations( + monkeypatch, + download_job={"jobStatus": "QUEUED", "jobProperties": {}}, + ) + + response = internal_ga_client.get(f"/exams/{exam['exam_id']}/download/") + + assert_json_response(response, 400) + assert json_of(response) == { + "message": "Package not yet generated", + "status": "QUEUED", + } + + +def test_exam_email_invigilator_requires_name_email_and_phone( + internal_ga_client, monkeypatch, seeded_data +): + """Assert that emailing an invigilator rejects incomplete contact details.""" + _booking, exam = create_internal_exam_bundle(internal_ga_client, seeded_data) + patch_exam_integrations(monkeypatch, email_result=True) + + response = internal_ga_client.post( + f"/exams/{exam['exam_id']}/email_invigilator/", + json={ + "invigilator_id": seeded_data["invigilator_ids"][0], + "invigilator_name": "Homer Simpson", + "invigilator_email": "homer@example.com", + "invigilator_phone": "", + }, + ) + + assert_json_response(response, 422) + assert json_of(response)["message"] == ( + "Invigilator name, email, and phone number are required" + ) diff --git a/api/app/tests/validation/test_service_refresh_validation.py b/api/app/tests/validation/test_service_refresh_validation.py new file mode 100644 index 000000000..a6b469a47 --- /dev/null +++ b/api/app/tests/validation/test_service_refresh_validation.py @@ -0,0 +1,20 @@ +import pytest +from app.tests.api_test_support import assert_json_response, json_of + +pytestmark = [pytest.mark.validation, pytest.mark.usefixtures("seeded_database")] + + +def test_service_refresh_requires_an_office_id(internal_ga_client): + """Assert that refresh requests without office_id fail with the stable error payload.""" + response = internal_ga_client.get("/services/refresh/") + + assert_json_response(response, 400) + assert json_of(response)["message"] == "no office specified" + + +def test_service_refresh_rejects_non_integer_office_ids(internal_ga_client): + """Assert that refresh requests reject non-numeric office ids with a stable validation message.""" + response = internal_ga_client.get("/services/refresh/?office_id=abc") + + assert_json_response(response, 400) + assert json_of(response)["message"] == "office_id must be an integer." diff --git a/api/app/utilities/auth_util.py b/api/app/utilities/auth_util.py index cb6399d88..d707073f2 100644 --- a/api/app/utilities/auth_util.py +++ b/api/app/utilities/auth_util.py @@ -28,17 +28,21 @@ class Role(Enum): def get_username() -> str: """ Gets the username in the form user@idp, where username is lowercase - and the idp is typically one of "bceid", "bcsc", or "idir". Will - return an empty string if there is no authenticated user identity. + and the idp is typically one of "bceid", "bcsc", or "idir". Abort + with 401 when the authenticated identity is missing or malformed. """ - if 'username' not in g.jwt_oidc_token_info or \ - 'identity_provider' not in g.jwt_oidc_token_info: - return '' - - username = g.jwt_oidc_token_info['username'].lower() + '@' + \ - g.jwt_oidc_token_info['identity_provider'] - - return username + token_info = getattr(g, 'jwt_oidc_token_info', None) + if token_info is None: + abort(401) + username = token_info.get('username') + identity_provider = token_info.get('identity_provider') + if not isinstance(username, str) or not isinstance(identity_provider, str): + abort(401) + username = username.strip().lower() + identity_provider = identity_provider.strip().lower() + if username == '' or identity_provider == '': + abort(401) + return username + '@' + identity_provider def is_public_user() -> bool: """Return if the user is a public user or not.""" diff --git a/api/app/utilities/bcmp_service.py b/api/app/utilities/bcmp_service.py index c0429f450..084620f5a 100644 --- a/api/app/utilities/bcmp_service.py +++ b/api/app/utilities/bcmp_service.py @@ -4,8 +4,8 @@ from qsystem import application, my_print from app.utilities.document_service import DocumentService from datetime import datetime -import pytz from dateutil import parser +from app.utilities.timezone_utils import get_timezone class BCMPService: base_url = application.config['BCMP_BASE_URL'] @@ -128,10 +128,10 @@ def create_group_exam_bcmp(self, exam, booking, candiate_list, pesticide_office, my_print(" ==> create_group_exam_bcmp url: %s" % url) office_name = None - time_zone = pytz.timezone('America/Vancouver') + time_zone = get_timezone('America/Vancouver') if pesticide_office: office_name = pesticide_office.office_name - time_zone = pytz.timezone(pesticide_office.timezone.timezone_name) + time_zone = get_timezone(pesticide_office.timezone.timezone_name) my_print(exam.expiry_date.strftime("%a %b %d, %Y at %-I:%M %p")) exam_text = None diff --git a/api/app/utilities/date_util.py b/api/app/utilities/date_util.py index e6680b8be..9873beb89 100644 --- a/api/app/utilities/date_util.py +++ b/api/app/utilities/date_util.py @@ -13,7 +13,8 @@ limitations under the License.''' import datetime as dt from datetime import timedelta, time -import pytz + +from app.utilities.timezone_utils import get_timezone, localize days_mapping = { 'Monday': 1, @@ -38,7 +39,7 @@ def add_delta_to_time(time: time, timezone, minutes: int = 0, seconds: int = 0): else: delta_time -= timedelta(seconds=seconds) - return delta_time.replace(tzinfo=pytz.timezone(timezone)).time() + return localize(delta_time, timezone).timetz() def day_indexes(days): @@ -51,4 +52,4 @@ def day_indexes(days): def current_pacific_time(): """Return current time as in pacific zone.""" - return dt.datetime.now().astimezone(pytz.timezone('US/Pacific')) + return dt.datetime.now(get_timezone('America/Vancouver')) diff --git a/api/app/utilities/email.py b/api/app/utilities/email.py index ab32f222d..15e8f96b2 100644 --- a/api/app/utilities/email.py +++ b/api/app/utilities/email.py @@ -15,13 +15,13 @@ import re from datetime import datetime -import pytz from flask import current_app from jinja2 import Environment, FileSystemLoader from .notification_email import send_email from app.models.bookings import Appointment from app.models.theq import Citizen, Office +from app.utilities.timezone_utils import get_timezone ENV = Environment(loader=FileSystemLoader('.'), autoescape=True) @@ -87,6 +87,18 @@ def get_blackout_email_contents(blackout_appt: Appointment, cancelled_appointmen return subject, get_email(user, cancelled_appointment), sender, body +def can_send_service_notification(appointment: Appointment) -> bool: + """Return whether the appointment supports service-based notifications.""" + return bool( + appointment + and not appointment.is_draft + and appointment.blackout_flag != "Y" + and not appointment.stat_flag + and appointment.service_id is not None + and appointment.service is not None + ) + + def get_confirmation_email_contents(appointment: Appointment, office, timezone, user): """Send confirmation email""" sender = current_app.config.get('MAIL_FROM_ID') @@ -120,7 +132,7 @@ def is_valid_email(email: str): def formatted_date(dt: datetime, timezone): - dt_local = dt.astimezone(pytz.timezone(timezone.timezone_name)) + dt_local = dt.astimezone(get_timezone(timezone.timezone_name)) return dt_local.strftime('%B %d, %Y at %I:%M %p'), dt_local.strftime('%B %d, %Y') diff --git a/api/app/utilities/flask_admin_compat.py b/api/app/utilities/flask_admin_compat.py new file mode 100644 index 000000000..52406055d --- /dev/null +++ b/api/app/utilities/flask_admin_compat.py @@ -0,0 +1,111 @@ +"""Compatibility helpers for Flask-Admin on newer WTForms releases.""" + +from collections.abc import Mapping + +from flask_admin.contrib.sqla.fields import QuerySelectField, QuerySelectMultipleField +from flask_admin.contrib.sqla.widgets import CheckboxListInput +from flask_admin.contrib.sqla.validators import Unique +from flask_admin.form.fields import Select2Field +from flask_admin.form.validators import FieldListInputRequired +from markupsafe import Markup +from wtforms.widgets.core import Select, escape, html_params + + +def _normalize_field_flags(validator_class): + """WTForms 3.2 expects validator field_flags to be a mapping.""" + field_flags = getattr(validator_class, "field_flags", {}) + if isinstance(field_flags, Mapping): + return + + validator_class.field_flags = {flag: True for flag in field_flags} + + +def _normalize_iter_choices(field_class): + """WTForms 3.2 expects select choices to include render_kw.""" + if getattr(field_class, "_wtforms_compat_choices_patched", False): + return + + original_iter_choices = field_class.iter_choices + + def wrapped_iter_choices(self): + for choice in original_iter_choices(self): + yield _normalize_choice(choice) + + field_class.iter_choices = wrapped_iter_choices + field_class._wtforms_compat_choices_patched = True + + +def _normalize_choice(choice): + if len(choice) == 3: + return (*choice, {}) + return choice + + +def _patch_select_widget(): + if getattr(Select, "_wtforms_compat_choices_patched", False): + return + + def wrapped_call(self, field, **kwargs): + kwargs.setdefault("id", field.id) + if self.multiple: + kwargs["multiple"] = True + + flags = getattr(field, "flags", {}) + for key in dir(flags): + if key in self.validation_attrs and key not in kwargs: + kwargs[key] = getattr(flags, key) + + select_params = html_params(name=field.name, **kwargs) + html = [f"") + return Markup("".join(html)) + + Select.__call__ = wrapped_call + Select._wtforms_compat_choices_patched = True + + +def _patch_checkbox_list_widget(): + if getattr(CheckboxListInput, "_wtforms_compat_choices_patched", False): + return + + def wrapped_call(self, field, **kwargs): + items = [] + for choice in field.iter_choices(): + value, label, selected, _render_kw = _normalize_choice(choice) + args = { + "id": value, + "name": field.name, + "label": escape(label), + "selected": " checked" if selected else "", + } + items.append(self.template % args) + return Markup("".join(items)) + + CheckboxListInput.__call__ = wrapped_call + CheckboxListInput._wtforms_compat_choices_patched = True + + +def apply_wtforms_compat(): + """Patch known Flask-Admin validators that still use legacy tuple flags.""" + for validator_class in (FieldListInputRequired, Unique): + _normalize_field_flags(validator_class) + + for field_class in (Select2Field, QuerySelectField, QuerySelectMultipleField): + _normalize_iter_choices(field_class) + + _patch_select_widget() + _patch_checkbox_list_widget() diff --git a/api/app/utilities/notification_email.py b/api/app/utilities/notification_email.py index 858e4d877..8b7b7265b 100644 --- a/api/app/utilities/notification_email.py +++ b/api/app/utilities/notification_email.py @@ -18,6 +18,8 @@ import requests from flask import current_app +request_timeout_seconds = 30 + def send_email(token, subject, email, sender, html_body): """Send the email asynchronously, using the given details.""" @@ -34,7 +36,8 @@ def send_email(token, subject, email, sender, html_body): } response = requests.post(send_email_endpoint, headers={'Content-Type': 'application/json', 'Authorization': f'Bearer {token}'}, - data=json.dumps(payload)) + json=payload, + timeout=request_timeout_seconds) response.raise_for_status() diff --git a/api/app/utilities/sms.py b/api/app/utilities/sms.py index 7f64786da..62c2ed2d7 100644 --- a/api/app/utilities/sms.py +++ b/api/app/utilities/sms.py @@ -16,15 +16,16 @@ from datetime import datetime import json -import pytz import requests from flask import current_app from app.models.bookings import Appointment from app.models.theq import Office, PublicUser, Citizen +from app.utilities.timezone_utils import get_timezone # Defining String constants to appease SonarQube app_json_const = 'application/json' +request_timeout_seconds = 30 def send_sms(appointment: Appointment, office: Office, timezone, user: PublicUser, token: str): """Send confirmation email""" @@ -35,13 +36,14 @@ def send_sms(appointment: Appointment, office: Office, timezone, user: PublicUse display_name: str = user.display_name if user else '' # For CSR appointment user is None requests.post(notifications_endpoint, headers={'Content-Type': app_json_const, 'Authorization': f'Bearer {token}'}, - data=json.dumps([{ + json=[{ 'user_telephone': telephone, 'display_name': display_name, 'location': office.office_name, 'formatted_date': format_sms_date(appointment.start_time, timezone), 'office_telephone': office.telephone - }])) + }], + timeout=request_timeout_seconds) except Exception as exc: logging.exception("Error on sms sending - %s", exc) @@ -57,7 +59,7 @@ def is_valid_phone(phone_number: str): def format_sms_date(dt: datetime, timezone): - dt_local = dt.astimezone(pytz.timezone(timezone.timezone_name)) + dt_local = dt.astimezone(get_timezone(timezone.timezone_name)) return dt_local.strftime('%A, %B %d at %I:%M %p') @@ -77,12 +79,13 @@ def send_walkin_spot_confirmation_sms(citizen: Citizen, url, token: str): try: requests.post(notifications_endpoint, headers={'Content-Type': app_json_const, 'Authorization': f'Bearer {token}'}, - data=json.dumps([{ + json=[{ 'user_telephone': telephone, 'url': url, 'ticket_number': citizen.ticket_number, "type": "CHECKIN_CONFIRMATION" - }])) + }], + timeout=request_timeout_seconds) return True except Exception as exc: logging.exception('Error on sms sending - %s', exc) @@ -99,11 +102,12 @@ def send_walkin_reminder_sms(citizen: Citizen, office: Office, token: str): msg = "We’re ready! Please come inside and speak to a Service BC Representative" requests.post(notifications_endpoint, headers={'Content-Type': app_json_const, 'Authorization': f'Bearer {token}'}, - data=json.dumps([{ + json=[{ 'user_telephone': telephone, 'message': office.check_in_reminder_msg if office.check_in_reminder_msg else msg, "type": "CUSTOM" - }])) + }], + timeout=request_timeout_seconds) return True except Exception as exc: logging.exception('Error on sms sending - %s', exc) diff --git a/api/app/utilities/snowplow.py b/api/app/utilities/snowplow.py index 57175204e..dc756f8cd 100644 --- a/api/app/utilities/snowplow.py +++ b/api/app/utilities/snowplow.py @@ -14,6 +14,7 @@ from app.models.theq.channel import Channel from app.models.theq.citizen import Citizen +from app.models.theq.counter import Counter from app.models.theq.csr import CSR from app.models.theq.office import Office from app.models.theq.role import Role @@ -23,7 +24,7 @@ from snowplow_tracker import SelfDescribingJson import logging import os -from qsystem import application, my_print +from qsystem import application, db, my_print from datetime import datetime, timezone # Defining String constants to appease SonarQube @@ -46,7 +47,7 @@ def add_citizen(new_citizen, csr): if SnowPlow.call_snowplow_flag: # Set up contexts for the call. - citizen_obj = Citizen.query.get(new_citizen.citizen_id) + citizen_obj = db.session.get(Citizen, new_citizen.citizen_id) citizen = SnowPlow.get_citizen(citizen_obj, csr.counter.counter_name) office = SnowPlow.get_office(new_citizen.office_id) agent = SnowPlow.get_csr(csr, office) @@ -81,7 +82,7 @@ def snowplow_event(citizen_id, csr, schema, period_count = 0, quantity = 0, curr if SnowPlow.call_snowplow_flag: # Set up the contexts for the call. - citizen_obj = Citizen.query.get(citizen_id) + citizen_obj = db.session.get(Citizen, citizen_id) citizen = SnowPlow.get_citizen(citizen_obj, csr.counter.counter_name, svc_number = current_sr_number) office = SnowPlow.get_office(csr.office_id) agent = SnowPlow.get_csr(csr, office) @@ -116,7 +117,7 @@ def snowplow_appointment(citizen_obj, csr, appointment, schema): # If no citizen object, get citizen information. if citizen_obj is None: - citizen_obj = Citizen.query.get(appointment.citizen_id) + citizen_obj = db.session.get(Citizen, appointment.citizen_id) # Online CSR has a default of Counter for Counter Name and csr id of 1000001 if csr is None: @@ -151,10 +152,13 @@ def failure(count, failed): def get_citizen(citizen_obj, counter_name, svc_number = 1): citizen_type = counter_name - if citizen_obj.office.sb.sb_type == "nocallonsmartboard": + office = db.session.get(Office, citizen_obj.office_id) + if office.sb.sb_type == "nocallonsmartboard": citizen_type = "Counter" - elif citizen_obj.counter is not None: - citizen_type = citizen_obj.counter.counter_name + elif citizen_obj.counter_id is not None: + counter = db.session.get(Counter, citizen_obj.counter_id) + if counter is not None: + citizen_type = counter.counter_name # Set up the citizen context. citizen = SelfDescribingJson('iglu:ca.bc.gov.cfmspoc/citizen/jsonschema/4-0-0', @@ -167,7 +171,7 @@ def get_citizen(citizen_obj, counter_name, svc_number = 1): def get_office(id): # Set up office variables. - curr_office = Office.query.get(id) + curr_office = db.session.get(Office, id) office_num = curr_office.office_number office_type = "non-reception" if (curr_office.sb.sb_type == "callbyname") or (curr_office.sb.sb_type == "callbyticket"): @@ -223,10 +227,10 @@ def get_service(service_request): pgm_id = service_request.service.parent_id svc_code = service_request.service.service_code svc_name = service_request.service.service_name - parent = Service.query.get(pgm_id) + parent = db.session.get(Service, pgm_id) pgm_code = parent.service_code pgm_name = parent.service_name - channel = Channel.query.get(service_request.channel_id) + channel = db.session.get(Channel, service_request.channel_id) channel_name = channel.channel_name # Translate channel name to old versions, to avoid major Snowplow changes @@ -344,8 +348,8 @@ def make_tracking_call(schema, citizen, office, agent): # Set up core Snowplow environment if SnowPlow.call_snowplow_flag: s = Subject() # .set_platform("app") - e = AsyncEmitter(SnowPlow.sp_endpoint, on_failure=SnowPlow.failure, protocol="https") - t = Tracker(e, encode_base64=False, app_id=SnowPlow.sp_appid, namespace=SnowPlow.sp_namespace) + e = AsyncEmitter(SnowPlow.sp_endpoint, on_failure=SnowPlow.failure, protocol="https", method="get") + t = Tracker(namespace=SnowPlow.sp_namespace, emitters=e, encode_base64=False, app_id=SnowPlow.sp_appid) # Set up the correct level of logging. print_flag = application.config['PRINT_ENABLE'] diff --git a/api/app/utilities/sqlalchemy_compat.py b/api/app/utilities/sqlalchemy_compat.py new file mode 100644 index 000000000..a57bb4767 --- /dev/null +++ b/api/app/utilities/sqlalchemy_compat.py @@ -0,0 +1,47 @@ +"""Local SQLAlchemy helpers for UTC-aware datetime columns.""" + +from __future__ import annotations + +from datetime import datetime, timezone + +from sqlalchemy import DateTime +from sqlalchemy.types import TypeDecorator + + +UTC = timezone.utc + + +class UtcDateTime(TypeDecorator): + """Store datetimes in UTC and always return aware UTC values.""" + + impl = DateTime + cache_ok = True + + def __init__(self, *args, timezone: bool = True, **kwargs): + super().__init__(*args, **kwargs) + self.timezone = timezone + + def load_dialect_impl(self, dialect): + return dialect.type_descriptor(DateTime(timezone=self.timezone)) + + def process_bind_param(self, value, dialect): + del dialect + if value is None: + return None + if value.tzinfo is None: + return value.replace(tzinfo=UTC) + return value.astimezone(UTC) + + def process_result_value(self, value, dialect): + del dialect + if value is None: + return None + if value.tzinfo is None: + return value.replace(tzinfo=UTC) + return value.astimezone(UTC) + + +def utcnow() -> datetime: + """Return the current UTC time as an aware datetime.""" + + return datetime.now(UTC) diff --git a/api/app/utilities/timezone_utils.py b/api/app/utilities/timezone_utils.py new file mode 100644 index 000000000..eb53886db --- /dev/null +++ b/api/app/utilities/timezone_utils.py @@ -0,0 +1,27 @@ +"""Timezone helpers built on Python's stdlib zoneinfo support.""" + +from datetime import datetime, timezone +from zoneinfo import ZoneInfo + + +UTC = timezone.utc + + +def get_timezone(timezone_name: str) -> ZoneInfo: + """Return a ZoneInfo instance for the given timezone name.""" + return ZoneInfo(timezone_name) + + +def localize(value: datetime, timezone_name: str) -> datetime: + """Attach a timezone to a naive datetime or convert an aware datetime.""" + zone = get_timezone(timezone_name) + if value.tzinfo is None: + return value.replace(tzinfo=zone) + return value.astimezone(zone) + + +def as_utc(value: datetime) -> datetime: + """Attach UTC to a naive datetime or convert an aware datetime to UTC.""" + if value.tzinfo is None: + return value.replace(tzinfo=UTC) + return value.astimezone(UTC) diff --git a/api/config.py b/api/config.py index 40ef36ba9..b23d3c755 100644 --- a/api/config.py +++ b/api/config.py @@ -2,6 +2,7 @@ import os import dotenv from pprint import pprint +from sqlalchemy.engine import URL # Load all the environment variables from a .env file located in some directory above. dotenv.load_dotenv(dotenv.find_dotenv()) @@ -16,6 +17,30 @@ "default": "config.LocalConfig" } + +def normalize_database_engine(db_engine): + if db_engine == "postgres": + return "postgresql+psycopg2" + return db_engine + + +def normalize_database_port(db_port): + if db_port in (None, ""): + return None + return int(db_port) + + +def build_database_uri(engine, user, password, host, port, name): + return URL.create( + drivername=engine, + username=user, + password=password, + host=host, + port=normalize_database_port(port), + database=name, + ).render_as_string(hide_password=False) + + class BaseConfig(object): # Set up miscellaneous environment variables. @@ -60,7 +85,7 @@ class BaseConfig(object): DB_LONG_RUNNING_QUERY = float(os.getenv("DATABASE_LONG_RUNNING_QUERY", '0.5')) - DB_ENGINE = os.getenv('DATABASE_ENGINE', '') + DB_ENGINE = normalize_database_engine(os.getenv('DATABASE_ENGINE', '')) DB_USER = os.getenv('DATABASE_USERNAME', '') DB_PASSWORD = os.getenv('DATABASE_PASSWORD','') DB_NAME = os.getenv('DATABASE_NAME','') @@ -69,7 +94,7 @@ class BaseConfig(object): DB_POOL_TIMEOUT = os.getenv('DATABASE_TIMEOUT_STRING', '') DB_CONNECT_TIMEOUT = os.getenv('DATABASE_CONNECT_TIMEOUT_STRING', '') - SQLALCHEMY_DATABASE_URI = '{engine}://{user}:{password}@{host}:{port}/{name}'.format( + SQLALCHEMY_DATABASE_URI = build_database_uri( engine=DB_ENGINE, user=DB_USER, password=DB_PASSWORD, @@ -165,6 +190,8 @@ class BaseConfig(object): # JWT_OIDC Settings JWT_OIDC_WELL_KNOWN_CONFIG = os.getenv('JWT_OIDC_WELL_KNOWN_CONFIG') + JWT_OIDC_JWKS_URI = os.getenv('JWT_OIDC_JWKS_URI') + JWT_OIDC_ISSUER = os.getenv('JWT_OIDC_ISSUER') JWT_OIDC_ALGORITHMS = os.getenv('JWT_OIDC_ALGORITHMS', 'RS256') JWT_OIDC_AUDIENCE = os.getenv('JWT_OIDC_AUDIENCE') JWT_OIDC_CLIENT_SECRET = os.getenv('JWT_OIDC_CLIENT_SECRET', '') @@ -184,7 +211,6 @@ class BaseConfig(object): class LocalConfig(BaseConfig): DEBUG = True TESTING = False - ENV = 'dev' USE_HTTPS = False PREFERRED_URL_SCHEME = 'http' @@ -193,17 +219,17 @@ class LocalConfig(BaseConfig): SERVER_NAME = None SESSION_COOKIE_DOMAIN = None - CORS_ALLOWED_ORIGINS = ["http://localhost:8080", "http://localhost:8081"] + CORS_ALLOWED_ORIGINS = ["http://localhost:8080", "http://localhost:8081", "http://localhost:5173", "http://localhost:5174"] SQLALCHEMY_ECHO = False SECRET_KEY = "pancakes" - DB_ENGINE = os.getenv('DATABASE_ENGINE', 'postgres') + DB_ENGINE = normalize_database_engine(os.getenv('DATABASE_ENGINE', 'postgresql+psycopg2')) DB_USER = os.getenv('DATABASE_USERNAME', 'postgres') DB_PASSWORD = os.getenv('DATABASE_PASSWORD', 'root') DB_NAME = os.getenv('DATABASE_NAME', 'qsystem') DB_HOST = os.getenv('DATABASE_HOST', '127.0.0.1') DB_PORT = os.getenv('DATABASE_PORT', '5432') - SQLALCHEMY_DATABASE_URI = '{engine}://{user}:{password}@{host}:{port}/{name}'.format( + SQLALCHEMY_DATABASE_URI = build_database_uri( engine=DB_ENGINE, user=DB_USER, password=DB_PASSWORD, @@ -227,7 +253,6 @@ class DevelopmentConfig(BaseConfig): DEBUG = True REDIS_DEBUG = True TESTING = False - ENV = 'dev' USE_HTTPS = True PREFERRED_URL_SCHEME = 'https' @@ -240,7 +265,6 @@ class TestConfig(BaseConfig): DEBUG = True REDIS_DEBUG = True TESTING = False - ENV = 'test' USE_HTTPS = True PREFERRED_URL_SCHEME = 'https' BCMP_BASE_URL = os.getenv('BCMP_BASE_URL') @@ -252,7 +276,6 @@ class ProductionConfig(BaseConfig): DEBUG = True REDIS_DEBUG = True TESTING = False - ENV = 'production' USE_HTTPS = True PREFERRED_URL_SCHEME = 'https' BCMP_BASE_URL = os.getenv('BCMP_BASE_URL') diff --git a/api/gunicorn_config.py b/api/gunicorn_config.py index 1535f858c..858b42444 100644 --- a/api/gunicorn_config.py +++ b/api/gunicorn_config.py @@ -14,7 +14,7 @@ workers = int(os.environ.get('GUNICORN_PROCESSES', '1')) threads = int(os.environ.get('GUNICORN_THREADS', '1')) -worker_class = 'eventlet' +worker_class = 'gevent' worker_connections = 500 timeout = 10 keepalive = 20 diff --git a/api/manage.py b/api/manage.py index f14f60c96..99f8fba55 100644 --- a/api/manage.py +++ b/api/manage.py @@ -6,1044 +6,1053 @@ data suitable for development or demos. Usage: - python manage.py db - python manage.py migrate - python manage.py bootstrap # ***will wipe your database*** + uv run python manage.py db + uv run python manage.py migrate_db + uv run python manage.py bootstrap # ***will wipe your database*** ''' import logging -from flask_script import Command, Manager -from flask_migrate import Migrate, MigrateCommand, upgrade +import click +import flask_migrate as fm from qsystem import db, application from app.models import theq, bookings -migrate = Migrate(application, db) -manager = Manager(application) +# Alias for Flask CLI auto-discovery (FLASK_APP=manage) +app = application -# Defining String constants to appease SonarQube -back_office_const = "Back Office" -chalkboard_const = "Loves using chalk boards to communicate to examinees" +@application.cli.group('db') +def db_cli(): + '''Database migration commands.''' + pass -class AddAdminCsr(Command): - ''' - Adds a new CSR who is an administrator user. This is used to add - developers so that they can log into the Q locally. - ''' - def run(self): - ''' - Adds a CSR with full administrative permissions. - ''' - username = input('Your IDIR, to create an admin CSR account: ') - if username != '': - db.session.add(theq.CSR( - username=username, - office_id=AddAdminCsr.__get_office('Victoria').office_id, - role_id=AddAdminCsr.__get_role('SUPPORT').role_id, - counter_id=AddAdminCsr.__get_counter('Quick Trans').counter_id, - receptionist_ind=1, - csr_state_id=AddAdminCsr.__get_csr_state('Logout') - .csr_state_id - )) - db.session.commit() +@db_cli.command() +@click.option('-m', '--message', default=None, help='Revision message') +def migrate(message): + '''Create a new migration revision.''' + fm.migrate(message=message) - @staticmethod - def __get_counter(counter_name): - ''' Gets the named Counter. ''' - return theq.Counter.query.filter( - theq.Counter.counter_name == counter_name).first() +@db_cli.command() +@click.argument('revision', default='head') +def upgrade(revision): + '''Upgrade the database.''' + fm.upgrade(revision=revision) - @staticmethod - def __get_csr_state(csr_state_name): - ''' Gets the named CSR State. ''' - return theq.CSRState.query.filter( - theq.CSRState.csr_state_name == csr_state_name).first() +@db_cli.command() +@click.argument('revision', default='-1') +def downgrade(revision): + '''Downgrade the database.''' + fm.downgrade(revision=revision) - @staticmethod - def __get_office(office_name): - ''' Gets the named Office. ''' - return theq.Office.query.filter( - theq.Office.office_name == office_name).first() +@db_cli.command() +def current(): + '''Show the current revision.''' + fm.current() - @staticmethod - def __get_role(role_code): - ''' Gets the Role identified by its code. ''' - return theq.Role.query.filter( - theq.Role.role_code == role_code).first() +@db_cli.command() +def history(): + '''Show migration history.''' + fm.history() +# Defining String constants to appease SonarQube +back_office_const = "Back Office" +chalkboard_const = "Loves using chalk boards to communicate to examinees" -class Bootstrap(Command): - ''' - Sets up the database with enough information to do development or - run demos. - ''' +def _get_counter(counter_name): + return theq.Counter.query.filter( + theq.Counter.counter_name == counter_name).first() - def run(self): - ''' - Bootstraps the database by deleting all table rows and - populating with enough data to run the application for - development or demos. - ''' +def _get_csr_state(csr_state_name): + return theq.CSRState.query.filter( + theq.CSRState.csr_state_name == csr_state_name).first() - logging.info('Clearing out all models') - theq.Period.query.delete() - theq.PeriodState.query.delete() - theq.ServiceReq.query.delete() - theq.SRState.query.delete() - bookings.Appointment.query.delete() - bookings.Booking.query.delete() - bookings.Exam.query.delete() - theq.Citizen.query.delete() - theq.CitizenState.query.delete() - theq.CSR.query.delete() - theq.CSRState.query.delete() - bookings.Booking.query.delete() - bookings.ExamType.query.delete() - bookings.Room.query.delete() - bookings.Invigilator.query.delete() - theq.TimeSlot.query.delete() - theq.Office.query.delete() - theq.SmartBoard.query.delete() - theq.Counter.query.delete() - theq.Role.query.delete() - theq.Permission.query.delete() - theq.Service.query.filter_by(actual_service_ind=1).delete() - theq.Service.query.delete() - theq.Channel.query.delete() - bookings.Booking.query.delete() - theq.Timezone.query.delete() +def _get_office(office_name): + return theq.Office.query.filter( + theq.Office.office_name == office_name).first() - logging.info('Starting to bootstrap data') +def _get_role(role_code): + return theq.Role.query.filter( + theq.Role.role_code == role_code).first() - # -- Channels -------------------------------------------------- - logging.info('--> Channels') - db.session.add(theq.Channel(channel_name='In Person')) - db.session.add(theq.Channel(channel_name='Phone')) - db.session.add(theq.Channel(channel_name='Back Office')) - db.session.add(theq.Channel(channel_name='Email/Fax/Mail')) - db.session.add(theq.Channel(channel_name='CATs Assist')) - db.session.add(theq.Channel(channel_name='Mobile Assist')) +@application.cli.command('adduser') +def add_admin_csr(): + '''Adds a new CSR who is an administrator user.''' + username = input('Your IDIR, to create an admin CSR account: ') + if username != '': + db.session.add(theq.CSR( + username=username, + office_id=_get_office('Victoria').office_id, + role_id=_get_role('SUPPORT').role_id, + counter_id=_get_counter('Quick Trans').counter_id, + receptionist_ind=1, + csr_state_id=_get_csr_state('Logout').csr_state_id + )) db.session.commit() - # -- Roles ----------------------------------------------------- - logging.info('--> Roles') - role_csr = theq.Role( - role_code='CSR', - role_desc='Customer Service Representative' - ) - role_ga = theq.Role( - role_code='GA', - role_desc='Government Agent' - ) - role3 = theq.Role( - role_code='HELPDESK', - role_desc='Help Desk Functions' - ) - role4 = theq.Role( - role_code='SUPPORT', - role_desc='All Administrative Functions' - ) - role5 = theq.Role( - role_code='ANALYTICS', - role_desc='Analytics Team to update Services per Office' - ) - db.session.add(role_csr) - db.session.add(role_ga) - db.session.add(role3) - db.session.add(role4) - db.session.add(role5) - db.session.commit() - # -- Period States --------------------------------------------- - logging.info('--> Period States') - db.session.add(theq.PeriodState( - ps_name='Waiting', - ps_desc='Waiting in line to see a CSR, after a ticket has been ' - 'created for them. The time they are in this state is the Citizen ' - 'Wait Time.', - ps_number=1 - )) - db.session.add(theq.PeriodState( - ps_name='Ticket Creation', - ps_desc='A receptionist is creating a service request / ticket ' - 'for the citizen. This is the first state a citizen will be in. ' - 'The time they are in this state is the CSR prep time.', - ps_number=2 - )) - db.session.add(theq.PeriodState( - ps_name='Invited', - ps_desc='Has been called from the waiting area to be served. The ' - 'time they are in this state is the time it takes them to walk ' - 'from the waiting area, to the CSR, until the CSR starts to serve ' - 'them.', - ps_number=4 - )) - db.session.add(theq.PeriodState( - ps_name='Being Served', - ps_desc='Is being served by a CSR. The time they are in this ' - 'state is the Service time.', - ps_number=7 - )) - db.session.add(theq.PeriodState( - ps_name='On hold', - ps_desc='Has been placed on hold by a CSR. The time they are in ' - 'this state is the Hold time.', - ps_number=11 - )) - db.session.commit() +@application.cli.command('bootstrap') +def bootstrap(): + '''Sets up the database with enough information to do development or run demos.''' - # -- Smart Boards ---------------------------------------------- - logging.info('--> Smart Boards') - smartboard_call_name = theq.SmartBoard(sb_type='callbyname') - smartboard_call_ticket = theq.SmartBoard(sb_type='callbyticket') - smartboard_no_call = theq.SmartBoard(sb_type='nocallonsmartboard') - db.session.add(smartboard_call_name) - db.session.add(smartboard_call_ticket) - db.session.add(smartboard_no_call) - db.session.commit() + logging.info('Clearing out all models') + theq.Period.query.delete() + theq.PeriodState.query.delete() + theq.ServiceReq.query.delete() + theq.SRState.query.delete() + bookings.Appointment.query.delete() + bookings.Booking.query.delete() + bookings.Exam.query.delete() + theq.Citizen.query.delete() + theq.CitizenState.query.delete() + theq.CSR.query.delete() + theq.CSRState.query.delete() + bookings.Booking.query.delete() + bookings.ExamType.query.delete() + bookings.Room.query.delete() + bookings.Invigilator.query.delete() + theq.TimeSlot.query.delete() + theq.Office.query.delete() + theq.SmartBoard.query.delete() + theq.Counter.query.delete() + theq.Role.query.delete() + theq.Permission.query.delete() + theq.Service.query.filter_by(actual_service_ind=1).delete() + theq.Service.query.delete() + theq.Channel.query.delete() + bookings.Booking.query.delete() + theq.Timezone.query.delete() - # -- Citizen States -------------------------------------------- - logging.info('--> Citizen States') - db.session.add(theq.CitizenState( - cs_state_name='Active', - cs_state_desc='Citizen is active, a ticket is being or has been ' - 'created for them' - )) - db.session.add(theq.CitizenState( - cs_state_name='Received Services', - cs_state_desc='Citizen left after receiving services' - )) - db.session.add(theq.CitizenState( - cs_state_name='Left before receiving services', - cs_state_desc='Citizen left, after ticket creation, before ' - 'service was started for them' - )) - db.session.add(theq.CitizenState( - cs_state_name='Appointment booked', - cs_state_desc='Citizen has booked an appointment' - )) - db.session.commit() + logging.info('Starting to bootstrap data') - # -- CSR States ------------------------------------------------ - logging.info('--> CSR States') - csr_state_logout = theq.CSRState( - csr_state_name='Logout', - csr_state_desc='Logged out' - ) - csr_state2 = theq.CSRState( - csr_state_name='Login', - csr_state_desc='Logged in' - ) - csr_state3 = theq.CSRState( - csr_state_name='Break', - csr_state_desc='Currently on break' - ) - csr_state4 = theq.CSRState( - csr_state_name='Serving', - csr_state_desc='Serving a citizen' - ) - csr_state5 = theq.CSRState( - csr_state_name=back_office_const, - csr_state_desc="Currently doing back office work" - ) - db.session.add(csr_state_logout) - db.session.add(csr_state2) - db.session.add(csr_state3) - db.session.add(csr_state4) - db.session.add(csr_state5) - db.session.commit() + # -- Channels -------------------------------------------------- + logging.info('--> Channels') + db.session.add(theq.Channel(channel_name='In Person')) + db.session.add(theq.Channel(channel_name='Phone')) + db.session.add(theq.Channel(channel_name='Back Office')) + db.session.add(theq.Channel(channel_name='Email/Fax/Mail')) + db.session.add(theq.Channel(channel_name='CATs Assist')) + db.session.add(theq.Channel(channel_name='Mobile Assist')) + db.session.commit() - # -- Service Request States ------------------------------------ - logging.info('--> Service Request States') - db.session.add(theq.SRState( - sr_code='Pending', - sr_state_desc='Service Request is pending, citizen has not ' - 'started receiving services yet.' - )) - db.session.add(theq.SRState( - sr_code='Active', - sr_state_desc='Service Request is active. A citizen has ' - 'started being served.' - )) - db.session.add(theq.SRState( - sr_code='Complete', - sr_state_desc='The service has been received for this Service ' - 'Request.' - )) - db.session.commit() + # -- Roles ----------------------------------------------------- + logging.info('--> Roles') + role_csr = theq.Role( + role_code='CSR', + role_desc='Customer Service Representative' + ) + role_ga = theq.Role( + role_code='GA', + role_desc='Government Agent' + ) + role3 = theq.Role( + role_code='HELPDESK', + role_desc='Help Desk Functions' + ) + role4 = theq.Role( + role_code='SUPPORT', + role_desc='All Administrative Functions' + ) + role5 = theq.Role( + role_code='ANALYTICS', + role_desc='Analytics Team to update Services per Office' + ) + db.session.add(role_csr) + db.session.add(role_ga) + db.session.add(role3) + db.session.add(role4) + db.session.add(role5) + db.session.commit() - # -- Services (Categories) ------------------------------------- - logging.info('--> Services (Categories)') - category_msp = theq.Service( - external_service_name='Medical Services Plan', - service_code='MSP', - service_name='MSP', - service_desc='Medical Services Plan', - prefix='A', - display_dashboard_ind=0, - actual_service_ind=0 - ) - category_ptax = theq.Service( - external_service_name='Rural Property Tax', - service_code='PTAX', - service_name='Property Tax', - service_desc='Property Tax', - prefix='A', - display_dashboard_ind=0, - actual_service_ind=0 - ) - category_back_office = theq.Service( - service_code = back_office_const, - service_name = back_office_const, - service_desc = back_office_const, - prefix = "B", - display_dashboard_ind = 0, - actual_service_ind = 0 - ) - category_exams = theq.Service( - service_code='Exams (code)', - service_name='Exams (name)', - service_desc='Exams (desc)', - prefix='E', - display_dashboard_ind=0, - actual_service_ind=0 - ) - category_icbc = theq.Service( - service_code='ICBC (code)', - service_name='ICBC (name)', - service_desc='ICBC (desc)', - prefix='A', - display_dashboard_ind=0, - actual_service_ind=0 - ) - db.session.add(category_msp) - db.session.add(category_ptax) - db.session.add(category_back_office) - db.session.add(category_exams) - db.session.add(category_icbc) - db.session.commit() + # -- Period States --------------------------------------------- + logging.info('--> Period States') + db.session.add(theq.PeriodState( + ps_name='Waiting', + ps_desc='Waiting in line to see a CSR, after a ticket has been ' + 'created for them. The time they are in this state is the Citizen ' + 'Wait Time.', + ps_number=1 + )) + db.session.add(theq.PeriodState( + ps_name='Ticket Creation', + ps_desc='A receptionist is creating a service request / ticket ' + 'for the citizen. This is the first state a citizen will be in. ' + 'The time they are in this state is the CSR prep time.', + ps_number=2 + )) + db.session.add(theq.PeriodState( + ps_name='Invited', + ps_desc='Has been called from the waiting area to be served. The ' + 'time they are in this state is the time it takes them to walk ' + 'from the waiting area, to the CSR, until the CSR starts to serve ' + 'them.', + ps_number=4 + )) + db.session.add(theq.PeriodState( + ps_name='Being Served', + ps_desc='Is being served by a CSR. The time they are in this ' + 'state is the Service time.', + ps_number=7 + )) + db.session.add(theq.PeriodState( + ps_name='On hold', + ps_desc='Has been placed on hold by a CSR. The time they are in ' + 'this state is the Hold time.', + ps_number=11 + )) + db.session.commit() - # -- Services -------------------------------------------------- - logging.info('--> Services') - service_msp6 = theq.Service( - service_code='MSP - 006', - service_name='Payment - MSP', - service_desc='MSP- SC686, SC1089 -Pay direct payment, employer ' - 'payment', - parent_id=category_msp.service_id, - prefix='A', - display_dashboard_ind=1, - actual_service_ind=1, - external_service_name='Medical Services Plan Payment' - ) - service_ptax4 = theq.Service( - service_code='PTAX - 004', - service_name='Other - PTAX', - service_desc='PTax/RPT - Providing information, forms, searches, ' - 'tax clearance certificate, address changes, add new owner, ' - 'extensions, forfeiture status, tax search, etc.', - parent_id=category_ptax.service_id, - prefix='A', - display_dashboard_ind=1, - actual_service_ind=1 - ) - service_ptax1 = theq.Service( - service_code='PTAX - 001', - service_name='Deferment Application', - service_desc='PTax/RPT - Process application - new and renewal, ' - 'post note, etc.', - parent_id=category_ptax.service_id, - prefix='A', - display_dashboard_ind=1, - actual_service_ind=1, - external_service_name='Rural Property Tax - Deferment Application' - ) - service_ptax2 = theq.Service( - service_code='PTAX - 002', - service_name='Deferment Payment', - service_desc='PTax/RPT - Full or Partial deferment account ' - 'payment', - parent_id=category_ptax.service_id, - prefix='A', - display_dashboard_ind=1, - actual_service_ind=1, - external_service_name='Rural Property Tax - Deferment Payment' - ) - service_msp1 = theq.Service( - service_code='MSP - 001', - service_name='Account Enquiry/Update', - service_desc='MSP-Address or family changes, personal information ' - 'updates, general status enquiries, billing information from ' - 'Biller Direct, immigration documents to HIBC, needs PHN, etc.', - parent_id=category_msp.service_id, - prefix='A', - display_dashboard_ind=1, - actual_service_ind=1, - external_service_name='Medical Services Plan Account Update' - ) - service_msp2 = theq.Service( - service_code='MSP - 002', - service_name='BCSC Non Photo', - service_desc='MSP- SC2607 RAPID ordering, status enquiry, address ' - 'update, also for the non photo form process when photo eligible, ' - 'etc.', - parent_id=category_msp.service_id, - prefix='A', - display_dashboard_ind=1, - actual_service_ind=1, - external_service_name='BC Services Card - Non-photo Card' - ) - service_bo1 = theq.Service( - service_code='Back Office - 001', - service_name='Batching', - service_desc='Batching', - parent_id=category_back_office.service_id, - prefix='B', - display_dashboard_ind=0, - actual_service_ind=1 - ) - service_bo2 = theq.Service( - service_code='Back Office - 002', - service_name='Cash Out', - service_desc='Cash Out', - parent_id=category_back_office.service_id, - prefix='B', - display_dashboard_ind=0, - actual_service_ind=1 - ) - service_exams = theq.Service( - service_code='Exams - 001', - service_name='Exam Management', - service_desc='ITA or PEST -Checking for expired Exams, contacting ' - 'ITA or PEST program, mailing back ITA or shredding expired PEST ' - 'Exams, etc.', - parent_id=category_exams.service_id, - prefix='E', - display_dashboard_ind=1, - actual_service_ind=1 - ) - service_dlkt = theq.Service( - service_code='ICBC - 008', - service_name='Knowledge Test Set-Up/Result', - service_desc='ICBC - Knowledge Test Set up/Result: KT - Either put ' - 'it on hold or end it after the test set up. When client returns, ' - 'you either resume or create a new one. ', - parent_id=category_icbc.service_id, - prefix='A', - display_dashboard_ind=1, - actual_service_ind=1, - external_service_name='ICBC - Drivers Licence Knowledge Test', - is_dlkt='YES' - ) - db.session.add(service_bo1) - db.session.add(service_bo2) - db.session.add(service_msp1) - db.session.add(service_msp2) - db.session.add(service_msp6) - db.session.add(service_ptax1) - db.session.add(service_ptax2) - db.session.add(service_ptax4) - db.session.add(service_exams) - db.session.add(service_dlkt) - db.session.commit() + # -- Smart Boards ---------------------------------------------- + logging.info('--> Smart Boards') + smartboard_call_name = theq.SmartBoard(sb_type='callbyname') + smartboard_call_ticket = theq.SmartBoard(sb_type='callbyticket') + smartboard_no_call = theq.SmartBoard(sb_type='nocallonsmartboard') + db.session.add(smartboard_call_name) + db.session.add(smartboard_call_ticket) + db.session.add(smartboard_no_call) + db.session.commit() - # -- Counters -------------------------------------------------- - logging.info('--> Counters') - qt_counter = theq.Counter( - counter_name='Quick Trans', - counter_id=1, - ) - counter = theq.Counter( - counter_name='Counter', - counter_id=2 - ) - db.session.add(qt_counter) - db.session.add(counter) - db.session.commit() + # -- Citizen States -------------------------------------------- + logging.info('--> Citizen States') + db.session.add(theq.CitizenState( + cs_state_name='Active', + cs_state_desc='Citizen is active, a ticket is being or has been ' + 'created for them' + )) + db.session.add(theq.CitizenState( + cs_state_name='Received Services', + cs_state_desc='Citizen left after receiving services' + )) + db.session.add(theq.CitizenState( + cs_state_name='Left before receiving services', + cs_state_desc='Citizen left, after ticket creation, before ' + 'service was started for them' + )) + db.session.add(theq.CitizenState( + cs_state_name='Appointment booked', + cs_state_desc='Citizen has booked an appointment' + )) + db.session.commit() - # -- Timezones ------------------------------------------------- - logging.info('--> Timezones') - timezone_one = theq.Timezone(timezone_name='America/Vancouver') - timezone_two = theq.Timezone(timezone_name='America/Dawson_Creek') - timezone_three = theq.Timezone(timezone_name='America/Edmonton') - timezone_four = theq.Timezone(timezone_name='America/Creston') - db.session.add(timezone_one) - db.session.add(timezone_two) - db.session.add(timezone_three) - db.session.add(timezone_four) - db.session.commit() + # -- CSR States ------------------------------------------------ + logging.info('--> CSR States') + csr_state_logout = theq.CSRState( + csr_state_name='Logout', + csr_state_desc='Logged out' + ) + csr_state2 = theq.CSRState( + csr_state_name='Login', + csr_state_desc='Logged in' + ) + csr_state3 = theq.CSRState( + csr_state_name='Break', + csr_state_desc='Currently on break' + ) + csr_state4 = theq.CSRState( + csr_state_name='Serving', + csr_state_desc='Serving a citizen' + ) + csr_state5 = theq.CSRState( + csr_state_name=back_office_const, + csr_state_desc="Currently doing back office work" + ) + db.session.add(csr_state_logout) + db.session.add(csr_state2) + db.session.add(csr_state3) + db.session.add(csr_state4) + db.session.add(csr_state5) + db.session.commit() - # -- Offices --------------------------------------------------- - logging.info('--> Offices') - office_test = theq.Office( - office_name='Test Office', - office_number=999, - sb_id=smartboard_call_ticket.sb_id, - exams_enabled_ind=1, - timezone_id=timezone_one.timezone_id, - appointments_enabled_ind=1, - latitude=48.458359, - longitude=-123.377106, - office_appointment_message='Test Message', - appointments_days_limit=30, - appointment_duration=30, - max_person_appointment_per_day=10, - civic_address='4000 Seymour', - telephone='999-999-9999', - online_status='SHOW' - ) - office_test.counters.append(counter) - office_test.counters.append(qt_counter) + # -- Service Request States ------------------------------------ + logging.info('--> Service Request States') + db.session.add(theq.SRState( + sr_code='Pending', + sr_state_desc='Service Request is pending, citizen has not ' + 'started receiving services yet.' + )) + db.session.add(theq.SRState( + sr_code='Active', + sr_state_desc='Service Request is active. A citizen has ' + 'started being served.' + )) + db.session.add(theq.SRState( + sr_code='Complete', + sr_state_desc='The service has been received for this Service ' + 'Request.' + )) + db.session.commit() - office_100 = theq.Office( - office_name='100 Mile House', - office_number=61, - sb_id=smartboard_no_call.sb_id, - exams_enabled_ind=0, - timezone_id=timezone_four.timezone_id, - appointments_enabled_ind=1, - latitude=51.644, - longitude=-121.295, - appointments_days_limit=30, - appointment_duration=30, - max_person_appointment_per_day=1, - civic_address='100 Mile House, BC', - telephone='999-999-9999', - online_status='SHOW' - ) - office_100.counters.append(counter) - office_100.counters.append(qt_counter) + # -- Services (Categories) ------------------------------------- + logging.info('--> Services (Categories)') + category_msp = theq.Service( + external_service_name='Medical Services Plan', + service_code='MSP', + service_name='MSP', + service_desc='Medical Services Plan', + prefix='A', + display_dashboard_ind=0, + actual_service_ind=0 + ) + category_ptax = theq.Service( + external_service_name='Rural Property Tax', + service_code='PTAX', + service_name='Property Tax', + service_desc='Property Tax', + prefix='A', + display_dashboard_ind=0, + actual_service_ind=0 + ) + category_back_office = theq.Service( + service_code = back_office_const, + service_name = back_office_const, + service_desc = back_office_const, + prefix = "B", + display_dashboard_ind = 0, + actual_service_ind = 0 + ) + category_exams = theq.Service( + service_code='Exams (code)', + service_name='Exams (name)', + service_desc='Exams (desc)', + prefix='E', + display_dashboard_ind=0, + actual_service_ind=0 + ) + category_icbc = theq.Service( + service_code='ICBC (code)', + service_name='ICBC (name)', + service_desc='ICBC (desc)', + prefix='A', + display_dashboard_ind=0, + actual_service_ind=0 + ) + db.session.add(category_msp) + db.session.add(category_ptax) + db.session.add(category_back_office) + db.session.add(category_exams) + db.session.add(category_icbc) + db.session.commit() - office_victoria = theq.Office( - office_name='Victoria', - office_number=94, - sb_id=smartboard_call_name.sb_id, - exams_enabled_ind=0, - timezone_id=timezone_one.timezone_id, - appointments_enabled_ind=1, - latitude=51.644, - longitude=-121.295, - appointments_days_limit=30, - appointment_duration=30, - max_person_appointment_per_day=1, - civic_address='Victoria, BC', - telephone='999-999-9999', - online_status='SHOW' - ) - office_victoria.counters.append(counter) - office_victoria.counters.append(qt_counter) + # -- Services -------------------------------------------------- + logging.info('--> Services') + service_msp6 = theq.Service( + service_code='MSP - 006', + service_name='Payment - MSP', + service_desc='MSP- SC686, SC1089 -Pay direct payment, employer ' + 'payment', + parent_id=category_msp.service_id, + prefix='A', + display_dashboard_ind=1, + actual_service_ind=1, + external_service_name='Medical Services Plan Payment' + ) + service_ptax4 = theq.Service( + service_code='PTAX - 004', + service_name='Other - PTAX', + service_desc='PTax/RPT - Providing information, forms, searches, ' + 'tax clearance certificate, address changes, add new owner, ' + 'extensions, forfeiture status, tax search, etc.', + parent_id=category_ptax.service_id, + prefix='A', + display_dashboard_ind=1, + actual_service_ind=1 + ) + service_ptax5 = theq.Service( + service_code='PTAX - 005', + service_name='Other - Rural PTAX', + service_desc='PTax/RPT - Providing information, forms, searches, ' + 'tax clearance certificate, address changes, add new owner, ' + 'extensions, forfeiture status, tax search, etc.', + parent_id=category_ptax.service_id, + prefix='A', + display_dashboard_ind=1, + actual_service_ind=1 + ) + service_ptax1 = theq.Service( + service_code='PTAX - 001', + service_name='Deferment Application', + service_desc='PTax/RPT - Process application - new and renewal, ' + 'post note, etc.', + parent_id=category_ptax.service_id, + prefix='A', + display_dashboard_ind=1, + actual_service_ind=1, + external_service_name='Rural Property Tax - Deferment Application' + ) + service_ptax2 = theq.Service( + service_code='PTAX - 002', + service_name='Deferment Payment', + service_desc='PTax/RPT - Full or Partial deferment account ' + 'payment', + parent_id=category_ptax.service_id, + prefix='A', + display_dashboard_ind=1, + actual_service_ind=1, + external_service_name='Rural Property Tax - Deferment Payment' + ) + service_msp1 = theq.Service( + service_code='MSP - 001', + service_name='Account Enquiry/Update', + service_desc='MSP-Address or family changes, personal information ' + 'updates, general status enquiries, billing information from ' + 'Biller Direct, immigration documents to HIBC, needs PHN, etc.', + parent_id=category_msp.service_id, + prefix='A', + display_dashboard_ind=1, + actual_service_ind=1, + external_service_name='Medical Services Plan Account Update' + ) + service_msp2 = theq.Service( + service_code='MSP - 002', + service_name='BCSC Non Photo', + service_desc='MSP- SC2607 RAPID ordering, status enquiry, address ' + 'update, also for the non photo form process when photo eligible, ' + 'etc.', + parent_id=category_msp.service_id, + prefix='A', + display_dashboard_ind=1, + actual_service_ind=1, + external_service_name='BC Services Card - Non-photo Card' + ) + service_bo1 = theq.Service( + service_code='Back Office - 001', + service_name='Batching', + service_desc='Batching', + parent_id=category_back_office.service_id, + prefix='B', + display_dashboard_ind=0, + actual_service_ind=1 + ) + service_bo2 = theq.Service( + service_code='Back Office - 002', + service_name='Cash Out', + service_desc='Cash Out', + parent_id=category_back_office.service_id, + prefix='B', + display_dashboard_ind=0, + actual_service_ind=1 + ) + service_exams = theq.Service( + service_code='Exams - 001', + service_name='Exam Management', + service_desc='ITA or PEST -Checking for expired Exams, contacting ' + 'ITA or PEST program, mailing back ITA or shredding expired PEST ' + 'Exams, etc.', + parent_id=category_exams.service_id, + prefix='E', + display_dashboard_ind=1, + actual_service_ind=1 + ) + service_dlkt = theq.Service( + service_code='ICBC - 008', + service_name='Knowledge Test Set-Up/Result', + service_desc='ICBC - Knowledge Test Set up/Result: KT - Either put ' + 'it on hold or end it after the test set up. When client returns, ' + 'you either resume or create a new one. ', + parent_id=category_icbc.service_id, + prefix='A', + display_dashboard_ind=1, + actual_service_ind=1, + external_service_name='ICBC - Drivers Licence Knowledge Test', + is_dlkt='YES' + ) + db.session.add(service_bo1) + db.session.add(service_bo2) + db.session.add(service_msp1) + db.session.add(service_msp2) + db.session.add(service_msp6) + db.session.add(service_ptax1) + db.session.add(service_ptax2) + db.session.add(service_ptax4) + db.session.add(service_ptax5) + db.session.add(service_exams) + db.session.add(service_dlkt) + db.session.commit() - office_pesticide_office = theq.Office( - office_name='Pesticide Offsite', - office_number=997, - sb_id=smartboard_call_name.sb_id, - exams_enabled_ind=1, - timezone_id=timezone_one.timezone_id, - appointments_enabled_ind=0, - appointments_days_limit=30, - appointment_duration=30, - max_person_appointment_per_day=1, - online_status='HIDE' - ) - office_pesticide_office.counters.append(counter) - office_pesticide_office.counters.append(qt_counter) + # -- Counters -------------------------------------------------- + logging.info('--> Counters') + qt_counter = theq.Counter( + counter_name='Quick Trans', + counter_id=1, + ) + counter = theq.Counter( + counter_name='Counter', + counter_id=2 + ) + db.session.add(qt_counter) + db.session.add(counter) + db.session.commit() - db.session.add(office_test) - db.session.add(office_100) - db.session.add(office_victoria) - db.session.add(office_pesticide_office) - db.session.commit() + # -- Timezones ------------------------------------------------- + logging.info('--> Timezones') + timezone_one = theq.Timezone(timezone_name='America/Vancouver') + timezone_two = theq.Timezone(timezone_name='America/Dawson_Creek') + timezone_three = theq.Timezone(timezone_name='America/Edmonton') + timezone_four = theq.Timezone(timezone_name='America/Creston') + db.session.add(timezone_one) + db.session.add(timezone_two) + db.session.add(timezone_three) + db.session.add(timezone_four) + db.session.commit() - # -- Time Slots ------------------------------------------------ - logging.info('--> Time Slots') - db.session.add(theq.TimeSlot( - start_time='09:00:00-07:00', - end_time='10:00:00-07:00', - no_of_slots=1, - day_of_week=[ - 'Monday','Tuesday', 'Wednesday', 'Thursday', 'Friday' - ], - office_id=office_100.office_id - )) - db.session.add(theq.TimeSlot( - start_time='10:30:00-07:00', - end_time='11:00:00-07:00', - no_of_slots=1, - day_of_week=[ - 'Monday','Tuesday', 'Wednesday', 'Thursday', 'Friday' - ], - office_id=office_100.office_id - )) - db.session.add(theq.TimeSlot( - start_time='13:00:00-07:00', - end_time='13:30:00-07:00', - no_of_slots=1, - day_of_week=[ - 'Monday','Tuesday', 'Wednesday', 'Thursday', 'Friday' - ], - office_id=office_100.office_id - )) - db.session.add(theq.TimeSlot( - start_time='13:30:00-07:00', - end_time='16:30:00-07:00', - no_of_slots=0, - day_of_week=[ - 'Monday','Tuesday', 'Wednesday', 'Thursday', 'Friday' - ], - office_id=office_100.office_id - )) - db.session.add(theq.TimeSlot( - start_time='09:00:00-07:00', - end_time='09:45:00-07:00', - no_of_slots=1, - day_of_week=[ - 'Monday','Tuesday', 'Wednesday', 'Thursday', 'Friday' - ], - office_id=office_victoria.office_id - )) - db.session.add(theq.TimeSlot( - start_time='10:30:00-07:00', - end_time='11:15:00-07:00', - no_of_slots=1, - day_of_week=[ - 'Monday','Tuesday', 'Wednesday', 'Thursday', 'Friday' - ], - office_id=office_victoria.office_id - )) - db.session.add(theq.TimeSlot( - start_time='11:00:00-07:00', - end_time='11:45:00-07:00', - no_of_slots=1, - day_of_week=[ - 'Monday','Tuesday', 'Wednesday', 'Thursday', 'Friday' - ], - office_id=office_victoria.office_id - )) - db.session.add(theq.TimeSlot( - start_time='15:00:00-07:00', - end_time='15:45:00-07:00', - no_of_slots=1, - day_of_week=[ - 'Monday','Tuesday', 'Wednesday', 'Thursday', 'Friday' - ], - office_id=office_victoria.office_id - )) - db.session.commit() + # -- Offices --------------------------------------------------- + logging.info('--> Offices') + office_test = theq.Office( + office_name='Test Office', + office_number=999, + sb_id=smartboard_call_ticket.sb_id, + exams_enabled_ind=1, + timezone_id=timezone_one.timezone_id, + appointments_enabled_ind=1, + latitude=48.458359, + longitude=-123.377106, + office_appointment_message='Test Message', + appointments_days_limit=30, + appointment_duration=30, + max_person_appointment_per_day=10, + civic_address='4000 Seymour', + telephone='999-999-9999', + online_status='SHOW' + ) + office_test.counters.append(counter) + office_test.counters.append(qt_counter) - # -- CSRs ------------------------------------------------------ - logging.info('--> CSRs') - db.session.add(theq.CSR( - username='cfms-postman-operator', - office_id=office_test.office_id, - role_id=role_ga.role_id, - counter_id=qt_counter.counter_id, - receptionist_ind=1, - deleted=None, - csr_state_id=csr_state_logout.csr_state_id, - office_manager=0, - pesticide_designate=0, - finance_designate=0, - ita2_designate=0 - )) - db.session.add(theq.CSR( - username='cfms-postman-non-operator', - office_id=office_test.office_id, - role_id=role_csr.role_id, - counter_id=counter.counter_id, - receptionist_ind=1, - deleted=None, - csr_state_id=csr_state_logout.csr_state_id, - office_manager=0, - pesticide_designate=0, - finance_designate=0, - ita2_designate=0 - )) - db.session.add(theq.CSR( - username='demoga', - office_id=office_test.office_id, - role_id=role_ga.role_id, - counter_id=counter.counter_id, - receptionist_ind=1, - deleted=None, - csr_state_id=csr_state_logout.csr_state_id, - office_manager=1, - pesticide_designate=1, - finance_designate=1, - ita2_designate=1 - )) - db.session.add(theq.CSR( - username='democsr', - office_id=office_test.office_id, - role_id=role_csr.role_id, - counter_id=counter.counter_id, - receptionist_ind=1, - deleted=None, - csr_state_id=csr_state_logout.csr_state_id, - office_manager=0, - pesticide_designate=0, - finance_designate=0, - ita2_designate=0 - )) - db.session.add(theq.CSR( - username='admin', - office_id=office_test.office_id, - role_id=role4.role_id, - counter_id=counter.counter_id, - receptionist_ind=1, - deleted=None, - csr_state_id=csr_state_logout.csr_state_id, - office_manager=1, - pesticide_designate=1, - finance_designate=1, - ita2_designate=1 - )) - db.session.add(theq.CSR( - username='user', - office_id=office_test.office_id, - role_id=role_csr.role_id, - counter_id=counter.counter_id, - receptionist_ind=1, - deleted=None, - csr_state_id=csr_state_logout.csr_state_id, - office_manager=0, - pesticide_designate=0, - finance_designate=0, - ita2_designate=0 - )) - db.session.commit() + office_100 = theq.Office( + office_name='100 Mile House', + office_number=61, + sb_id=smartboard_no_call.sb_id, + exams_enabled_ind=0, + timezone_id=timezone_four.timezone_id, + appointments_enabled_ind=1, + latitude=51.644, + longitude=-121.295, + appointments_days_limit=30, + appointment_duration=30, + max_person_appointment_per_day=1, + civic_address='100 Mile House, BC', + telephone='999-999-9999', + online_status='SHOW' + ) + office_100.counters.append(counter) + office_100.counters.append(qt_counter) - # -- Office Services ------------------------------------------- - logging.info('--> Office Services') - office_test.services.append(category_back_office) - office_test.services.append(category_msp) - office_test.services.append(category_ptax) - office_test.services.append(category_exams) - office_test.services.append(category_icbc) - office_test.services.append(service_bo1) - office_test.services.append(service_bo2) - office_test.services.append(service_msp1) - office_test.services.append(service_msp2) - office_test.services.append(service_msp6) - office_test.services.append(service_ptax1) - office_test.services.append(service_ptax2) - office_test.services.append(service_ptax4) - office_test.services.append(service_exams) - office_test.services.append(service_dlkt) + office_victoria = theq.Office( + office_name='Victoria', + office_number=94, + sb_id=smartboard_call_name.sb_id, + exams_enabled_ind=0, + timezone_id=timezone_one.timezone_id, + appointments_enabled_ind=1, + latitude=51.644, + longitude=-121.295, + appointments_days_limit=30, + appointment_duration=30, + max_person_appointment_per_day=1, + civic_address='Victoria, BC', + telephone='999-999-9999', + online_status='SHOW' + ) + office_victoria.counters.append(counter) + office_victoria.counters.append(qt_counter) - office_victoria.services.append(category_back_office) - office_victoria.services.append(category_msp) - office_victoria.services.append(category_icbc) - office_victoria.services.append(service_bo1) - office_victoria.services.append(service_bo2) - office_victoria.services.append(service_msp1) - office_victoria.services.append(service_msp2) - office_victoria.services.append(service_msp6) - office_victoria.services.append(service_dlkt) + office_pesticide_office = theq.Office( + office_name='Pesticide Offsite', + office_number=997, + sb_id=smartboard_call_name.sb_id, + exams_enabled_ind=1, + timezone_id=timezone_one.timezone_id, + appointments_enabled_ind=0, + appointments_days_limit=30, + appointment_duration=30, + max_person_appointment_per_day=1, + online_status='HIDE' + ) + office_pesticide_office.counters.append(counter) + office_pesticide_office.counters.append(qt_counter) - office_100.services.append(category_back_office) - office_100.services.append(category_ptax) - office_100.services.append(category_icbc) - office_100.services.append(service_bo1) - office_100.services.append(service_bo2) - office_100.services.append(service_ptax1) - office_100.services.append(service_ptax2) - office_100.services.append(service_ptax4) - office_100.services.append(service_dlkt) - db.session.commit() + db.session.add(office_test) + db.session.add(office_100) + db.session.add(office_victoria) + db.session.add(office_pesticide_office) + db.session.commit() - # -- Booking / Rooms ------------------------------------------- - logging.info('--> Booking: Rooms') - db.session.add(bookings.Room( - office_id=office_test.office_id, - room_name='Boardroom 1', - capacity=25, - color='#EFD469' - )) - db.session.add(bookings.Room( - office_id=office_test.office_id, - room_name='Turquoise W-135', - capacity=25, - color='#EFD469' - )) - db.session.commit() + # -- Time Slots ------------------------------------------------ + logging.info('--> Time Slots') + db.session.add(theq.TimeSlot( + start_time='09:00:00-07:00', + end_time='10:00:00-07:00', + no_of_slots=1, + day_of_week=[ + 'Monday','Tuesday', 'Wednesday', 'Thursday', 'Friday' + ], + office_id=office_100.office_id + )) + db.session.add(theq.TimeSlot( + start_time='10:30:00-07:00', + end_time='11:00:00-07:00', + no_of_slots=1, + day_of_week=[ + 'Monday','Tuesday', 'Wednesday', 'Thursday', 'Friday' + ], + office_id=office_100.office_id + )) + db.session.add(theq.TimeSlot( + start_time='13:00:00-07:00', + end_time='13:30:00-07:00', + no_of_slots=1, + day_of_week=[ + 'Monday','Tuesday', 'Wednesday', 'Thursday', 'Friday' + ], + office_id=office_100.office_id + )) + db.session.add(theq.TimeSlot( + start_time='13:30:00-07:00', + end_time='16:30:00-07:00', + no_of_slots=0, + day_of_week=[ + 'Monday','Tuesday', 'Wednesday', 'Thursday', 'Friday' + ], + office_id=office_100.office_id + )) + db.session.add(theq.TimeSlot( + start_time='09:00:00-07:00', + end_time='09:45:00-07:00', + no_of_slots=1, + day_of_week=[ + 'Monday','Tuesday', 'Wednesday', 'Thursday', 'Friday' + ], + office_id=office_victoria.office_id + )) + db.session.add(theq.TimeSlot( + start_time='10:30:00-07:00', + end_time='11:15:00-07:00', + no_of_slots=1, + day_of_week=[ + 'Monday','Tuesday', 'Wednesday', 'Thursday', 'Friday' + ], + office_id=office_victoria.office_id + )) + db.session.add(theq.TimeSlot( + start_time='11:00:00-07:00', + end_time='11:45:00-07:00', + no_of_slots=1, + day_of_week=[ + 'Monday','Tuesday', 'Wednesday', 'Thursday', 'Friday' + ], + office_id=office_victoria.office_id + )) + db.session.add(theq.TimeSlot( + start_time='15:00:00-07:00', + end_time='15:45:00-07:00', + no_of_slots=1, + day_of_week=[ + 'Monday','Tuesday', 'Wednesday', 'Thursday', 'Friday' + ], + office_id=office_victoria.office_id + )) + db.session.commit() - # -- Booking / Invigilators ------------------------------------ - logging.info('--> Booking: Invigilators') - db.session.add(bookings.Invigilator( - invigilator_name='Homer Simpson', - office_id=office_test.office_id, - invigilator_notes='He works in a nuclear power plant.', - contact_phone='2502084247', - contact_email='homer.j.simpson@gmail.com', - contract_number='c-000001', - contract_expiry_date='2018-11-30' - )) - db.session.add(bookings.Invigilator( - invigilator_name='Lisa Simpson', - office_id=office_test.office_id, - invigilator_notes='She plays the sax-a-ma-phone during exams', - contact_phone='555-555-5555', - contact_email='lisasimpsonesq@gmail.com', - contract_number='c-000002', - contract_expiry_date='2018-12-31' - )) - db.session.add(bookings.Invigilator( - invigilator_name='Bart Simpson', - office_id=office_test.office_id, - invigilator_notes='Loves using chalk boards to communicate to ' - 'examinees', - contact_phone='555-555-5555', - contact_email='bartwuzhere@gmail.com', - contract_number='c-000003', - contract_expiry_date='2019-01-31' - )) - db.session.add(bookings.Invigilator( - invigilator_name='Pest 1', - office_id=office_pesticide_office.office_id, - invigilator_notes='The first pest invigilator is not a pest', - contact_phone='555-555-5555', - contact_email='pest_invigilator_1@gmail.com', - contract_number='c-000003', - contract_expiry_date='2019-01-31' - )) - db.session.add(bookings.Invigilator( - invigilator_name='Pest 2', - office_id=office_pesticide_office.office_id, - invigilator_notes='The second pest invigilator is a pest', - contact_phone='555-555-5555', - contact_email='pest_invigilator_2@gmail.com', - contract_number='c-000003', - contract_expiry_date='2019-01-31' - )) - db.session.commit() + # -- CSRs ------------------------------------------------------ + logging.info('--> CSRs') + db.session.add(theq.CSR( + username='cfms-postman-operator', + office_id=office_test.office_id, + role_id=role_ga.role_id, + counter_id=qt_counter.counter_id, + receptionist_ind=1, + deleted=None, + csr_state_id=csr_state_logout.csr_state_id, + office_manager=0, + pesticide_designate=0, + finance_designate=0, + ita2_designate=0 + )) + db.session.add(theq.CSR( + username='cfms-postman-non-operator', + office_id=office_test.office_id, + role_id=role_csr.role_id, + counter_id=counter.counter_id, + receptionist_ind=1, + deleted=None, + csr_state_id=csr_state_logout.csr_state_id, + office_manager=0, + pesticide_designate=0, + finance_designate=0, + ita2_designate=0 + )) + db.session.add(theq.CSR( + username='demoga', + office_id=office_test.office_id, + role_id=role_ga.role_id, + counter_id=counter.counter_id, + receptionist_ind=1, + deleted=None, + csr_state_id=csr_state_logout.csr_state_id, + office_manager=1, + pesticide_designate=1, + finance_designate=1, + ita2_designate=1 + )) + db.session.add(theq.CSR( + username='democsr', + office_id=office_test.office_id, + role_id=role_csr.role_id, + counter_id=counter.counter_id, + receptionist_ind=1, + deleted=None, + csr_state_id=csr_state_logout.csr_state_id, + office_manager=0, + pesticide_designate=0, + finance_designate=0, + ita2_designate=0 + )) + db.session.add(theq.CSR( + username='admin', + office_id=office_test.office_id, + role_id=role4.role_id, + counter_id=counter.counter_id, + receptionist_ind=1, + deleted=None, + csr_state_id=csr_state_logout.csr_state_id, + office_manager=1, + pesticide_designate=1, + finance_designate=1, + ita2_designate=1 + )) + db.session.add(theq.CSR( + username='user', + office_id=office_test.office_id, + role_id=role_csr.role_id, + counter_id=counter.counter_id, + receptionist_ind=1, + deleted=None, + csr_state_id=csr_state_logout.csr_state_id, + office_manager=0, + pesticide_designate=0, + finance_designate=0, + ita2_designate=0 + )) + db.session.commit() - # -- Booking / Exam Types -------------------------------------- - logging.info('--> Booking: Exam Types') - db.session.add(bookings.ExamType( - exam_type_name='COFQ - 3HR Group Exam', - exam_color='#FF69B4', - number_of_hours=3, - method_type='Written', - ita_ind=1, - group_exam_ind=1, - pesticide_exam_ind=0 - )) - db.session.add(bookings.ExamType( - exam_type_name='COFQ - 3HR Single Exam', - exam_color='#FF69B4', - number_of_hours=3, - method_type='Written', - ita_ind=1, - group_exam_ind=0, - pesticide_exam_ind=0 - )) - db.session.add(bookings.ExamType( - exam_type_name='COFQ - 3HR Single Exam - Own Reader', - exam_color='#FF69B4', - number_of_hours=3, - method_type='Written', - ita_ind=1, - group_exam_ind=0, - pesticide_exam_ind=0 - )) - db.session.add(bookings.ExamType( - exam_type_name='COFQ - 3HR Single Exam - SBC Reader', - exam_color='#FF69B4', - number_of_hours=3, - method_type='Written', - ita_ind=1, - group_exam_ind=0, - pesticide_exam_ind=0 - )) - db.session.add(bookings.ExamType( - exam_type_name='COFQ - 3HR Single Exam - Time Extension', - exam_color='#FF69B4', - number_of_hours=3, - method_type='Written', - ita_ind=1, - group_exam_ind=0, - pesticide_exam_ind=0 - )) - db.session.add(bookings.ExamType( - exam_type_name='IPSE - 4HR Group Exam', - exam_color='#FFD701', - number_of_hours=4, - method_type='Written', - ita_ind=1, - group_exam_ind=1, - pesticide_exam_ind=0 - )) - db.session.add(bookings.ExamType( - exam_type_name='IPSE - 4HR Single Exam', - exam_color='#FFD701', - number_of_hours=4, - method_type='Written', - ita_ind=1, - group_exam_ind=0, - pesticide_exam_ind=0 - )) - db.session.add(bookings.ExamType( - exam_type_name='IPSE - 4HR Single Exam - Own Reader', - exam_color='#FFD701', - number_of_hours=4, - method_type='Written', - ita_ind=1, - group_exam_ind=0, - pesticide_exam_ind=0 - )) - db.session.add(bookings.ExamType( - exam_type_name='IPSE - 4HR Single Exam - SBC Reader', - exam_color='#FFD701', - number_of_hours=4, - method_type='Written', - ita_ind=1, - group_exam_ind=0, - pesticide_exam_ind=0 - )) - db.session.add(bookings.ExamType( - exam_type_name='IPSE - 4HR Single Exam - Time Extension', - exam_color='#FFD701', - number_of_hours=4, - method_type='Written', - ita_ind=1, - group_exam_ind=0, - pesticide_exam_ind=0 - )) - db.session.add(bookings.ExamType( - exam_type_name='SLE - 3HR Group Exam', - exam_color='#8FBC8F', - number_of_hours=3, - method_type='Written', - ita_ind=1, - group_exam_ind=1, - pesticide_exam_ind=0 - )) - db.session.add(bookings.ExamType( - exam_type_name='SLE - 3HR Single Exam', - exam_color='#8FBC8F', - number_of_hours=3, - method_type='Written', - ita_ind=1, - group_exam_ind=0, - pesticide_exam_ind=0 - )) - db.session.add(bookings.ExamType( - exam_type_name='SLE - 3HR Single Exam - Own Reader', - exam_color='#8FBC8F', - number_of_hours=3, - method_type='Written', - ita_ind=1, - group_exam_ind=0, - pesticide_exam_ind=0 - )) - db.session.add(bookings.ExamType( - exam_type_name='SLE - 3HR Single Exam - SBC Reader', - exam_color='#8FBC8F', - number_of_hours=3, - method_type='Written', - ita_ind=1, - group_exam_ind=0, - pesticide_exam_ind=0 - )) - db.session.add(bookings.ExamType( - exam_type_name='SLE - 3HR Single Exam - Time Extension', - exam_color='#8FBC8F', - number_of_hours=3, - method_type='Written', - ita_ind=1, - group_exam_ind=0, - pesticide_exam_ind=0 - )) - db.session.add(bookings.ExamType( - exam_type_name='Monthly Session Exam', - exam_color='#FFFFFF', - number_of_hours=4, - method_type='Written', - ita_ind=1, - group_exam_ind=0, - pesticide_exam_ind=0 - )) - db.session.add(bookings.ExamType( - exam_type_name='Veterinary Exam', - exam_color='#FFFFFF', - number_of_hours=2, - method_type='written', - ita_ind=0, - group_exam_ind=0, - pesticide_exam_ind=0 - )) - db.session.add(bookings.ExamType( - exam_type_name='Milk Grader', - exam_color='#FFFFFF', - number_of_hours=2, - method_type='written', - ita_ind=0, - group_exam_ind=0, - pesticide_exam_ind=0 - )) - db.session.add(bookings.ExamType( - exam_type_name='Industrial Vegetation', - exam_color='#FFFFFF', - number_of_hours=3, - method_type='written', - ita_ind=0, - group_exam_ind=0, - pesticide_exam_ind=1 - )) - db.session.add(bookings.ExamType( - exam_type_name='Structural-General', - exam_color='#FFFFFF', - number_of_hours=3, - method_type='written', - ita_ind=0, - group_exam_ind=0, - pesticide_exam_ind=1 - )) - db.session.add(bookings.ExamType( - exam_type_name='Dispenser-Commercial', - exam_color='#FFFFFF', - number_of_hours=1, - method_type='written', - ita_ind=0, - group_exam_ind=0, - pesticide_exam_ind=1 - )) - db.session.add(bookings.ExamType( - exam_type_name='Group Environment Exam', - exam_color='#FFFFFF', - number_of_hours=0, - method_type='written', - ita_ind=0, - group_exam_ind=1, - pesticide_exam_ind=0 - )) - db.session.commit() + # -- Office Services ------------------------------------------- + logging.info('--> Office Services') + office_test.services.append(category_back_office) + office_test.services.append(category_msp) + office_test.services.append(category_ptax) + office_test.services.append(category_exams) + office_test.services.append(category_icbc) + office_test.services.append(service_bo1) + office_test.services.append(service_bo2) + office_test.services.append(service_msp1) + office_test.services.append(service_msp2) + office_test.services.append(service_msp6) + office_test.services.append(service_ptax1) + office_test.services.append(service_ptax2) + office_test.services.append(service_ptax4) + office_test.services.append(service_ptax5) + office_test.services.append(service_exams) + office_test.services.append(service_dlkt) + + office_victoria.services.append(category_back_office) + office_victoria.services.append(category_msp) + office_victoria.services.append(category_icbc) + office_victoria.services.append(service_bo1) + office_victoria.services.append(service_bo2) + office_victoria.services.append(service_msp1) + office_victoria.services.append(service_msp2) + office_victoria.services.append(service_msp6) + office_victoria.services.append(service_dlkt) + + office_100.services.append(category_back_office) + office_100.services.append(category_ptax) + office_100.services.append(category_icbc) + office_100.services.append(service_bo1) + office_100.services.append(service_bo2) + office_100.services.append(service_ptax1) + office_100.services.append(service_ptax2) + office_100.services.append(service_ptax4) + office_100.services.append(service_ptax5) + office_100.services.append(service_dlkt) + db.session.commit() - logging.info('--> Booking: Exams - No exams added') - logging.info('--> Booking: Appointments - No appointments added') + # -- Booking / Rooms ------------------------------------------- + logging.info('--> Booking: Rooms') + db.session.add(bookings.Room( + office_id=office_test.office_id, + room_name='Boardroom 1', + capacity=25, + color='#EFD469' + )) + db.session.add(bookings.Room( + office_id=office_test.office_id, + room_name='Turquoise W-135', + capacity=25, + color='#EFD469' + )) + db.session.commit() + # -- Booking / Invigilators ------------------------------------ + logging.info('--> Booking: Invigilators') + db.session.add(bookings.Invigilator( + invigilator_name='Homer Simpson', + office_id=office_test.office_id, + invigilator_notes='He works in a nuclear power plant.', + contact_phone='2502084247', + contact_email='homer.j.simpson@gmail.com', + contract_number='c-000001', + contract_expiry_date='2018-11-30' + )) + db.session.add(bookings.Invigilator( + invigilator_name='Lisa Simpson', + office_id=office_test.office_id, + invigilator_notes='She plays the sax-a-ma-phone during exams', + contact_phone='555-555-5555', + contact_email='lisasimpsonesq@gmail.com', + contract_number='c-000002', + contract_expiry_date='2018-12-31' + )) + db.session.add(bookings.Invigilator( + invigilator_name='Bart Simpson', + office_id=office_test.office_id, + invigilator_notes='Loves using chalk boards to communicate to ' + 'examinees', + contact_phone='555-555-5555', + contact_email='bartwuzhere@gmail.com', + contract_number='c-000003', + contract_expiry_date='2019-01-31' + )) + db.session.add(bookings.Invigilator( + invigilator_name='Pest 1', + office_id=office_pesticide_office.office_id, + invigilator_notes='The first pest invigilator is not a pest', + contact_phone='555-555-5555', + contact_email='pest_invigilator_1@gmail.com', + contract_number='c-000003', + contract_expiry_date='2019-01-31' + )) + db.session.add(bookings.Invigilator( + invigilator_name='Pest 2', + office_id=office_pesticide_office.office_id, + invigilator_notes='The second pest invigilator is a pest', + contact_phone='555-555-5555', + contact_email='pest_invigilator_2@gmail.com', + contract_number='c-000003', + contract_expiry_date='2019-01-31' + )) + db.session.commit() -class MigrateWrapper(Command): - ''' - Wraps flask_migrate's upgrade command to upgrade the database with - any changes that have been made. - ''' + # -- Booking / Exam Types -------------------------------------- + logging.info('--> Booking: Exam Types') + db.session.add(bookings.ExamType( + exam_type_name='COFQ - 3HR Group Exam', + exam_color='#FF69B4', + number_of_hours=3, + method_type='Written', + ita_ind=1, + group_exam_ind=1, + pesticide_exam_ind=0 + )) + db.session.add(bookings.ExamType( + exam_type_name='COFQ - 3HR Single Exam', + exam_color='#FF69B4', + number_of_hours=3, + method_type='Written', + ita_ind=1, + group_exam_ind=0, + pesticide_exam_ind=0 + )) + db.session.add(bookings.ExamType( + exam_type_name='COFQ - 3HR Single Exam - Own Reader', + exam_color='#FF69B4', + number_of_hours=3, + method_type='Written', + ita_ind=1, + group_exam_ind=0, + pesticide_exam_ind=0 + )) + db.session.add(bookings.ExamType( + exam_type_name='COFQ - 3HR Single Exam - SBC Reader', + exam_color='#FF69B4', + number_of_hours=3, + method_type='Written', + ita_ind=1, + group_exam_ind=0, + pesticide_exam_ind=0 + )) + db.session.add(bookings.ExamType( + exam_type_name='COFQ - 3HR Single Exam - Time Extension', + exam_color='#FF69B4', + number_of_hours=3, + method_type='Written', + ita_ind=1, + group_exam_ind=0, + pesticide_exam_ind=0 + )) + db.session.add(bookings.ExamType( + exam_type_name='IPSE - 4HR Group Exam', + exam_color='#FFD701', + number_of_hours=4, + method_type='Written', + ita_ind=1, + group_exam_ind=1, + pesticide_exam_ind=0 + )) + db.session.add(bookings.ExamType( + exam_type_name='IPSE - 4HR Single Exam', + exam_color='#FFD701', + number_of_hours=4, + method_type='Written', + ita_ind=1, + group_exam_ind=0, + pesticide_exam_ind=0 + )) + db.session.add(bookings.ExamType( + exam_type_name='IPSE - 4HR Single Exam - Own Reader', + exam_color='#FFD701', + number_of_hours=4, + method_type='Written', + ita_ind=1, + group_exam_ind=0, + pesticide_exam_ind=0 + )) + db.session.add(bookings.ExamType( + exam_type_name='IPSE - 4HR Single Exam - SBC Reader', + exam_color='#FFD701', + number_of_hours=4, + method_type='Written', + ita_ind=1, + group_exam_ind=0, + pesticide_exam_ind=0 + )) + db.session.add(bookings.ExamType( + exam_type_name='IPSE - 4HR Single Exam - Time Extension', + exam_color='#FFD701', + number_of_hours=4, + method_type='Written', + ita_ind=1, + group_exam_ind=0, + pesticide_exam_ind=0 + )) + db.session.add(bookings.ExamType( + exam_type_name='SLE - 3HR Group Exam', + exam_color='#8FBC8F', + number_of_hours=3, + method_type='Written', + ita_ind=1, + group_exam_ind=1, + pesticide_exam_ind=0 + )) + db.session.add(bookings.ExamType( + exam_type_name='SLE - 3HR Single Exam', + exam_color='#8FBC8F', + number_of_hours=3, + method_type='Written', + ita_ind=1, + group_exam_ind=0, + pesticide_exam_ind=0 + )) + db.session.add(bookings.ExamType( + exam_type_name='SLE - 3HR Single Exam - Own Reader', + exam_color='#8FBC8F', + number_of_hours=3, + method_type='Written', + ita_ind=1, + group_exam_ind=0, + pesticide_exam_ind=0 + )) + db.session.add(bookings.ExamType( + exam_type_name='SLE - 3HR Single Exam - SBC Reader', + exam_color='#8FBC8F', + number_of_hours=3, + method_type='Written', + ita_ind=1, + group_exam_ind=0, + pesticide_exam_ind=0 + )) + db.session.add(bookings.ExamType( + exam_type_name='SLE - 3HR Single Exam - Time Extension', + exam_color='#8FBC8F', + number_of_hours=3, + method_type='Written', + ita_ind=1, + group_exam_ind=0, + pesticide_exam_ind=0 + )) + db.session.add(bookings.ExamType( + exam_type_name='Monthly Session Exam', + exam_color='#FFFFFF', + number_of_hours=4, + method_type='Written', + ita_ind=1, + group_exam_ind=0, + pesticide_exam_ind=0 + )) + db.session.add(bookings.ExamType( + exam_type_name='Veterinary Exam', + exam_color='#FFFFFF', + number_of_hours=2, + method_type='written', + ita_ind=0, + group_exam_ind=0, + pesticide_exam_ind=0 + )) + db.session.add(bookings.ExamType( + exam_type_name='Milk Grader', + exam_color='#FFFFFF', + number_of_hours=2, + method_type='written', + ita_ind=0, + group_exam_ind=0, + pesticide_exam_ind=0 + )) + db.session.add(bookings.ExamType( + exam_type_name='Industrial Vegetation', + exam_color='#FFFFFF', + number_of_hours=3, + method_type='written', + ita_ind=0, + group_exam_ind=0, + pesticide_exam_ind=1 + )) + db.session.add(bookings.ExamType( + exam_type_name='Structural-General', + exam_color='#FFFFFF', + number_of_hours=3, + method_type='written', + ita_ind=0, + group_exam_ind=0, + pesticide_exam_ind=1 + )) + db.session.add(bookings.ExamType( + exam_type_name='Dispenser-Commercial', + exam_color='#FFFFFF', + number_of_hours=1, + method_type='written', + ita_ind=0, + group_exam_ind=0, + pesticide_exam_ind=1 + )) + db.session.add(bookings.ExamType( + exam_type_name='Group Environment Exam', + exam_color='#FFFFFF', + number_of_hours=0, + method_type='written', + ita_ind=0, + group_exam_ind=1, + pesticide_exam_ind=0 + )) + db.session.commit() - def run(self): - ''' - Runs flask_migrate.upgrade() - ''' - logging.info('MigrateWrapper.run()') # Show if pods call it. - upgrade() + logging.info('--> Booking: Exams - No exams added') + logging.info('--> Booking: Appointments - No appointments added') -manager.add_command('adduser', AddAdminCsr()) -manager.add_command('bootstrap', Bootstrap()) -manager.add_command('db', MigrateCommand) -manager.add_command('migrate', MigrateWrapper()) +@application.cli.command('migrate_db') +def migrate_wrapper(): + '''Shortcut for "db upgrade".''' + logging.info('MigrateWrapper.run()') # Show if pods call it. + fm.upgrade() if __name__ == '__main__': - logging.info('Running the Manager') - manager.run() + application.cli() diff --git a/api/postman/API_Test_TheQ_Booking.json b/api/postman/API_Test_TheQ_Booking.json index 9f00e0249..68d2ef7f8 100644 --- a/api/postman/API_Test_TheQ_Booking.json +++ b/api/postman/API_Test_TheQ_Booking.json @@ -1,15938 +1,18457 @@ { - "info": { - "_postman_id": "614e41a1-da60-4f20-be17-c5fd6b52c6d2", - "name": "API_Test_TheQ_Booking Copy6-9", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" - }, - "item": [ - { - "name": "Setup TheQ", - "item": [ - { - "name": "Setup-Variables", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "// See if the use-prefix global has been set. Use default if not.", - "let usePrefix = '';", - "if (pm.globals.get('use-prefix')) {", - " console.log(\"==> use-prefix exists\");", - " usePrefix = pm.globals.get('use-prefix');", - " console.log(\" --> Prefix is: \" + usePrefix);", - " ", - " // Set up all globals, using the correct prefix.", - " pm.globals.set('auth_url', pm.globals.get(usePrefix + 'auth_url'));", - " pm.globals.set('realm', pm.globals.get(usePrefix + 'realm'));", - " pm.globals.set('clientid', pm.globals.get(usePrefix + 'clientid'));", - " pm.globals.set('client_secret', pm.globals.get(usePrefix + 'client_secret'));", - " pm.globals.set('url', pm.globals.get(usePrefix + 'url'));", - "", - " pm.globals.set('public_url', pm.globals.get(usePrefix + 'public_url'));", - " pm.globals.set('public_user_id', pm.globals.get(usePrefix + 'public_user_id'));", - " pm.globals.set('public_user_password', pm.globals.get(usePrefix + 'public_user_password'));", - "}", - "else {", - " console.log(\"==> use-prefix does not exist\");", - " console.log(\" --> No default globals set.\");", - "}", - "", - "// If no maximum load time defined, set a default.", - "if (!pm.globals.get('max_load_time')) {", - " console.log(\"==> max_load_time not present, default set.\");", - " pm.globals.set(\"max_load_time\", JSON.stringify(1503));", - "}", - "", - "// If no maximum response defined, set a default.", - "if (!pm.globals.get('max_response_time')) {", - " console.log(\"==> max_response_time not present, default set.\");", - " pm.globals.set(\"max_response_time\", JSON.stringify(15005));", - "}", - "", - "// Display the values of all globals.", - "console.log(\"\");", - - "console.log(\" --> auth_url: \" + pm.globals.get(\"auth_url\"));", - "console.log(\" --> realm: \" + pm.globals.get(\"realm\"));", - "console.log(\" --> clientid: \" + pm.globals.get(\"clientid\"));", - "console.log(\" --> client_secret: \" + pm.globals.get(\"client_secret\"));", - "console.log(\" --> url: \" + pm.globals.get(\"url\"));", - "console.log(\" --> max_load_time: \" + pm.globals.get(\"max_load_time\"));", - "console.log(\" --> max_response_time: \" + pm.globals.get(\"max_response_time\"));", - "console.log(\" --> public_url: \" + pm.globals.get(\"public_url\"));", - "console.log(\" --> public_user_id: \" + pm.globals.get(\"public_user_id\"));", - "console.log(\" --> public_user_id: \" + pm.globals.get(\"public_user_password\"));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Dummy data." - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Auth-First", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"auth_first\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "auth_url = globals.auth_url;\nrealm = globals.realm;\nclientid = globals.clientid;\nuserid = globals.userid;\npassword = globals.password;\nclient_secret = globals.client_secret;\n\nconst echoPostRequest = {\n url: auth_url + '/auth/realms/' + realm + '/protocol/openid-connect/token',\n method: 'POST',\n header: 'Content-Type:application/x-www-form-urlencoded',\n body: {\n mode: 'raw',\n raw: 'grant_type=password&client_id=' + clientid \n + '&username=' + userid \n + '&password=' + password\n + '&client_secret=' + client_secret\n }\n};\npm.sendRequest(echoPostRequest, function (err, res) {\n var jsonData = res.json();\n if (jsonData.hasOwnProperty('access_token')) {\n \tpm.globals.set(\"token\", jsonData.access_token);\n\t pm.globals.set(\"refresh_token\", jsonData.refresh_token);\n\t if (err) {\n\t console.log(err);\n\t }\n\t // console.log(err ? err : res.json());\n\t} else {\n\t pm.globals.set(\"token\", 0);\n\t pm.globals.set(\"refresh_token\", 0);\n\t pm.globals.set(\"token_expires\", 0);\n\t pm.globals.set(\"refresh_token_expires\", 0);\n\t}\n});" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Auth-Script", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"auth_script\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "auth_url = globals.auth_url;\nrealm = globals.realm;\nclientid = globals.clientid;\nuserid = globals.userid;\npassword = globals.password;\nclient_secret = globals.client_secret;\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-AuthToken-Script", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"auth_token_script\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "auth_url = globals.auth_url;\nrealm = globals.realm;\nclientid = globals.clientid;\nuserid = globals.userid;\npassword = globals.password;\nclient_secret = globals.client_secret;\n\nconst echoPostRequest = {\n url: authurl + '/auth/realms/' + realm + '/protocol/openid-connect/token',\n method: 'POST',\n header: 'Content-Type:application/x-www-form-urlencoded',\n body: {\n mode: 'raw',\n raw: 'grant_type=password&client_id=' + clientid \n + '&username=' + userid \n + '&password=' + password\n + '&client_secret=' + client_secret\n }\n};\n\npm.sendRequest(echoPostRequest, function (err, res) {\n if (err) { console.log(err); }\n else {\n var jsonData = res.json();\n pm.globals.set(\"token\", jsonData.access_token);\n pm.globals.set(\"refresh_token\", jsonData.refresh_token);\n pm.globals.set(\"token_expires\", Date.now()+(jsonData.expires_in * 1000));\n pm.globals.set(\"refresh_token_expires\", Date.now()+(jsonData.refresh_expires_in * 1000));\n }\n //console.log(err ? err : res.json());\n});" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-AuthRefresh-Script", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"auth_refresh_script\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "auth_url = globals.auth_url;\nrealm = globals.realm;\nclientid = globals.clientid;\nrefresh_token = environment.refresh_token;\nclient_secret = globals.client_secret;\n\nconst echoPostRequest = {\n url: authurl +'/auth/realms/' +realm + '/protocol/openid-connect/token',\n method: 'POST',\n header: 'Content-Type:application/x-www-form-urlencoded',\n body: {\n mode: 'raw',\n raw: 'grant_type=refresh_token&client_id=' + clientid \n + '&refresh_token=' + refresh_token \n + '&client_secret=' + client_secret\n }\n};\n\npm.sendRequest(echoPostRequest, function (err, res) {\n var jsonData = res.json();\n pm.globals.set(\"token\", jsonData.access_token);\n pm.globals.set(\"refresh_token\", jsonData.refresh_token);\n pm.globals.set(\"token_expires\", Date.now()+(jsonData.expires_in * 1000));\n pm.globals.set(\"refresh_token_expires\", Date.now()+(jsonData.refresh_expires_in * 1000));\n\n console.log(err ? err : res.json());\n});" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Basic-Response-Tests", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"basic_response_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Get the maximum response time allowed.\r\nmax_response_time = JSON.parse(globals.max_response_time);\r\n\r\n// Check to make sure the response time was within the maximum allowed.\r\npm.test('Response time less than ' + max_response_time.toString() + 'ms', function(){\r\n pm.expect(pm.response.responseTime).to.be.below(max_response_time);\r\n});\r\n\r\n// Other tests.\r\npm.test(\"Response code for request is 200\", function(){\r\n pm.response.to.have.status(200);\r\n});\r\npm.test('Response header should have Content-Type of application/json', function() {\r\n pm.response.to.have.header('content-type', 'application/json');\r\n});\r\npm.test('Response body be in JSON format', function() {\r\n pm.response.to.be.json; \r\n});" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Complex-Response-Tests", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"complex_response_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Get the maximum response time allowed.\nmax_response_time = JSON.parse(globals.max_response_time);\n\n// Check to make sure the response time was within the maximum allowed.\npm.test('Response time less than ' + max_response_time.toString() + 'ms', function(){\n pm.expect(pm.response.responseTime).to.be.below(max_response_time);\n});\n\n// Other tests.\npm.test(\"Response code for request is 200\", function(){\n pm.response.to.have.status(200);\n});\npm.test('Response header should have Content-Type of application/json', function() {\n pm.response.to.have.header('content-type', 'application/json');\n});\npm.test('Response body be in JSON format', function() {\n pm.response.to.be.json; \n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Create-Response-Tests", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"create_response_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Get the maximum response time allowed.\nmax_response_time = JSON.parse(globals.max_response_time);\n\n// Check to make sure the response time was within the maximum allowed.\npm.test('Response time less than ' + max_response_time.toString() + 'ms', function(){\n pm.expect(pm.response.responseTime).to.be.below(max_response_time);\n});\n\n// Other tests.\npm.test(\"Response status code should be 201 CREATED\", function(){\n pm.response.to.have.status(201);\n});\npm.test('Response header should have Content-Type of application/json', function() {\n pm.response.to.have.header('content-type', 'application/json');\n});\npm.test('Response body be in JSON format', function() {\n pm.response.to.be.json; \n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Citizen-Response-Tests", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"citizen_response_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "var citizenSchema = {\n \"type\" : \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"accurate_time_ind\": {\"type\": \"number\"},\n \"ticket_number\": {\"type\": [\"null\", \"string\"]},\n \"citizen_name\": {\"type\": [\"null\", \"string\"]},\n \"qt_xn_citizen_ind\": {\"type\": \"number\"},\n \"user_id\": {\"type\": [\"null\", \"number\"]},\n \"service_reqs\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"channel\": {\n \"type\": \"object\",\n \"properties\": {\n \"channel_name\": {\"type\": \"string\"}\n },\n \"required\": [\"channel_name\"]\n },\n \"channel_id\": {\"type\": \"number\"},\n \"citizen_id\": {\"type\": \"number\"},\n \"periods\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"csr\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter_id\": {\"type\": \"number\"},\n \"qt_xn_csr_ind\": {\"type\": \"number\"},\n \"username\": {\"type\": \"string\"},\n },\n \"required\": [\"counter_id\", \"qt_xn_csr_ind\", \"username\"]\n },\n \"csr_id\": {\"type\": \"number\"},\n \"period_id\": {\"type\": \"number\"},\n \"ps\": {\n \"type\": \"object\",\n \"properties\": {\n \"ps_name\": {\"type\": \"string\"}\n },\n \"required\": [\"ps_name\"]\n },\n \"ps_id\": {\"type\": \"number\"},\n \"time_end\": {\"type\": [\"null\", \"string\"]},\n \"time_start\": {\"type\": \"string\"}\n },\n \"required\": [\"csr\", \"csr_id\", \"period_id\", \"ps\", \"ps_id\", \"time_end\", \"time_start\"]\n }\n },\n \"quantity\": {\"type\": \"number\"},\n \"service\": {\n \"type\": \"object\",\n \"properties\": {\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"},\n },\n \"required\": [\"external_service_name\", \"online_availability\", \"online_link\", \"parent\", \"parent_id\", \"service_name\"]\n },\n \"service_id\": {\"type\": \"number\"},\n \"sr_id\": {\"type\": \"number\"},\n \"sr_number\": {\"type\": \"number\"},\n \"sr_state\": {\n \"type\": \"object\",\n \"properties\": {\n \"sr_code\": {\"type\": \"string\"}\n },\n \"required\": [\"sr_code\"]\n }\n },\n \"required\": [\"channel\", \"channel_id\", \"citizen_id\", \"periods\", \"quantity\", \"service\", \"service_id\",\n \"sr_id\", \"sr_number\", \"sr_state\"]\n }\n },\n \"user\": {\"type\": [\"null\", \"object\"]},\n \"citizen_id\": {\"type\": \"number\"},\n \"counter_id\": {\"type\": [\"null\", \"number\"]},\n \"counter\": {\"type\": [\"null\", \"number\"]},\n \"start_time\": {\"type\": \"string\"},\n \"citizen_comments\": {\"type\": [\"null\", \"string\"]},\n \"priority\": {\"type\": \"number\"},\n \"cs\": {\n \"type\": \"object\",\n \"properties\": {\n \"cs_state_name\": {\"type\": \"string\"}\n },\n \"required\": [\"cs_state_name\"]\n },\n \"office_id\": {\"type\": \"number\"},\n },\n \"required\": [\"accurate_time_ind\", \"ticket_number\", \"citizen_name\", \"qt_xn_citizen_ind\", \"user_id\",\n \"service_reqs\", \"citizen_id\", \"counter_id\", \"start_time\",\n \"citizen_comments\", \"priority\", \"cs\", \"office_id\"]\n },\n};\n\n// Declare, initialize variables.\nvar allElements = null;\n\nif (jsonData.hasOwnProperty(\"citizens\")) {\n\tallElements = jsonData.citizens;\n};\n\nif (jsonData.hasOwnProperty(\"citizen\")) {\n\tallElements = [];\n\tallElements.push(jsonData.citizen);\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Citizen Schema\", function(){\n pm.expect(tv4.validate(allElements, citizenSchema)).to.be.true;\n});\n\nvar elementCount = 0;\n\n// If there are some citizens, proceed with tests.\nif (allElements !== null) {\n\n // Loop to validate schema of each channel, create list of citizen ids.\n allElements.forEach(function(element) {\n elementCount ++;\n var testTitle = \"Citizen (\" + elementCount + \"): \" + element.citizen_id + \" - \";\n // tests[testTitle + \"conforms to schema\"] = tv4.validate(element, citizenSchema);\n\n //Test to see if response schema is valid\n pm.test(testTitle + \"conforms to schema\", function(){\n pm.expect(tv4.validate(allElements, citizenSchema)).to.be.true;\n });\n\n\n // Test the authenticate response.\n pm.test(testTitle + \"qt_xn_citizen_ind must be 0 or 1\", function() {\n pm.expect(element.qt_xn_citizen_ind).to.be.within(0,1);\n });\n });\n};" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Service-Schema-Tests", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"service_schema_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the schema.\nvar serviceSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"data\": {\n \n \"properties\": {\n \"services\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"timeslot_duration\": {\"type\": [\"null\", \"number\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"service_name\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"actual_service_ind\": {\"type\": \"number\"},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]}\n },\n \"required\": [\"deleted\", \"display_dashboard_ind\", \"timeslot_duration\", \"parent\",\n \"service_name\", \"service_code\", \"actual_service_ind\", \"online_link\",\n \"service_desc\", \"service_id\", \"parent_id\", \"prefix\", \"online_availability\",\n \"external_service_name\"]\n }\n },\n \"errors\": {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"services\", \"errors\"],\n}\n}\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Service Schema\", function(){\n pm.expect(tv4.validate(jsonData, serviceSchema)).to.be.true;\n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Service-Request-Tests", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"service_request_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "var schema = {\n \"properties\" : {\n \"channel\" : {\n \"type\" : \"object\",\n \"properties\": {\n \"challen_name\": {\"type\": \"string\"}\n },\n \"required\": [\"channel_name\"]\n },\n \"channel_id\" : {\"type\" : \"number\"},\n \"citizen\" : {\n \"type\" : \"object\",\n \"properties\": {\n \"accurate_time_ind\": {\"type\": \"number\"},\n \"ticket_number\": {\"type\": \"string\"},\n \"citizen_name\": {\"type\": \"string\"},\n \"qt_xn_citizen_ind\": {\"type\": \"number\"},\n \"user_id\": {\"type\": \"null\"},\n \"user\": {\"type\": \"null\"},\n \"citizen_id\": {\"type\": \"number\"},\n \"counter_id\": {\"type\": \"number\"},\n \"counter\": {\"type\": \"number\"},\n \"start_time\": {\"type\": \"string\"},\n \"citizen_comments\": {\"type\": \"string\"},\n \"priority\": {\"type\": \"number\"},\n \"cs\": {\n \"type\": \"object\",\n \"properties\": {\n \"cs_state_name\": {\"type\": \"string\"}\n },\n \"required\": [\"cs_state_name\"]\n },\n \"office_id\": {\"type\": \"number\"},\n },\n \"required\": [\"accurate_time_ind\", \"ticket_number\", \"citizen_name\", \"qt_xn_citizen_ind\",\n \"user_id\", \"citizen_id\", \"counter_id\", \"start_time\",\n \"citizen_comments\", \"priority\", \"cs\", \"office_id\"]\n },\n \"citizen_id\" : {\"type\" : \"number\"},\n \"periods\" : {\n \"type\" : \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"csr\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter_id\": {\"type\": \"number\"},\n \"qt_xn_csr_ind\": {\"type\": \"number\"},\n \"username\": {\"type\": \"string\"},\n },\n \"required\": [\"counter_id\", \"qt_xn_csr_ind\", \"username\"]\n },\n \"csr_id\": {\"type\": \"number\"},\n \"period_id\": {\"type\": \"number\"},\n \"ps\": {\n \"type\": \"object\",\n \"properties\": {\n \"ps_name\": {\"type\": \"string\"}\n },\n \"required\": [\"ps_name\"]\n },\n \"ps_id\": {\"type\": \"number\"},\n \"time_end\": {\"type\": [\"null\", \"string\"]},\n \"time_start\": {\"type\": \"string\"}\n },\n \"required\": [\"csr\", \"csr_id\", \"period_id\", \"ps\", \"ps_id\",\n \"time_end\", \"time_start\"]\n }\n },\n \"quantity\" : {\"type\" : \"number\"},\n \"service\" : {\n \"type\" : \"object\",\n \"properties\": {\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"},\n },\n \"required\": [\"external_service_name\", \"online_availability\", \"online_link\",\n \"parent\", \"parent_id\", \"service_name\"]\n },\n \"service_id\" : {\"type\" : \"number\"},\n \"sr_id\" : {\"type\" : \"number\"},\n \"sr_number\": {\"type\": \"number\"},\n \"sr_state\" : {\n \"type\" : \"object\",\n \"properties\": {\n \"sr_code\": {\"type\": \"string\"}\n },\n \"required\": [\"sr_code\"]\n }\n },\n \"required\" : [\n \t\"sr_id\", \"sr_state\", \"periods\", \"service\", \"citizen\", \"quantity\",\n \t\"service_id\", \"citizen_id\", \"channel\", \"channel_id\"\n ]\n};\n\n// Declare, initialize variables.\nvar allElements = null;\n\nif (jsonData.hasOwnProperty(\"service_requests\")) {\n\tallElements = jsonData.service_requests;\n};\n\nif (jsonData.hasOwnProperty(\"service_request\")) {\n allElements = [];\n\tallElements.push(jsonData.service_request);\n}\n\nvar elementCount = 0;\n\n// If there are some service requests, proceed with tests.\nif (allElements !== null) {\n\n // Loop to validate schema of each service request.\n allElements.forEach(function(element) {\n elementCount ++;\n var testTitle = \"Service Request (\" + elementCount + \"): \" + element.sr_id + \" - \";\n tests[testTitle + \"conforms to schema\"] = tv4.validate(element, schema);\n });\n};" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-One-Service-Request-Tests", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"one_service_request_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "var serviceRequestSchema = {\n \"type\": \"object\",\n \"properties\" : {\n \"service_request\": {\n \"type\": \"object\",\n \"properties\": {\n \"channel\" : {\n \"type\" : \"object\",\n \"properties\": {\n \"channel_name\": {\"type\": \"string\"}\n },\n \"required\": [\"channel_name\"]\n },\n \"channel_id\" : {\"type\" : \"number\"},\n \"citizen\" : {\n \"type\" : \"object\",\n \"properties\": {\n \"cs\": {\n \"type\": \"object\",\n \"properties\": {\n \"cs_state_name\": {\"type\": \"string\"}\n },\n \"required\": [\"cs_state_name\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"priority\": {\"type\": \"number\"},\n \"start_time\": {\"type\": \"string\"},\n \"citizen_id\": {\"type\": \"number\"},\n \"citizen_name\": {\"type\": [\"null\", \"string\"]},\n \"qt_xn_citizen_ind\": {\"type\": \"number\"},\n \"user_id\": {\"type\": [\"null\", \"number\"]},\n \"counter_id\": {\"type\": \"number\"},\n \"counter\": {\"type\": \"number\"},\n \"citizen_comments\": {\"type\": \"string\"},\n \"accurate_time_ind\": {\"type\": \"number\"},\n \"ticket_number\": {\"type\": [\"null\", \"string\"]},\n \"user\": {\"type\": [\"null\", \"object\"]}\n },\n \"required\": [\"cs\", \"office_id\", \"priority\", \"start_time\", \"citizen_id\", \"citizen_name\", \"qt_xn_citizen_ind\",\n \"user_id\", \"counter_id\", \"citizen_comments\", \"accurate_time_ind\", \"ticket_number\"]\n },\n \"citizen_id\" : {\"type\" : \"number\"},\n \"periods\" : {\n \"type\" : \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"csr\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter_id\": {\"type\": \"number\"},\n \"qt_xn_csr_ind\": {\"type\": \"number\"},\n \"username\": {\"type\": \"string\"}\n },\n \"required\": [\"counter_id\", \"qt_xn_csr_ind\", \"username\"]\n },\n \"csr_id\": {\"type\": \"number\"},\n \"period_id\": {\"type\": \"number\"},\n \"ps\": {\n \"type\": \"object\",\n \"properties\": {\n \"ps_name\": {\"type\": \"string\"}\n },\n \"required\": [\"ps_name\"]\n },\n \"ps_id\": {\"type\": \"number\"},\n \"time_end\": {\"type\": [\"null\", \"string\"]},\n \"time_start\": {\"type\": \"string\"}\n },\n \"required\": [\"csr\", \"csr_id\", \"period_id\", \"ps\", \"ps_id\", \"time_end\", \"time_start\"]\n }\n },\n \"quantity\" : {\"type\" : \"number\"},\n \"service\" : {\n \"type\" : \"object\",\n \"properties\": {\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n }\n }\n },\n \"service_id\" : {\"type\" : \"number\"},\n \"sr_id\" : {\"type\" : \"number\"},\n \"sr_number\": {\"type\": \"number\"},\n \"sr_state\" : {\n \"type\" : \"object\",\n \"properties\": {\n \"sr_code\": {\"type\": \"string\"}\n },\n \"required\": [\"sr_code\"]\n },\n },\n \"required\" : [\"channel\", \"channel_id\", \"citizen\", \"citizen_id\", \"periods\",\n \"quantity\", \"service\", \"service_id\", \"sr_id\", \"sr_number\", \"sr_state\"]\n },\n \"errors\": {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"service_request\", \"errors\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Service Request Schema\", function(){\n pm.expect(tv4.validate(jsonData, serviceRequestSchema)).to.be.true;\n});" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Get-Active-Citizens-Tests", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"get_active_citizens_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Declare and initialize variables.\nvar elementCount = 0;\nvar srCount = 0;\nvar isFirstCitizen = true;\n\n\n// Loop to create list of active citizen ids.\nallElements.forEach(function(element) {\n srCount = element.service_reqs.length;\n\n // If citizen active, add to the list.\n if (element.cs.cs_state_name === \"Active\") {\n //console.log(\"Citizen (\" + elementCount + \") \" + element.citizen_id +\n // \" Active: SRCount = \" + srCount);\n citizenIds.push(element.citizen_id);\n\n // Save the first citizen.\n if (isFirstCitizen) {\n currentCitizen = element;\n isFirstCitizen = false;\n }\n }\n \n // Increment count.\n elementCount++;\n});" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-CSR-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"csr_schema_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the JSON Schema expected in response\nvar csrSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"csr\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter\": {\"type\": \"number\"},\n \"counter_id\": {\"type\": \"number\"},\n \"csr_id\": {\"type\": \"number\"},\n \"csr_state\": {\n \"type\": \"object\",\n \"properties\": {\n \"csr_state_desc\": {\"type\": \"string\"},\n \"csr_state_id\": {\"type\": \"number\"},\n \"csr_state_name\": {\"type\": \"string\"}\n },\n \"required\": [\"csr_state_desc\", \"csr_state_id\", \"csr_state_name\"]\n },\n \"csr_state_id\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"finance_designate\": {\"type\": \"number\"},\n \"ita2_designate\": {\"type\": \"number\"},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointment_duration\": {\"type\": [\"null\", \"number\"]},\n \"appointments_days_limit\": {\"type\": [\"null\", \"number\"]},\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"back_office_list\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"actual_service_ind\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\",\n \"external_service_name\", \"online_availability\",\n \"online_link\", \"parent\", \"parent_id\", \"prefix\",\n \"service_code\", \"service_desc\", \"service_id\",\n \"service_name\"]\n },\n },\n \"civic_address\": {\"type\": [\"null\", \"string\"]},\n \"counters\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter_id\": {\"type\": \"number\"},\n \"counter_name\": {\"type\": \"string\"}\n },\n \"required\": [\"counter_id\", \"counter_name\"]\n },\n },\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"latitude\": {\"type\": \"number\"},\n \"longitude\": {\"type\": \"number\"},\n \"max_person_appointment_per_day\": {\"type\": [\"null\", \"number\"]},\n \"office_appointment_message\": {\"type\": [\"null\", \"string\"]},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"online_status\": {\"type\": \"string\"},\n \"quick_list\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"actual_service_ind\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\",\n \"external_service_name\", \"online_availability\",\n \"online_link\", \"parent\", \"parent_id\", \"prefix\",\n \"service_code\", \"service_desc\", \"service_id\",\n \"service_name\"]\n },\n },\n \"sb\": {\n \"type\": \"object\",\n \"properties\": {\n \"sb_id\": {\"type\": \"number\"},\n \"sb_type\": {\"type\": \"string\"}\n },\n \"required\": [\"sb_id\", \"sb_type\"]\n },\n \"sb_id\": {\"type\": \"number\"},\n \"telephone\": {\"type\": [\"null\", \"string\"]},\n \"timeslots\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"day_of_week\": {\"type\": [\"null\", \"array\"]},\n \"end_time\": {\"type\": \"string\"},\n \"no_of_slots\": {\"type\": \"number\"},\n \"office\": {\"type\": [\"null\", \"number\"]},\n \"start_time\": {\"type\": \"string\"}\n },\n \"required\": [\"day_of_week\", \"end_time\", \"no_of_slots\",\n \"office\", \"start_time\"]\n },\n },\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n }\n },\n \"required\": [\"appointment_duration\", \"appointments_days_limit\",\n \"appointments_enabled_ind\", \"back_office_list\", \"civic_address\",\n \"counters\", \"exams_enabled_ind\", \"latitude\",\n \"longitude\", \"max_person_appointment_per_day\",\n \"office_appointment_message\", \"office_id\", \"office_name\",\n \"office_number\", \"online_status\", \"quick_list\", \"sb\", \"sb_id\",\n \"telephone\", \"timeslots\", \"timezone\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"office_manager\": {\"type\": \"number\"},\n \"pesticide_designate\": {\"type\": \"number\"},\n \"qt_xn_csr_ind\": {\"type\": \"number\"},\n \"receptionist_ind\": {\"type\": \"number\"},\n \"role\": {\n \"type\": \"object\",\n \"properties\": {\n \"role_code\": {\"type\": \"string\"},\n \"role_desc\": {\"type\": \"string\"},\n \"role_id\": {\"type\": \"number\"}\n },\n \"required\": [\"role_code\", \"role_desc\", \"role_id\"]\n },\n \"role_id\": {\"type\": \"number\"},\n \"username\": {\"type\": \"string\"}\n },\n \"required\": [\"counter\", \"counter_id\", \"csr_id\", \"csr_state\",\n \"csr_state_id\", \"deleted\", \"finance_designate\",\n \"ita2_designate\", \"office_id\", \"office_manager\",\n \"pesticide_designate\", \"qt_xn_csr_ind\", \"receptionist_ind\",\n \"role\", \"role_id\", \"username\"]\n },\n \"attention_needed\": {\"type\": \"boolean\"},\n \"active_citizens\": {\"type\": \"array\"},\n \"back_office_display\": {\"type\": \"string\"},\n \"recurring_feature_flag\": {\"type\": \"string\"},\n \"errors\": {}\n },\n \"required\": [\"csr\", \"attention_needed\", \"active_citizens\",\n \"back_office_display\", \"recurring_feature_flag\", \"errors\"],\n};\n\n//Test to see if response schema is valid" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-One-CSR-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"onecsr_schema_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the JSON Schema expected in response\nvar csrSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"csr\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter\": {\"type\": \"number\"},\n \"counter_id\": {\"type\": \"number\"},\n \"csr_id\": {\"type\": \"number\"},\n \"csr_state\": {\n \"type\": \"object\",\n \"properties\": {\n \"csr_state_desc\": {\"type\": \"string\"},\n \"csr_state_id\": {\"type\": \"number\"},\n \"csr_state_name\": {\"type\": \"string\"}\n },\n \"required\": [\"csr_state_desc\", \"csr_state_id\", \"csr_state_name\"]\n },\n \"csr_state_id\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"finance_designate\": {\"type\": \"number\"},\n \"ita2_designate\": {\"type\": \"number\"},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointment_duration\": {\"type\": [\"null\", \"number\"]},\n \"appointments_days_limit\": {\"type\": [\"null\", \"number\"]},\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"back_office_list\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"actual_service_ind\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\",\n \"external_service_name\", \"online_availability\",\n \"online_link\", \"parent\", \"parent_id\", \"prefix\",\n \"service_code\", \"service_desc\", \"service_id\",\n \"service_name\"]\n },\n },\n \"civic_address\": {\"type\": [\"null\", \"string\"]},\n \"counters\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter_id\": {\"type\": \"number\"},\n \"counter_name\": {\"type\": \"string\"}\n },\n \"required\": [\"counter_id\", \"counter_name\"]\n },\n },\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"latitude\": {\"type\": \"number\"},\n \"longitude\": {\"type\": \"number\"},\n \"max_person_appointment_per_day\": {\"type\": [\"null\", \"number\"]},\n \"office_appointment_message\": {\"type\": [\"null\", \"string\"]},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"online_status\": {\"type\": \"string\"},\n \"quick_list\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"actual_service_ind\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\",\n \"external_service_name\", \"online_availability\",\n \"online_link\", \"parent\", \"parent_id\", \"prefix\",\n \"service_code\", \"service_desc\", \"service_id\",\n \"service_name\"]\n },\n },\n \"sb\": {\n \"type\": \"object\",\n \"properties\": {\n \"sb_id\": {\"type\": \"number\"},\n \"sb_type\": {\"type\": \"string\"}\n },\n \"required\": [\"sb_id\", \"sb_type\"]\n },\n \"sb_id\": {\"type\": \"number\"},\n \"telephone\": {\"type\": [\"null\", \"string\"]},\n \"timeslots\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"day_of_week\": {\"type\": [\"null\", \"array\"]},\n \"end_time\": {\"type\": \"string\"},\n \"no_of_slots\": {\"type\": \"number\"},\n \"office\": {\"type\": [\"null\", \"number\"]},\n \"start_time\": {\"type\": \"string\"}\n },\n \"required\": [\"day_of_week\", \"end_time\", \"no_of_slots\",\n \"office\", \"start_time\"]\n },\n },\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n }\n },\n \"required\": [\"appointment_duration\", \"appointments_days_limit\",\n \"appointments_enabled_ind\", \"back_office_list\", \"civic_address\",\n \"counters\", \"exams_enabled_ind\", \"latitude\",\n \"longitude\", \"max_person_appointment_per_day\",\n \"office_appointment_message\", \"office_id\", \"office_name\",\n \"office_number\", \"online_status\", \"quick_list\", \"sb\", \"sb_id\",\n \"telephone\", \"timeslots\", \"timezone\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"office_manager\": {\"type\": \"number\"},\n \"pesticide_designate\": {\"type\": \"number\"},\n \"qt_xn_csr_ind\": {\"type\": \"number\"},\n \"receptionist_ind\": {\"type\": \"number\"},\n \"role\": {\n \"type\": \"object\",\n \"properties\": {\n \"role_code\": {\"type\": \"string\"},\n \"role_desc\": {\"type\": \"string\"},\n \"role_id\": {\"type\": \"number\"}\n },\n \"required\": [\"role_code\", \"role_desc\", \"role_id\"]\n },\n \"role_id\": {\"type\": \"number\"},\n \"username\": {\"type\": \"string\"}\n },\n \"required\": [\"counter\", \"counter_id\", \"csr_id\", \"csr_state\",\n \"csr_state_id\", \"deleted\", \"finance_designate\",\n \"ita2_designate\", \"office_id\", \"office_manager\",\n \"pesticide_designate\", \"qt_xn_csr_ind\", \"receptionist_ind\",\n \"role\", \"role_id\", \"username\"]\n },\n \"errors\" : {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"csr\", \"errors\"]\n};\n\n//Test to see if response schema is valid" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Many-CSRs-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"manycsrs_schema_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the JSON Schema expected in response\nvar manyCsrsSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"csrs\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter\": {\"type\": \"number\"},\n \"counter_id\": {\"type\": \"number\"},\n \"csr_id\": {\"type\": \"number\"},\n \"csr_state\": {\n \"type\": \"object\",\n \"properties\": {\n \"csr_state_desc\": {\"type\": \"string\"},\n \"csr_state_id\": {\"type\": \"number\"},\n \"csr_state_name\": {\"type\": \"string\"}\n },\n \"required\": [\"csr_state_desc\", \"csr_state_id\", \"csr_state_name\"]\n },\n \"csr_state_id\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"finance_designate\": {\"type\": \"number\"},\n \"ita2_designate\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_manager\": {\"type\": \"number\"},\n \"pesticide_designate\": {\"type\": \"number\"},\n \"qt_xn_csr_ind\": {\"type\": \"number\"},\n \"receptionist_ind\": {\"type\": \"number\"},\n \"role\": {\n \"type\": \"object\",\n \"properties\": {\n \"role_code\": {\"type\": \"string\"},\n \"role_desc\": {\"type\": \"string\"},\n \"role_id\": {\"type\": \"number\"}\n },\n \"required\": [\"role_code\", \"role_desc\", \"role_id\"]\n },\n \"role_id\": {\"type\": \"number\"},\n \"username\": {\"type\": \"string\"}\n },\n \"required\": [\"counter\", \"counter_id\", \"csr_id\", \"csr_state\",\n \"csr_state_id\", \"deleted\", \"finance_designate\",\n \"ita2_designate\", \"office_id\", \"office_manager\",\n \"pesticide_designate\", \"qt_xn_csr_ind\", \"receptionist_ind\",\n \"role\", \"role_id\", \"username\"]\n }\n }\n }\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate many CSRs Schema\", function(){\n pm.expect(tv4.validate(jsonData, manyCsrsSchema)).to.be.true;\n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Office-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"office_schema_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the JSON Schema expected in response\nvar officeSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"appointment_duration\": {\"type\": [\"null\", \"number\"]},\n \"appointments_days_limit\": {\"type\": [\"null\", \"number\"]},\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"back_office_list\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"actual_service_ind\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\",\n \"external_service_name\", \"online_availability\",\n \"online_link\", \"parent\", \"parent_id\", \"prefix\",\n \"service_code\", \"service_desc\", \"service_id\",\n \"service_name\"]\n },\n },\n \"civic_address\": {\"type\": [\"null\", \"string\"]},\n \"counters\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter_id\": {\"type\": \"number\"},\n \"counter_name\": {\"type\": \"string\"}\n },\n \"required\": [\"counter_id\", \"counter_name\"]\n },\n },\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"latitude\": {\"type\": \"number\"},\n \"longitude\": {\"type\": \"number\"},\n \"max_person_appointment_per_day\": {\"type\": [\"null\", \"number\"]},\n \"office_appointment_message\": {\"type\": [\"null\", \"string\"]},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"online_status\": {\"type\": \"string\"},\n \"quick_list\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"actual_service_ind\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\",\n \"external_service_name\", \"online_availability\",\n \"online_link\", \"parent\", \"parent_id\", \"prefix\",\n \"service_code\", \"service_desc\", \"service_id\",\n \"service_name\"]\n },\n },\n \"sb\": {\n \"type\": \"object\",\n \"properties\": {\n \"sb_id\": {\"type\": \"number\"},\n \"sb_type\": {\"type\": \"string\"}\n },\n \"required\": [\"sb_id\", \"sb_type\"]\n },\n \"sb_id\": {\"type\": \"number\"},\n \"telephone\": {\"type\": [\"null\", \"string\"]},\n \"timeslots\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"day_of_week\": {\"type\": [\"null\", \"array\"]},\n \"end_time\": {\"type\": \"string\"},\n \"no_of_slots\": {\"type\": \"number\"},\n \"office\": {\"type\": [\"null\", \"number\"]},\n \"start_time\": {\"type\": \"string\"}\n },\n \"required\": [\"day_of_week\", \"end_time\", \"no_of_slots\",\n \"office\", \"start_time\"]\n },\n },\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n }\n },\n \"required\": [\"appointment_duration\", \"appointments_days_limit\",\n \"appointments_enabled_ind\", \"back_office_list\", \"civic_address\",\n \"counters\", \"exams_enabled_ind\", \"latitude\",\n \"longitude\", \"max_person_appointment_per_day\",\n \"office_appointment_message\", \"office_id\", \"office_name\",\n \"office_number\", \"online_status\", \"quick_list\", \"sb\", \"sb_id\",\n \"telephone\", \"timeslots\", \"timezone\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate the Office Schema\", function(){\n pm.expect(tv4.validate(jsonData, officeSchema)).to.be.true;\n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-All-Offices-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"all_office_schema_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the JSON Schema expected in response\nvar allOfficeSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"offices\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"max_person_appointment_per_day\": {\"type\": \"number\"},\n \"telephone\": {\"type\": [\"null\", \"string\"]},\n \"appointment_days_limit\": {\"type\": \"number\"},\n \"online_status:\": {\"type\": \"string\"},\n \"sb_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n },\n \"office_number\": {\"type\": \"number\"},\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"sb\": {\n \"type\": \"object\",\n \"properties\": {\n \"sb_id\": {\"type\": \"number\"},\n \"sb_type\": {\"type\": \"string\"}\n },\n \"required\": [\"sb_id\", \"sb_type\"]\n },\n \"civic_address\": {\"type\": [\"null\", \"string\"]},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_appointment_message\": {\"type\": [\"null\", \"string\"]},\n \"latitude\": {\"type\": [\"null\", \"number\"]},\n \"counters\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter_id\": {\"type\": \"number\"},\n \"counter_name\": {\"type\": \"string\"}\n },\n \"required\": [\"counter_id\", \"counter_name\"]\n }\n },\n \"back_office_list\": {\"type\": \"array\"},\n \"longitude\": {\"type\": [\"null\", \"number\"]},\n \"appointment_duration\": {\"type\": \"number\"},\n \"quick_list\": {\"type\": \"array\"},\n \"timeslots\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"day_of_week\": {\"type\": \"array\"},\n \"end_time\": {\"type\": \"string\"},\n \"no_of_slots\": {\"type\": \"number\"},\n \"office\": {\"type\": \"number\"},\n \"start_time\": {\"type\": \"string\"}\n },\n \"required\": [\"day_of_week\", \"end_time\", \"no_of_slots\", \"office\", \"start_time\"]\n }\n }\n },\n }\n },\n \"errors\": {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"offices\", \"errors\"]\n};" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Video-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"video_schema_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the JSON Schema expected in response\nvar videoSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"videofiles\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\"type\": \"string\"},\n \"date\": {\"type\": \"string\"},\n \"size\": {\"type\": \"string\"}\n },\n \"required\": [\"name\", \"date\", \"size\"]\n }\n },\n \"manifest\": {\"type\": \"string\"},\n \"errors\": {\"type\": \"string\"},\n \"code\": {\"type\": \"number\"},\n \"space\": {\n \"type\": \"object\",\n \"properties\": {\n \"total\": {\"type\": \"number\"},\n \"used\": {\"type\": \"number\"},\n \"freespace\": {\"type\": \"number\"}\n },\n \"required\": [\"total\", \"used\", \"freespace\"]\n }\n },\n \"required\": [\"videofiles\", \"manifest\", \"errors\", \"code\", \"space\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate the Videofiles Schema\", function(){\n pm.expect(tv4.validate(jsonData, videoSchema)).to.be.true;\n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - } - ], - "description": "This folder performs basic authentication features." - }, - { - "name": "Check app health", - "item": [ - { - "name": "Check healthz driver TheQ", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Get the maximum response time allowed.", - "max_load_time = JSON.parse(globals.max_load_time);", - "", - "// Set health response time variable.", - "health_tries = 15;", - "counter = 1;", - "postman.setEnvironmentVariable(\"health_tries\", JSON.stringify(health_tries));", - "postman.setEnvironmentVariable(\"health_counter\", JSON.stringify(counter));", - "", - "// Get the response.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Test the health response.", - "pm.test(\"Health Driver: Try \" + counter.toString() + \": Response should have 'message' property\", function() {", - " pm.expect(jsonData).to.have.property('message');", - "});", - "", - "pm.test(\"Response message should be 'api is healthy'\", function() {", - " pm.expect(jsonData.message).to.be.eql('api is healthy');", - "});", - "", - "// If response time is OK, proceed to the next test.", - "if (pm.response.responseTime < max_load_time) {", - " postman.setNextRequest(\"Check the readyz endpoint TheQ\");", - "}", - " ", - "// Response time is too long. Try again, give pod a chance to spin up.", - "else {", - " postman.setNextRequest(\"Check the healthz endpoint TheQ\");", - "}" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}healthz/", - "host": [ - "{{url}}healthz" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Check the healthz endpoint TheQ", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Get the maximum load time allowed.", - "max_load_time = JSON.parse(postman.getEnvironmentVariable(\"max_load_time\"));", - "", - "// Get and update variables.", - "health_tries = JSON.parse(postman.getEnvironmentVariable(\"health_tries\"));", - "counter = JSON.parse(postman.getEnvironmentVariable(\"health_counter\")) + 1;", - "postman.setEnvironmentVariable(\"health_counter\", JSON.stringify(counter));", - "", - "// Get the response.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Test the health response.", - "pm.test(\"Health Driver: Try \" + counter.toString() + \": Response should have 'message' property\", function() {", - " pm.expect(jsonData).to.have.property('message');", - "});", - "", - "pm.test(\"Response message should be 'api is healthy'\", function() {", - " pm.expect(jsonData.message).to.be.eql('api is healthy');", - "});", - "", - "// If response time is OK, proceed to the next test.", - "if (pm.response.responseTime < max_load_time) {", - " postman.setNextRequest(\"Check the readyz endpoint TheQ\");", - "}", - " ", - "// Response time is too long.", - "else {", - " ", - " // You haven't reached your maximum tries yet. Try again.", - " if (counter < health_tries) {", - " postman.setNextRequest(\"Check the healthz endpoint\");", - " }", - " ", - " // You have reached the maximum. An error, go to next test.", - " else {", - " pm.test(\"Response should be below \" + max_load_time.toString() + ' in ' + health_tries.toString() + ' tries.', function() {", - " pm.expect(counter).to.be.below(health_tries);", - " });", - " postman.setNextRequest(\"Check the readyz endpoint TheQ\");", - " }", - "}", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}healthz/", - "host": [ - "{{url}}healthz" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Check the readyz endpoint TheQ", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Perform the standard tests.", - "eval(environment.basic_response_test);", - "", - "var jsonData = JSON.parse(responseBody);", - "", - "// Test the health response.", - "pm.test(\"Response should have 'message' property\", function() {", - " pm.expect(jsonData).to.have.property('message');", - "});", - "", - "pm.test(\"Response message should be 'api is ready'\", function() {", - " pm.expect(jsonData.message).to.be.eql('api is ready');", - "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}readyz/", - "host": [ - "{{url}}readyz" - ], - "path": [ - "" - ] - } - }, - "response": [] - } - ], - "description": "Checks the application health by calling the healthz and readyz endpoints" - }, - { - "name": "Check user login", - "item": [ - { - "name": "Authenticate default QTxn user", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Do the basic checks.", - "eval(environment.basic_response_test);", - "", - "// Get the response.", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to make sure that the access token field is not null", - "pm.test(\"Access Token is not null\", function(){", - " var access_token = jsonData.access_token;", - " pm.expect(access_token).not.eql(null);", - "});", - "", - "//Test to make sure that the refresh token response field is not null", - "pm.test(\"Refresh Token is not null\", function(){", - " var refresh_token = jsonData.refresh_token;", - " pm.expect(refresh_token).not.eql(null);", - "});", - "", - "//Test to make sure that expires in response field is not nullf", - "pm.test(\"Expires In is not null\", function(){", - " var expires_in = jsonData.expires_in;", - " pm.expect(expires_in).not.eql(null);", - "});", - "", - "//Test to make sure that refresh expires in response fiels is not null", - "pm.test(\"Refresh Expires In is not null\", function(){", - " var refresh_expires_in = jsonData.refresh_expires_in;", - " pm.expect(refresh_expires_in).not.eql(null);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/x-www-form-urlencoded" - } - ], - "body": { - "mode": "raw", - "raw": "grant_type=password&client_id={{clientid}}&username={{userid}}&password={{password}}&client_secret={{client_secret}}" - }, - "url": { - "raw": "{{auth_url}}/auth/realms/{{realm}}/protocol/openid-connect/token?Content-Type=application/x-www-form-urlencoded", - "host": [ - "{{auth_url}}" - ], - "path": [ - "auth", - "realms", - "{{realm}}", - "protocol", - "openid-connect", - "token" - ], - "query": [ - { - "key": "Content-Type", - "value": "application/x-www-form-urlencoded" - } - ] - }, - "description": "Make sure the operator ID can log in" - }, - "response": [] - }, - { - "name": "Who am I TheQ", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data, make sure schema is OK.", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.csr_schema_check)", - "", - "// Make sure the postman operator is a GA.", - "if (jsonData.hasOwnProperty(\"csr\")) {", - " role = jsonData.csr.role.role_code;", - "}", - "else {", - " role = \"Unknown\"", - "};", - "", - "pm.test(\"The cfms-postman-operator role is \" + role + \", must be GA\", function() {", - " pm.expect(role).to.be.eql(\"GA\")", - "});", - "", - "if (jsonData.hasOwnProperty(\"csr\")) {", - "\tcurrentOfficeId = jsonData.csr.office_id;", - "\tcurrentOfficeNumber = jsonData.csr.office.office_number;", - "\tcurrentCsrId = jsonData.csr.csr_id;", - " postman.setEnvironmentVariable(\"current_office_id\", currentOfficeId);", - " postman.setEnvironmentVariable(\"current_office_number\", currentOfficeNumber);", - " postman.setEnvironmentVariable(\"current_csr_id\", currentCsrId);", - "};", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}csrs/me/", - "host": [ - "{{url}}csrs" - ], - "path": [ - "me", - "" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Check channels", - "item": [ - { - "name": "Get channels", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run basic tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "var schema = {", - " \"properties\" : {", - " \"channel_name\" : {", - " \"type\" : \"string\"", - " },", - " \"channel_id\" : {", - " \"type\" : [\"number\", \"object\"]", - " }", - " },", - " \"required\" : [\"channel_name\", \"channel_id\"]", - "};", - "", - "// Loop to validate schema of each channel.", - "var allChannels = jsonData.channels;", - "var channelCount = 0;", - "var phoneId = 0;", - "var emailId = 0;", - "var phoneText = \"Phone\";", - "var emailText = \"Email/Fax/Mail\";", - "allChannels.forEach(function(channel) {", - " channelCount ++;", - " var testTitle = \"Channel (\" + channelCount + \"): ID \" + channel.channel_id + \" Name \" + channel.channel_name + \" conforms to schema\";", - " tests[testTitle] = tv4.validate(channel, schema);", - " if (channel.channel_name === phoneText) {", - " phoneId = channel.channel_id;", - " }", - " if (channel.channel_name === emailText) {", - " emailId = channel.channel_id;", - " }", - "});", - "", - "// Check that you found the phone ID.", - "pm.test(phoneText + ' id was ' + phoneId.toString() + ' (should not equal 0)', function() {", - " pm.expect(phoneId).to.not.be.eql(0);", - "});", - "", - "// Check that you found the email ID.", - "pm.test(emailText + ' id was ' + emailId.toString() + ' (should not equal 0)', function() {", - " pm.expect(emailId).to.not.be.eql(0);", - "});", - "", - "// Store this ID for future use.", - "postman.setEnvironmentVariable(\"channel_telephone_id\", JSON.stringify(phoneId));", - "postman.setEnvironmentVariable(\"channel_email_id\", JSON.stringify(emailId));" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}channels/", - "host": [ - "{{url}}channels" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Check counters", - "item": [ - { - "name": "Store CSR and Office Info", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data, make sure schema is OK.", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.csr_schema_check)", - "", - "// Make sure that jsonData has an csr property.", - "pm.test(\"Response should have csr property\", function(){", - " pm.expect(jsonData.hasOwnProperty(\"csr\")).to.be.true;", - "});", - "", - "var csr = 0;", - "var office = 0;", - "var counters = 0;", - "var counter_text = \"Counter\";", - "var counter_id = 0;", - "var qtxn_text = \"Quick Trans\";", - "var qtxn_id = 0;", - "", - "if (jsonData.hasOwnProperty(\"csr\")) {", - "\tcurrentOfficeId = jsonData.csr.office_id;", - "\tcurrentOfficeNumber = jsonData.csr.office.office_number;", - " postman.setEnvironmentVariable(\"current_office_id\", currentOfficeId);", - " postman.setEnvironmentVariable(\"current_office_number\", currentOfficeNumber);", - " postman.setEnvironmentVariable(\"current_csr_id\", jsonData.csr.csr_id);", - " ", - " csr = jsonData.csr;", - " counter_id = 0;", - " qtxn_id = 0;", - "", - " // Make sure that jsonData has an booking property.", - " pm.test(\"CSR should have office property\", function(){", - " pm.expect(csr.hasOwnProperty(\"office\")).to.be.true;", - " });", - " ", - " // Make sure office has counter property.", - " if (csr.hasOwnProperty(\"office\")) {", - " office = csr.office;", - " ", - " // Make sure that jsonData has an booking property.", - " pm.test(\"Office should have counters property\", function(){", - " pm.expect(office.hasOwnProperty(\"counters\")).to.be.true;", - " });", - "", - " // Make sure office has counter property.", - " if (office.hasOwnProperty(\"counters\")) {", - " counters = office.counters;", - " ", - " // Search for Counter and Quick Trans counters", - " counters.forEach(function(counter) {", - " if (counter.counter_name === counter_text) {", - " counter_id = counter.counter_id;", - " }", - " if (counter.counter_name === qtxn_text) {", - " qtxn_id = counter.counter_id;", - " }", - " });", - " ", - " // Make sure you found the right IDs.", - " pm.test(\"Counter ID (\" + counter_id.toString() + \") should not be 0\", function(){", - " pm.expect(counter_id).to.not.be.eql(0);", - " });", - " pm.test(\"Quick Transaction ID (\" + qtxn_id.toString() + \") should not be 0\", function(){", - " pm.expect(qtxn_id).to.not.be.eql(0);", - " });", - " ", - " // Store the ids for future use.", - " // postman.setEnvironmentVariable(\"counter_id\", counter_id);", - " // postman.setEnvironmentVariable(\"qtxn_id\", qtxn_id);", - " postman.setEnvironmentVariable(\"counter_id\", JSON.stringify(counter_id.toString()));", - " postman.setEnvironmentVariable(\"qtxn_id\", JSON.stringify(qtxn_id.toString()));", - " }", - "", - " ", - " }", - "", - "}", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}csrs/me/", - "host": [ - "{{url}}csrs" - ], - "path": [ - "me", - "" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Check categories", - "item": [ - { - "name": "Get categories", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run basic tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "var schema = {", - " \"properties\" : {", - " \"actual_service_ind\" : { \"type\" : \"number\" },", - " \"deleted\" : { \"type\" : [\"string\", \"null\"] },", - " \"display_dashboard_ind\" : { \"type\" : \"number\" },", - " \"external_service_name\": {\"type\": [\"null\", \"string\"]},", - " \"online_availability\" : {\"type\": [\"null\", \"string\"]},", - " \"online_link\": {\"type\": [\"null\", \"string\"]},", - " \"parent\": {\"type\": \"null\"},", - " \"parent_id\": {\"type\": \"null\"},", - " \"prefix\" : {\"type\" : \"string\"},", - " \"service_code\" : {\"type\" : \"string\"},", - " \"service_desc\" : {\"type\" : \"string\"},", - " \"service_id\" : {\"type\" : [\"number\", \"object\"]},", - " \"service_name\" : {\"type\" : \"string\"},", - " \"timeslot_duration\": {\"type\": [\"null\", \"number\"]}", - " },", - " \"required\" : [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\", \"external_service_name\",", - " \"online_availability\", \"online_link\", \"parent\", \"parent_id\", \"prefix\", \"service_code\",", - " \"service_desc\", \"service_id\", \"service_name\",", - " \"timeslot_duration\"]", - "};", - "", - "// Loop to validate schema of each channel.", - "var allCategories = jsonData.categories;", - "var categoryCount = 0;", - "allCategories.forEach(function(category) {", - " categoryCount ++;", - " var testTitle = \"Category (\" + categoryCount + \"): \" + category.service_name + \" - \";", - " tests[testTitle + \"conforms to schema\"] = tv4.validate(category, schema);", - " var displayInd = category.display_dashboard_ind;", - " var serviceInd = category.actual_service_ind;", - "", - " // Test that returned data is valid.", - " pm.test(\"--> \" + testTitle + \"display_dashboard_ind must be 0 (is \" + displayInd.toString() + \")\", function(){", - " pm.expect(displayInd).to.be.eql(0);", - " });", - "", - " pm.test(\"--> \" + testTitle + \"actual_service_ind must be 0 (is \" + serviceInd.toString() + \")\", function(){", - " pm.expect(serviceInd).to.be.eql(0);", - " });", - " ", - " pm.test(\"--> \" + testTitle + \"parent_id must be null\", function(){", - " pm.expect(category.parent_id).to.be.null;", - " });", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}categories/", - "host": [ - "{{url}}categories" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Check services", - "item": [ - { - "name": "Get services", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run basic tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.service_schema_check);", - "", - "// Loop to validate schema of each channel.", - "var allElements = jsonData.services;", - "var elementCount = 0;", - "var elementMax = Math.min(10, allElements.length);", - "//allElements.forEach(function(element) {", - "for (var currentElement = 0; currentElement < elementMax; currentElement++) {", - " element = allElements[currentElement];", - " elementCount ++;", - " var testTitle = \"Service (\" + elementCount + \"): \" + element.service_name + \" - \";", - " displayInd = element.display_dashboard_ind;", - " serviceInd = element.actual_service_ind;", - "", - " // Test that returned data is valid.", - " pm.test(\"--> \" + testTitle + \"display_dashboard_ind must be 0 or 1 (is \" + displayInd.toString() + \")\", function(){", - " pm.expect(displayInd).to.be.within(0, 1);", - " });", - "", - " // Test that returned data is valid.", - " pm.test(\"--> \" + testTitle + \"actual_service_ind must be 1 (is \" + serviceInd.toString() + \")\", function(){", - " pm.expect(serviceInd).to.be.eql(1);", - " });", - " ", - " // Test that returned data is valid.", - " pm.test(\"--> \" + testTitle + \"parent_id must not be null\", function(){", - " pm.expect(element.parent_id).to.not.be.null;", - " });", - "}", - "", - "// Declare and initialize variables.", - "var mspId = 0;", - "var taxId = 0;", - "var mspText = \"Payment - MSP\";", - "var propTaxText = \"Other - Rural PTAX\";", - "", - "// Look for the MSP and Property Tax IDs.", - "allElements.forEach(function(element) {", - " if (element.service_name === mspText) {", - " mspId = element.service_id;", - " }", - " if (element.service_name === propTaxText) {", - " taxId = element.service_id;", - " }", - "});", - "", - "// Check that you found the MSP service.", - "pm.test(mspText + ' id was ' + mspId.toString() + ' (should not equal 0)', function() {", - " pm.expect(mspId).to.not.be.eql(0);", - "});", - "", - "// Check that you found the Property Tax service.", - "pm.test(propTaxText + ' id was ' + taxId.toString() + ' (should not equal 0)', function() {", - " pm.expect(taxId).to.not.be.eql(0);", - "});", - "", - "// Store these IDs for future use.", - "postman.setEnvironmentVariable(\"service_MSP_id\", JSON.stringify(mspId));", - "postman.setEnvironmentVariable(\"service_PropTax_id\", JSON.stringify(taxId));" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}services/", - "host": [ - "{{url}}services" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Update quick lists", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run basic tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data, make sure schema is OK.", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.office_schema_check)", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}services/refresh/?office_id={{current_office_id}}", - "host": [ - "{{url}}services" - ], - "path": [ - "refresh", - "" - ], - "query": [ - { - "key": "office_id", - "value": "{{current_office_id}}" - } - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Check smartboard", - "item": [ - { - "name": "Get smartboard", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run basic tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Define the JSON Schema expected in response", - "var smartboardSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"office_type\": {\"type\": \"string\"},", - " \"citizens\": {", - " \"type\": \"array\",", - " \"items\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"ticket_number\": {\"type\": \"string\"},", - " \"active_period\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"period_id\": {\"type\": \"number\"},", - " \"ps\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"ps_name\": \"string\"", - " },", - " \"required\": [\"ps_name\"]", - " },", - " \"ps_id\": {\"type\": \"number\"},", - " \"time_end\": {\"type\": [\"null\", \"string\"]},", - " \"time_start\": {\"type\": \"string\"}", - " },", - " \"required\": [\"period_id\", \"ps\", \"ps_id\", \"time_end\", \"time_start\"]", - " },", - " },", - " \"required\": [\"ticket_number\", \"active_period\"]", - " },", - " },", - " },", - " \"required\": [\"office_type\", \"citizens\"]", - "};", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate the Smartboard Schema\", function(){", - " pm.expect(tv4.validate(jsonData, smartboardSchema)).to.be.true;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}smartboard/?office_number={{current_office_number}}", - "host": [ - "{{url}}smartboard" - ], - "path": [ - "" - ], - "query": [ - { - "key": "office_number", - "value": "{{current_office_number}}" - } - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Check videofiles", - "item": [ - { - "name": "Get videofiles", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run basic tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data, make sure schema is OK.", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.video_schema_check)", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}videofiles/", - "host": [ - "{{url}}videofiles" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Get videofiles for office", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run basic tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data, make sure schema is OK.", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.video_schema_check)", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}videofiles/?office_number={{current_office_number}}", - "host": [ - "{{url}}videofiles" - ], - "path": [ - "" - ], - "query": [ - { - "key": "office_number", - "value": "{{current_office_number}}" - } - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Check CSRs and States", - "item": [ - { - "name": "Get CSRs", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run basic tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data, make sure schema is OK.", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.manycsrs_schema_check)", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}csrs/", - "host": [ - "{{url}}csrs" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Check Postman Finance No", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run basic tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.onecsr_schema_check);", - "", - "// Make sure the CSR is not a finance designate.", - "var finance = jsonData.csr.finance_designate;", - "pm.test(\"Finance designate is \" + finance.toString() + \" - it should be 0\", function() {", - " pm.expect(finance).to.be.eql(0);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"finance_designate\": 0\r\n}" - }, - "url": { - "raw": "{{url}}csrs/{{current_csr_id}}/", - "host": [ - "{{url}}csrs" - ], - "path": [ - "{{current_csr_id}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Check Postman Finance Yes", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run basic tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.onecsr_schema_check);", - "", - "// Make sure the CSR is a finance designate.", - "var finance = jsonData.csr.finance_designate;", - "pm.test(\"Finance designate is \" + finance.toString() + \" - it should now be 1\", function() {", - " pm.expect(finance).to.be.eql(1);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"finance_designate\": 1\r\n}" - }, - "url": { - "raw": "{{url}}csrs/{{current_csr_id}}/", - "host": [ - "{{url}}csrs" - ], - "path": [ - "{{current_csr_id}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Get CSR states", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run basic tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Define the JSON Schema expected in response", - "var csrStateSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"csr_states\" : {", - " \"type\": \"array\",", - " \"items\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"csr_state_desc\": {\"type\": \"string\"},", - " \"csr_state_id\": {\"type\": \"number\"},", - " \"csr_state_name\": {\"type\": \"string\"},", - " },", - " \"required\": [\"csr_state_desc\", \"csr_state_id\", \"csr_state_name\"]", - " }", - " },", - " \"errors\": {\"type\": [\"object\", \"string\"]}", - " },", - " \"required\": [\"csr_states\", \"errors\"]", - "};", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate CSR States Schema\", function(){", - " pm.expect(tv4.validate(jsonData, csrStateSchema)).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}csr_states/", - "host": [ - "{{url}}csr_states" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Clear queue for tests", - "item": [ - { - "name": "Delete citizen queue driver", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Delete citizens, if there are any.", - " if (citizenIds.length > 0) {", - " ", - " // Set the current_client, to be deleted.", - " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", - " postman.setEnvironmentVariable(\"current_queue\", JSON.stringify(citizenIds));", - " ", - " if (currentCitizen.service_reqs.length === 0) {", - " postman.setNextRequest(\"Next citizen left\");", - " // // Temporary kludge. Citizen left not working, so add SR, then delete.", - " // postman.setNextRequest(\"Temporary add MSP service request\");", - " }", - " else {", - " postman.setNextRequest(\"Next citizen finish service\");", - " }", - " }", - " ", - " // No more citizens. Clear the current, queue variables.", - " else {", - " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(\"\"));", - " postman.setEnvironmentVariable(\"current_queue\", JSON.stringify(\"\"));", - " postman.setNextRequest(\"End clear queue via healthz endpoint\");", - " }", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Next citizen finish service", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "var citizenToBeDeleted = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "var citizenData = jsonData.citizen;", - "var testTitle = \"Check citizen finish service\";", - "", - "// Make sure the response is valid.", - "pm.test(testTitle + \": Response should have property 'citizen'\", function(){", - " pm.expect(jsonData.hasOwnProperty(\"citizen\")).to.be.true;", - "});", - "pm.test(testTitle + \": Response should not have property 'message' indicating an error\", function(){", - " pm.expect(jsonData.hasOwnProperty(\"message\")).to.be.false;", - "});", - "pm.test(testTitle + \": Citizen marked as finished should be citizen \" + citizenToBeDeleted.toString(), function(){", - " pm.expect(citizenData.citizen_id).to.be.eql(citizenToBeDeleted);", - "});", - "", - "// Go back to the delete citizen queue driver.", - "postman.setNextRequest(\"Delete citizen queue driver\");", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/finish_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "finish_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Next citizen citizen left", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get environment variables.", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - " // Perform checks.", - " pm.test(\"Check there are no citizens waiting\", function(){", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test(\"Citizen that left must be \" + currentCitizen.citizen_id.toString() + \" (is \" + currentCitizenId.toString(), function(){", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - "}", - "", - "// Go back to the delete citizen queue driver.", - "postman.setNextRequest(\"Delete citizen queue driver\");", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/citizen_left/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "citizen_left", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Temporary add MSP service request", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run create tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "var svcReq = jsonData.service_request;", - "", - "// Run service request tests.", - "eval(environment.one_service_request_test);", - "", - "// Make sure the response is valid.", - "pm.test(\"Response has service_request property\", function(){", - " pm.expect(jsonData.hasOwnProperty(\"service_request\")).to.be.true;", - "});", - "pm.test(\"Response has errors property\", function(){", - " pm.expect(jsonData.hasOwnProperty(\"errors\")).to.be.true;", - "});", - "", - "// Go back to the clear citizen driver.", - "postman.setNextRequest(\"Next citizen finish service\");", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_MSP_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : 1,\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" - }, - "url": { - "raw": "{{url}}service_requests/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "End clear queue via healthz endpoint", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Perform the standard tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Test the health response.", - "pm.test(\"Response should have 'message' property\", function() {", - " pm.expect(jsonData).to.have.property('message');", - "});", - "", - "pm.test(\"Response message should be 'api is healthy'\", function() {", - " pm.expect(jsonData.message).to.be.eql('api is healthy');", - "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}healthz/", - "host": [ - "{{url}}healthz" - ], - "path": [ - "" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Check citizen through queue (QT1)", - "item": [ - { - "name": "Check no citizens (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var allOK = true;", - "", - "// If citizen property was present.", - "if (allElements !== null) {", - "", - " // Make sure it had a length of 0.", - " if (allElements.length !== 0) {", - " allOK = false;", - " }", - "}", - "", - "pm.test(\"There should be no citizens in the office\", function() {", - " pm.expect(allOK).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Create citizen (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " pm.test(\"Only one citizen should be in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - " ", - " // Store the ID of the citizen just created.", - " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{}" - }, - "url": { - "raw": "{{url}}citizens/0/add_citizen/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "0", - "add_citizen", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Edit specific citizen (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - "", - " // Perform tests.", - " pm.test(\"Must be one active citizen in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}}\n}" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Add property tax via phone service request (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get the current service request, check schema.", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.one_service_request_test);", - "", - "// Get the SR ID.", - "if (jsonData.hasOwnProperty(\"service_request\")) {", - "\tcurrentSrId = jsonData.service_request.sr_id;", - "}", - "else {", - " currentSrId = 0;", - "}", - "", - "// The service request ID must not be 0.", - "pm.test(\"The Service Request ID is \" + currentSrId.toString() + \", must not be 0\", function() {", - " pm.expect(currentSrId).to.not.be.eql(0)", - "});", - "", - "// Save the service request ID.", - "postman.setEnvironmentVariable(\"first_sr_id\", currentSrId);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" - }, - "url": { - "raw": "{{url}}service_requests/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "List specific citizen (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request must have one period', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", - " });", - " pm.test('Service request period channel must be ' + citizenChannel, function() {", - " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", - " });", - " pm.test('Service request period state must be \"Ticket Creation\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/{{current_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Add citizen to queue (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Pending\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (now two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Waiting\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/add_to_queue/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "add_to_queue", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Invite specific citizen (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 3 (now three periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(3);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Invited\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Invited\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/invite/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "invite", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Begin serving citizen (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 4 (now four periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(4);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Being Served\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/begin_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "begin_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Add MSP via email service request (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get the current service request, check schema.", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.one_service_request_test);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_MSP_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_email_id}}\n\t}\n}" - }, - "url": { - "raw": "{{url}}service_requests/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Activate property tax service (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get the current service request ID.", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.one_service_request_test);", - "", - "if (jsonData.hasOwnProperty(\"service_request\")) {", - "\tcurrentSrId = jsonData.service_request.sr_id;", - "}", - "else {", - " currentSrId = 0;", - "}", - "", - "// Get the first service request ID.", - "first_id = JSON.parse(postman.getEnvironmentVariable(\"first_sr_id\"));", - "", - "// The service request ID must not be 0.", - "pm.test(\"The Service Request ID is \" + currentSrId.toString() + \", must be \" + first_id.toString(), function() {", - " pm.expect(currentSrId).to.be.eql(first_id)", - "});", - "", - "// Save the service request ID.", - "postman.setEnvironmentVariable(\"second_sr_id\", currentSrId);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}service_requests/{{first_sr_id}}/activate/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "{{first_sr_id}}", - "activate", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Finish serving citizen (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be no active citizens in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - - " pm.test('There must be two service requests', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(2);", - " });", - " pm.test('Service request state must be \"Complete\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 5 (five periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(5);", - " });", - " pm.test('There must be no open periods', function() {", - " pm.expect(openPeriodCount).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/finish_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "finish_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Check citizen begin-hold-finish (QT2)", - "item": [ - { - "name": "Check no citizens (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var allOK = true;", - "", - "// If citizen property was present.", - "if (allElements !== null) {", - "", - " // Make sure it had a length of 0.", - " if (allElements.length !== 0) {", - " allOK = false;", - " }", - "}", - "", - "pm.test(\"There should be no citizens in the office\", function() {", - " pm.expect(allOK).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Create citizen (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Perform tests.", - " pm.test(\"Only one citizen should be in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - " ", - " // Store the ID of the citizen just created.", - " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", - "} ", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{}" - }, - "url": { - "raw": "{{url}}citizens/0/add_citizen/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "0", - "add_citizen", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Edit specific citizen (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "", - "// // Get data, create JSON body.", - "// var citizenName = postman.getEnvironmentVariable(\"citizen_name\");", - "// var citizenComments = postman.getEnvironmentVariable(\"citizen_comment\");", - "// var bodyData = {", - "// \"citizen_name\" : citizenName,", - "// \"citizen_comments\" : citizenComments", - "// }", - "", - "// // Store the data in an environment variable.", - "// postman.setEnvironmentVariable(\"putBody\", JSON.stringify(bodyData));" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - "", - " // Perform tests.", - " pm.test(\"Must be one active citizen in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}}\n}" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Add property tax via phone service request (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get the current service request, check schema.", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.one_service_request_test);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" - }, - "url": { - "raw": "{{url}}service_requests/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "List specific citizen (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request must have one period', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", - " });", - " pm.test('Service request period channel must be ' + citizenChannel, function() {", - " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", - " });", - " pm.test('Service request period state must be \"Ticket Creation\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/{{current_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Begin serving citizen (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (now two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Being Served\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/begin_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "begin_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Place citizen on hold (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 3 (now three periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(3);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"On hold\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"On hold\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/place_on_hold/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "place_on_hold", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Get service requests (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.service_request_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - "var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - "var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get periods for the first service request.", - " var allPeriods = allElements[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " var allPeriodCount = 0;", - "", - " // Find how many periods there are with null end time.", - " // Also, check schema.", - " allPeriods.forEach(function(onePeriod) {", - " ", - " // Find the open period.", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " ", - " });", - "} ", - "", - "// If there are some service requests, proceed with tests.", - "if (allElements !== null) {", - "", - " // Perform tests.", - " pm.test('There must be only one service request', function() {", - " pm.expect(allElements.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(allElements[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(allElements[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(allElements[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request must have three periods', function() {", - " pm.expect(allPeriods.length).to.be.eql(3);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('Service request period state must be \"On hold\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"On hold\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/{{current_client}}/service_requests/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "service_requests", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Call citizen from hold (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 4 (now four periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(4);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Being Served\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/begin_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "begin_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Finish serving citizen (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - " ", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = allElements[0].service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be no active citizens in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Complete\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 4 (still four periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(4);", - " });", - " pm.test('There must be no open periods', function() {", - " pm.expect(openPeriodCount).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/finish_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "finish_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Check citizen leave after create (QT3)", - "item": [ - { - "name": "Check no citizens (QT3)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var allOK = true;", - "", - "// If citizen property was present.", - "if (allElements !== null) {", - "", - " // Make sure it had a length of 0.", - " if (allElements.length !== 0) {", - " allOK = false;", - " }", - "}", - "", - "pm.test(\"There should be no citizens in the office\", function() {", - " pm.expect(allOK).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Create citizen (QT3)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Perform tests.", - " pm.test(\"Only one citizen should be in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "", - " // Store the ID of the citizen just created.", - " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{}" - }, - "url": { - "raw": "{{url}}citizens/0/add_citizen/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "0", - "add_citizen", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Citizen left (QT3)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get environment variables.", - " var citizenName = postman.getEnvironmentVariable(\"citizen_name\");", - " var citizenComment = postman.getEnvironmentVariable(\"citizen_comment\");", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = null;", - " if (currentCitizen.service_reqs.length !== 0) {", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " }", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " if (allPeriods !== null) {", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - " }", - "", - " // Perform tests.", - " pm.test(\"Must be no active citizens in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/citizen_left/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "citizen_left", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Check citizen leave after waiting (QT4)", - "item": [ - { - "name": "Check no citizens (QT4)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var allOK = true;", - "", - "// If citizen property was present.", - "if (allElements !== null) {", - "", - " // Make sure it had a length of 0.", - " if (allElements.length !== 0) {", - " allOK = false;", - " }", - "}", - "", - "pm.test(\"There should be no citizens in the office\", function() {", - " pm.expect(allOK).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Create citizen (QT4)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Perform tests.", - " pm.test(\"Only one citizen should be in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "", - " // Store the ID of the citizen just created.", - " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{}" - }, - "url": { - "raw": "{{url}}citizens/0/add_citizen/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "0", - "add_citizen", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Edit specific citizen (QT4)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "", - "// // Get data, create JSON body.", - "// var citizenName = postman.getEnvironmentVariable(\"citizen_name\");", - "// var citizenComments = postman.getEnvironmentVariable(\"citizen_comment\");", - "// var bodyData = {", - "// \"citizen_name\" : citizenName,", - "// \"citizen_comments\" : citizenComments", - "// }", - "", - "// // Store the data in an environment variable.", - "// postman.setEnvironmentVariable(\"putBody\", JSON.stringify(bodyData));" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - "", - " // Perform tests.", - " pm.test(\"Must be one active citizen in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}}\n}" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Add property tax via phone service request (QT4)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get the current service request, check schema.", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.one_service_request_test);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" - }, - "url": { - "raw": "{{url}}service_requests/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "List specific citizen (QT4)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request must have one period', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", - " });", - " pm.test('Service request period channel must be ' + citizenChannel, function() {", - " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", - " });", - " pm.test('Service request period state must be \"Ticket Creation\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/{{current_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Add citizen to queue (QT4)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Pending\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (now two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Waiting\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/add_to_queue/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "add_to_queue", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Citizen left (QT4)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test(\"Must be no active citizens in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test(\"Citizen should have one service request\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Complete\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (now two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must be no open periods', function() {", - " pm.expect(openPeriodCount).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/citizen_left/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "citizen_left", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Check no citizens (QT4)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var allOK = true;", - "", - "// If citizen property was present.", - "if (allElements !== null) {", - "", - " // Make sure it had a length of 0.", - " if (allElements.length !== 0) {", - " allOK = false;", - " }", - "}", - "", - "pm.test(\"There should be no citizens in the office\", function() {", - " pm.expect(allOK).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Check update service information (QT5)", - "item": [ - { - "name": "Check no citizens (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var allOK = true;", - "", - "// If citizen property was present.", - "if (allElements !== null) {", - "", - " // Make sure it had a length of 0.", - " if (allElements.length !== 0) {", - " allOK = false;", - " }", - "}", - "", - "pm.test(\"There should be no citizens in the office\", function() {", - " pm.expect(allOK).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Create citizen (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Perform tests.", - " pm.test(\"Only one citizen should be in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "", - " // Store the ID of the citizen just created.", - " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{}" - }, - "url": { - "raw": "{{url}}citizens/0/add_citizen/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "0", - "add_citizen", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Edit specific citizen (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "", - "// // Get data, create JSON body.", - "// var citizenName = postman.getEnvironmentVariable(\"citizen_name\");", - "// var citizenComments = postman.getEnvironmentVariable(\"citizen_comment\");", - "// var bodyData = {", - "// \"citizen_name\" : citizenName,", - "// \"citizen_comments\" : citizenComments", - "// };", - "", - "// // Store the data in an environment variable.", - "// postman.setEnvironmentVariable(\"putBody\", JSON.stringify(bodyData));" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - " ", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - "", - " // Perform tests.", - " pm.test(\"Must be one active citizen in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}}\n}" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Add property tax via phone service request (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get the current service request, check schema.", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.one_service_request_test);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" - }, - "url": { - "raw": "{{url}}service_requests/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "List specific citizen (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - " ", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request must have one period', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", - " });", - " pm.test('Service request period channel must be ' + citizenChannel, function() {", - " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", - " });", - " pm.test('Service request period state must be \"Ticket Creation\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", - " });", - "", - " // Save the service request ID for later.", - " var mySRId = allElements[0].service_reqs[0].sr_id;", - " postman.setEnvironmentVariable(\"current_sr_id\", JSON.stringify(mySRId));", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/{{current_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Begin serving citizen (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (now two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Being Served\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/begin_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "begin_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Update quantity from 3 to 5 (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.service_request_test);", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Only check for an updated quantity. Get environment variables.", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", - "", - " // Perform tests.", - " pm.test('Updated service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(allElements[0].quantity).to.be.eql(citizenQuantity);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"quantity\" : {{citizen_quantity_update}}\n}" - }, - "url": { - "raw": "{{url}}service_requests/{{current_sr_id}}/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "{{current_sr_id}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Update service from PropTax to MSP (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.service_request_test);", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Only check for an updated quantity. Get environment variables.", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", - "", - " // Perform tests.", - " pm.test('Updated service request service must be ' + citizenService, function() {", - " pm.expect(allElements[0].service_id).to.be.eql(citizenService);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_id\" : {{service_MSP_id}}\n}" - }, - "url": { - "raw": "{{url}}service_requests/{{current_sr_id}}/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "{{current_sr_id}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Finish serving citizen (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be no active citizens in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Complete\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (should be two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must be no open periods', function() {", - " pm.expect(openPeriodCount).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/finish_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "finish_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Check pick qtxn customer (QT6)", - "item": [ - { - "name": "Check no citizens (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var citizenCount = 0;", - "", - "// If citizen property was present.", - "if (allElements !== null) {", - "", - " // Get number of citizens in the queue.", - " citizenCount = allElements.length;", - "}", - "", - "pm.test(\"There should be no citizens in the office\", function() {", - " pm.expect(citizenCount).to.be.eql(0);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "First citizen - Create (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Perform tests.", - " pm.test(\"Only one citizen should have been created\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "", - " // Store the ID of the citizen just created.", - " postman.setEnvironmentVariable(\"first_client\", JSON.stringify(citizenIds.shift()));", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{}" - }, - "url": { - "raw": "{{url}}citizens/0/add_citizen/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "0", - "add_citizen", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "First citizen - Edit (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - "", - " // Perform tests.", - " pm.test(\"Must be one active citizen in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}},\n \"counter_id\": {{counter_id}}\n}" - }, - "url": { - "raw": "{{url}}citizens/{{first_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{first_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "First citizen - Prop Tax via phone (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get the current service request, check schema.", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.one_service_request_test);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{first_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" - }, - "url": { - "raw": "{{url}}service_requests/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "First citizen - List (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request must have one period', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", - " });", - " pm.test('Service request period channel must be ' + citizenChannel, function() {", - " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", - " });", - " pm.test('Service request period state must be \"Ticket Creation\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/{{first_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{first_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "First citizen - Add to queue (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Pending\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (now two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Waiting\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{first_client}}/add_to_queue/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{first_client}}", - "add_to_queue", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - Create (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Perform tests.", - " pm.test(\"Only one citizen should have been created\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "", - " // Store the ID of the citizen just created.", - " postman.setEnvironmentVariable(\"second_client\", JSON.stringify(citizenIds.shift()));", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{}" - }, - "url": { - "raw": "{{url}}citizens/1/add_citizen/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "1", - "add_citizen", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - Edit QTxn (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "", - "// // Get data, create JSON body.", - "// var citizenName = postman.getEnvironmentVariable(\"citizen_name_quick\");", - "// var citizenComments = postman.getEnvironmentVariable(\"citizen_comment_quick\");", - "// var bodyData = {", - "// \"citizen_name\" : citizenName,", - "// \"citizen_comments\" : citizenComments,", - "// \"qt_xn_citizen_ind\" : 1", - "// };", - "", - "// // Store the data in an environment variable.", - "// postman.setEnvironmentVariable(\"putBody\", JSON.stringify(bodyData));" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", - "", - " // Perform tests.", - " pm.test(\"Should be updating single citizen\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"citizen_name\" : {{citizen_name_quick}},\n \"citizen_comments\" : {{citizen_comment_quick}},\n \"qt_xn_citizen_ind\" : 1,\n \"counter_id\": {{qtxn_id}}\n}" - }, - "url": { - "raw": "{{url}}citizens/{{second_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{second_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - MSP via email (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get the current service request, check schema.", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.one_service_request_test);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_MSP_id}},\n\t\t\"citizen_id\" : {{second_client}},\n\t\t\"quantity\" : {{citizen_quantity_update}},\n\t\t\"channel_id\" : {{channel_email_id}}\n\t}\n}" - }, - "url": { - "raw": "{{url}}service_requests/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - List (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", - "", - " // Perform tests.", - " pm.test('Should be updating one citizen', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request must have one period', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", - " });", - " pm.test('Service request period channel must be ' + citizenChannel, function() {", - " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", - " });", - " pm.test('Service request period state must be \"Ticket Creation\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/{{second_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{second_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - Add to queue (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Should be adding one citizen to the queue', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Pending\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (now two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Waiting\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{second_client}}/add_to_queue/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{second_client}}", - "add_to_queue", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Check 2 citizens in queue (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var citizenCount = 0;", - "", - "// If citizen property was present.", - "if (allElements !== null) {", - "", - " // Get number of citizens in the queue.", - " citizenCount = allElements.length;", - "}", - "", - "pm.test('Must be two active citizens in the office', function() {", - " pm.expect(citizenCount).to.be.eql(2);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Set CSR to QTxn (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "", - "// Turn the qtxn ID from character to number.", - "qtxn_id_number = JSON.parse(environment.qtxn_id);", - "postman.setEnvironmentVariable(\"qtxn_id_number\", qtxn_id_number);" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body, test the schema", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.onecsr_schema_check)", - "", - "// Ensure the CSR is now set to take quick transactions.", - "csrType = jsonData.csr.counter;", - "csrNeed = JSON.parse(environment.qtxn_id_number);", - "pm.test('CSR counter type is ' + csrType.toString() + '; must be ' + csrNeed.toString(), function() {", - " pm.expect(csrType).to.be.eql(csrNeed);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"counter_id\": {{qtxn_id_number}}\n}" - }, - "url": { - "raw": "{{url}}csrs/{{current_csr_id}}/", - "host": [ - "{{url}}csrs" - ], - "path": [ - "{{current_csr_id}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Invite next citizen - should be second one (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Should only be inviting one citizen', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 3 (now three periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(3);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Invited\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Invited\");", - " });", - "}", - "", - "// Store the ID of the citizen just invited.", - "postman.setEnvironmentVariable(\"current_client\", JSON.stringify(currentCitizenId));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/invite/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "invite", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - begin serving (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one citizen being served', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 4 (now four periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(4);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Being Served\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/begin_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "begin_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - finish serving (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be no active citizen being served', function() {", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Complete\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 4 (still four periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(4);", - " });", - " pm.test('There must be no open periods', function() {", - " pm.expect(openPeriodCount).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/finish_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "finish_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Invite next citizen - should be first one (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Should only be inviting one citizen', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 3 (now three periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(3);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Invited\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Invited\");", - " });", - "}", - "", - "// Store the ID of the citizen just invited.", - "postman.setEnvironmentVariable(\"current_client\", JSON.stringify(currentCitizenId));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/invite/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "invite", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "First citizen - citizen left (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test(\"Must be no active citizen being served\", function() {", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test(\"Citizen should have one service request\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Complete\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 3 (now three periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(3);", - " });", - " pm.test('There must be no open periods', function() {", - " pm.expect(openPeriodCount).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/citizen_left/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "citizen_left", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Check pick non-qtxn customer (QT7)", - "item": [ - { - "name": "Check no citizens (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var citizenCount = 0;", - "", - "// If citizen property was present.", - "if (allElements !== null) {", - "", - " // Get number of citizens in the queue.", - " citizenCount = allElements.length;", - "}", - "", - "pm.test(\"There should be no citizens in the office\", function() {", - " pm.expect(citizenCount).to.be.eql(0);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "First citizen - Create (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Perform tests.", - " pm.test(\"Only one citizen should have been created\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "", - " // Store the ID of the citizen just created.", - " postman.setEnvironmentVariable(\"first_client\", JSON.stringify(citizenIds.shift()));", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{}" - }, - "url": { - "raw": "{{url}}citizens/0/add_citizen/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "0", - "add_citizen", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "First citizen - Edit QTxn (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", - "", - " // Perform tests.", - " pm.test(\"Must be editing only one citizen\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"citizen_name\" : {{citizen_name_quick}},\n \"citizen_comments\" : {{citizen_comment_quick}},\n \"qt_xn_citizen_ind\" : 1,\n \"counter_id\": {{qtxn_id}}\n}" - }, - "url": { - "raw": "{{url}}citizens/{{first_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{first_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "First citizen - MSP via email (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get the current service request, check schema.", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.one_service_request_test);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_MSP_id}},\n\t\t\"citizen_id\" : {{first_client}},\n\t\t\"quantity\" : {{citizen_quantity_update}},\n\t\t\"channel_id\" : {{channel_email_id}}\n\t}\n}" - }, - "url": { - "raw": "{{url}}service_requests/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "First citizen - List (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", - "", - " // Perform tests.", - " pm.test('Must be editing only one citizen', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request must have one period', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", - " });", - " pm.test('Service request period channel must be ' + citizenChannel, function() {", - " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", - " });", - " pm.test('Service request period state must be \"Ticket Creation\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/{{first_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{first_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "First citizen - Add to queue (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be adding only one citizen to the queue', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Pending\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (now two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Waiting\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{first_client}}/add_to_queue/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{first_client}}", - "add_to_queue", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - Create (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Perform tests.", - " pm.test(\"Only one citizen should have been created\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "", - " // Store the ID of the citizen just created.", - " postman.setEnvironmentVariable(\"second_client\", JSON.stringify(citizenIds.shift()));", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{}" - }, - "url": { - "raw": "{{url}}citizens/1/add_citizen/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "1", - "add_citizen", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - Edit (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - "", - " // Perform tests.", - " pm.test(\"Should be updating single citizen\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}},\n \"counter_id\": {{counter_id}}\n}" - }, - "url": { - "raw": "{{url}}citizens/{{second_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{second_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - Prop Tax via phone (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get the current service request, check schema.", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.one_service_request_test);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{second_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" - }, - "url": { - "raw": "{{url}}service_requests/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - List (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", - "", - " // Perform tests.", - " pm.test('Should be updating one citizen', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request must have one period', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", - " });", - " pm.test('Service request period channel must be ' + citizenChannel, function() {", - " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", - " });", - " pm.test('Service request period state must be \"Ticket Creation\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/{{second_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{second_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - Add to queue (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Should be adding one citizen to the queue', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Pending\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (now two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Waiting\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{second_client}}/add_to_queue/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{second_client}}", - "add_to_queue", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Check 2 citizens in queue (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var citizenCount = 0;", - "", - "// If citizen property was present.", - "if (allElements !== null) {", - "", - " // Get number of citizens in the queue.", - " citizenCount = allElements.length;", - "}", - "", - "pm.test('Must be two active citizens in the office', function() {", - " pm.expect(citizenCount).to.be.eql(2);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Set CSR to Counter (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "", - "// Turn the qtxn ID from character to number.", - "counter_id_number = JSON.parse(environment.counter_id);", - "postman.setEnvironmentVariable(\"counter_id_number\", counter_id_number);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body, test the schema", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.onecsr_schema_check)", - "", - "// Ensure the CSR is now set to take quick transactions.", - "csrType = jsonData.csr.counter;", - "csrNeed = JSON.parse(environment.counter_id_number);", - "pm.test('CSR counter type is ' + csrType.toString() + '; must be ' + csrNeed.toString(), function() {", - " pm.expect(csrType).to.be.eql(csrNeed);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"counter_id\": {{counter_id_number}}\n}" - }, - "url": { - "raw": "{{url}}csrs/{{current_csr_id}}/", - "host": [ - "{{url}}csrs" - ], - "path": [ - "{{current_csr_id}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Invite next citizen - should be second one (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Should only be inviting one citizen', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 3 (now three periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(3);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Invited\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Invited\");", - " });", - "}", - "", - "// Store the ID of the citizen just invited.", - "postman.setEnvironmentVariable(\"current_client\", JSON.stringify(currentCitizenId));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/invite/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "invite", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - begin serving (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one citizen being served', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 4 (now four periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(4);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Being Served\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/begin_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "begin_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - finish serving (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be no active citizen being served', function() {", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Complete\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 4 (still four periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(4);", - " });", - " pm.test('There must be no open periods', function() {", - " pm.expect(openPeriodCount).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/finish_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "finish_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Invite next citizen - should be first one (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Should only be inviting one citizen', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 3 (now three periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(3);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Invited\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Invited\");", - " });", - "}", - "", - "// Store the ID of the citizen just invited.", - "postman.setEnvironmentVariable(\"current_client\", JSON.stringify(currentCitizenId));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/invite/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "invite", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "First citizen - citizen left (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test(\"Must be no active citizen being served\", function() {", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test(\"Citizen should have one service request\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Complete\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 3 (now three periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(3);", - " });", - " pm.test('There must be no open periods', function() {", - " pm.expect(openPeriodCount).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/citizen_left/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "citizen_left", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Setup Booking", - "item": [ - { - "name": "Setup-Variables", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// See if the use-prefix global has been set. Use default if not.", - "let usePrefix = '';", - "", - "// Hardcode recurring booking and appointment UUIDs.", - "pm.globals.set('pm_booking_uuid', '\"pm_recurring_booking_uuid\"');", - "pm.globals.set('pm_appt_uuid', '\"pm_recurring_appt_uuid\"');", - "", - "if (pm.globals.get('use-prefix')) {", - " console.log(\"==> use-prefix exists\");", - " usePrefix = pm.globals.get('use-prefix');", - " console.log(\" --> Prefix is: \" + usePrefix);", - " ", - " // Set up all globals, using the correct prefix.", - " pm.globals.set('auth_url', pm.globals.get(usePrefix + 'auth_url'));", - " pm.globals.set('realm', pm.globals.get(usePrefix + 'realm'));", - " pm.globals.set('clientid', pm.globals.get(usePrefix + 'clientid'));", - " pm.globals.set('client_secret', pm.globals.get(usePrefix + 'client_secret'));", - " pm.globals.set('url', pm.globals.get(usePrefix + 'url'));", - "", - " pm.globals.set('public_url', pm.globals.get(usePrefix + 'public_url'));", - " pm.globals.set('public_user_id', pm.globals.get(usePrefix + 'public_user_id'));", - " pm.globals.set('public_user_password', pm.globals.get(usePrefix + 'public_user_password'));", - "}", - "else {", - " console.log(\"==> use-prefix does not exist\");", - " console.log(\" --> No default globals set.\");", - "}", - "", - "// If no maximum load time defined, set a default.", - "if (!pm.globals.get('max_load_time')) {", - " console.log(\"==> max_load_time not present, default set.\");", - " pm.globals.set(\"max_load_time\", JSON.stringify(1503));", - "}", - "", - "// If no maximum response defined, set a default.", - "if (!pm.globals.get('max_response_time')) {", - " console.log(\"==> max_response_time not present, default set.\");", - " pm.globals.set(\"max_response_time\", JSON.stringify(15005));", - "}", - "", - "// Display the values of all globals.", - "console.log(\"\");", - "console.log(\"==> Globals are:\");", - "console.log(\" --> auth_url: \" + pm.globals.get(\"auth_url\"));", - "console.log(\" --> realm: \" + pm.globals.get(\"realm\"));", - "console.log(\" --> clientid: \" + pm.globals.get(\"clientid\"));", - "console.log(\" --> client_secret: \" + pm.globals.get(\"client_secret\"));", - "console.log(\" --> url: \" + pm.globals.get(\"url\"));", - "console.log(\" --> max_load_time: \" + pm.globals.get(\"max_load_time\"));", - "console.log(\" --> max_response_time: \" + pm.globals.get(\"max_response_time\"));", - "console.log(\" --> booking_uuid: \" + pm.globals.get(\"pm_booking_uuid\"));", - "console.log(\" --> appointment_uuid: \" + pm.globals.get(\"pm_appt_uuid\"));", - "console.log(\" --> public_url: \" + pm.globals.get(\"public_url\"));", - "console.log(\" --> public_user_id: \" + pm.globals.get(\"public_user_id\"));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Dummy data." - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "Authentication Token", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to make sure that the access token field is not null", - "pm.test(\"Access Token is not null\", function(){", - " var access_token = jsonData.access_token;", - " if (pm.expect(access_token).not.eql(null)){", - " pm.globals.set(\"token\", access_token);", - " }", - "});", - "//Test to make sure that the refresh token response field is not null", - "pm.test(\"Refresh Token is not null\", function(){", - " var refresh_token = jsonData.refresh_token;", - " if (pm.expect(refresh_token).not.eql(null)){", - " pm.globals.set(\"refresh_token\", refresh_token);", - " }", - "});", - "//Test to make sure that expires in response field is not nullf", - "pm.test(\"Expires In is not null\", function(){", - " var expires_in = jsonData.expires_in;", - " if (pm.expect(expires_in).not.eql(null)){", - " pm.globals.set(\"expires_in\", expires_in);", - " }", - "});", - "//Test to make sure that refresh expires in response fiels is not null", - "pm.test(\"Refresh Expires In is not null\", function(){", - " var refresh_expires_in = jsonData.refresh_expires_in;", - " if (pm.expect(refresh_expires_in).not.eql(null)){", - " pm.globals.set(\"refresh_expires_in\", refresh_expires_in);", - " }", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/x-www-form-urlencoded", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "grant_type=password&client_id={{clientid}}&username={{userid}}&password={{password}}&client_secret={{client_secret}}" - }, - "url": { - "raw": "{{auth_url}}/auth/realms/{{realm}}/protocol/openid-connect/token?Content-Type=application/x-www-form-urlencoded", - "host": [ - "{{auth_url}}" - ], - "path": [ - "auth", - "realms", - "{{realm}}", - "protocol", - "openid-connect", - "token" - ], - "query": [ - { - "key": "Content-Type", - "value": "application/x-www-form-urlencoded" - } - ] - } - }, - "response": [] - }, - { - "name": "CFMS-Install-Auth-First", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"auth_first\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "auth_url = globals.auth_url;\nrealm = globals.realm;\nclientid = globals.clientid;\nuserid = globals.userid;\npassword = globals.password;\nclient_secret = globals.client_secret;\n\nconst echoPostRequest = {\n url: auth_url + '/auth/realms/' + realm + '/protocol/openid-connect/token',\n method: 'POST',\n header: 'Content-Type:application/x-www-form-urlencoded',\n body: {\n mode: 'raw',\n raw: 'grant_type=password&client_id=' + clientid \n + '&username=' + userid \n + '&password=' + password\n + '&client_secret=' + client_secret\n }\n};\npm.sendRequest(echoPostRequest, function (err, res) {\n var jsonData = res.json();\n if (jsonData.hasOwnProperty('access_token')) {\n \tpm.globals.set(\"token\", jsonData.access_token);\n\t pm.globals.set(\"refresh_token\", jsonData.refresh_token);\n\t console.log(err ? err : res.json());\n\t} else {\n\t pm.globals.set(\"token\", 0);\n\t pm.globals.set(\"refresh_token\", 0);\n\t pm.globals.set(\"token_expires\", 0);\n\t pm.globals.set(\"refresh_token_expires\", 0);\n\t}\n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Basic-Response-Tests", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"basic_response_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// If no maximum response defined, set a default.\nresponse_max = 0;\nif (globals.response_max) {\n response_max = JSON.parse(globals.response_max);\n}\nelse {\n response_max = 5009;\n pm.globals.set(\"response_max\", JSON.stringify(response_max));\n};\n\n// Get the max response time allowed.\npm.test('Response time less than ' + response_max.toString() + 'ms', function(){\n pm.expect(pm.response.responseTime).to.be.below(response_max);\n});\n\npm.test(\"Response code for request is 200\", function(){\n pm.response.to.have.status(200);\n});\npm.test('Response header should have Content-Type of application/json', function() {\n pm.response.to.have.header('content-type', 'application/json');\n});\npm.test('Response body be in JSON format', function() {\n pm.response.to.be.json; \n});" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Exam-Type-Data", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"init_exam_type_data\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Finds an exam name in the JSON list allTypes of exam types.\nfunction find_exam(input_exam_name, allTypes) {\n\texam_id_value = -1;\n\n // Loop to look for the input exam name.\n if (allTypes) {\n allTypes.forEach(function(type) {\n if ((type.exam_type_name) == input_exam_name) {\n exam_id_value = type.exam_type_id;\n }\n });\n }\n \n // If the exam wasn't found, set it to be the first exam.\n if (exam_id_value == -1) {\n exam_id_value = allTypes[0].exam_type_id;\n }\n\n // Return the exam_id_type of the input exam name.\n return exam_id_value;\n}\n\n// Get the list of all possible exam types.\nallTypes = null;\nvar jsonData = JSON.parse(responseBody);\nif (jsonData.hasOwnProperty(\"exam_types\")) {\n\tallTypes = jsonData.exam_types;\n}\n\nexam_array = [];\nexam_array.push({name: \"IPSE - 4HR Single Exam\", weight: 40.2, id: find_exam(\"IPSE - 4HR Single Exam\", allTypes)});\nname = \"IPSE - 4HR Single Exam\";\nexam_array.push({name: name, weight: exam_array[0].weight + 14.5, id: find_exam(name, allTypes)});\nname = \"SLE - 3HR Group Exam\";\nexam_array.push({name: name, weight: exam_array[1].weight + 7.4, id: find_exam(name, allTypes)});\nname = \"COFQ - 3HR Group Exam\";\nexam_array.push({name: name, weight: exam_array[2].weight + 5.8, id: find_exam(name, allTypes)});\nname = \"IPSE - 4HR Group Exam\";\nexam_array.push({name: name, weight: exam_array[3].weight + 5.7, id: find_exam(name, allTypes)});\nname = \"COFQ - 3HR Single Exam\";\nexam_array.push({name: name, weight: exam_array[4].weight + 5.5, id: find_exam(name, allTypes)});\nname = \"Monthly Session Exam\";\nexam_array.push({name: name, weight: exam_array[5].weight + 3.8, id: find_exam(name, allTypes)});\nname = \"SLE - 3HR Single Exam\";\nexam_array.push({name: name, weight: exam_array[6].weight + 3.5, id: find_exam(name, allTypes)});\nname = \"Angling Guide Outfitter\";\nexam_array.push({name: name, weight: exam_array[7].weight + 2.4, id: find_exam(name, allTypes)});\nname = \"IPSE - 5HR Single Exam - Time Extension\";\nexam_array.push({name: name, weight: exam_array[8].weight + 2.3, id: find_exam(name, allTypes)});\nname = \"Exam Booking - 3 Hour Miscellaneous\";\nexam_array.push({name: name, weight: exam_array[9].weight + 1.7, id: find_exam(name, allTypes)});\n\n// Store the initialized exam data for later use.\npostman.setEnvironmentVariable(\"exam_array_data\", JSON.stringify(exam_array));" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Exam-Get-Random", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"create_random_functions\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Function returns a weighted randomized exam type index.\nfunction get_random_index(exam_array) {\n\n // Generate a random number up to the maximum weight allowed.\n random_number = Math.floor(Math.random() * exam_array[exam_array.length - 1].weight);\n \n // Get the index of the exam type corresponding to that weight.\n index = get_index(random_number, exam_array);\n\n // Return the index.\n return index;\n}\n\n// Based on a random number, turns it into a weighted randomized exam type index.\nfunction get_index(random_value, exam_array) {\n index = 0;\n var i;\n for (i = 0; i < exam_array.length; i++) {\n if (random_value <= exam_array[i].weight) {\n index = i;\n break;\n }\n }\n \n return index;\n}\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Room-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"room_schema_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the JSON Schema expected in response\nvar roomSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"rooms\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"capacity\": {\"type\": \"number\"},\n \"color\": {\"type\": \"string\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointment_duration\": {\"type\": [\"null\", \"number\"]},\n \"appointments_days_limit\": {\"type\": [\"null\", \"number\"]},\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"back_office_list\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"actual_service_ind\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\",\n \"external_service_name\", \"online_availability\",\n \"online_link\", \"parent\", \"parent_id\", \"prefix\",\n \"service_code\", \"service_desc\", \"service_id\",\n \"service_name\"]\n },\n },\n \"civic_address\": {\"type\": [\"null\", \"string\"]},\n \"counters\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter_id\": {\"type\": \"number\"},\n \"counter_name\": {\"type\": \"string\"}\n },\n \"required\": [\"counter_id\", \"counter_name\"]\n },\n },\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"latitude\": {\"type\": \"number\"},\n \"longitude\": {\"type\": \"number\"},\n \"max_person_appointment_per_day\": {\"type\": [\"null\", \"number\"]},\n \"office_appointment_message\": {\"type\": [\"null\", \"string\"]},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"online_status\": {\"type\": \"string\"},\n \"quick_list\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"actual_service_ind\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\",\n \"external_service_name\", \"online_availability\",\n \"online_link\", \"parent\", \"parent_id\", \"prefix\",\n \"service_code\", \"service_desc\", \"service_id\",\n \"service_name\"]\n },\n },\n \"sb\": {\n \"type\": \"object\",\n \"properties\": {\n \"sb_id\": {\"type\": \"number\"},\n \"sb_type\": {\"type\": \"string\"}\n },\n \"required\": [\"sb_id\", \"sb_type\"]\n },\n \"sb_id\": {\"type\": \"number\"},\n \"telephone\": {\"type\": [\"null\", \"string\"]},\n \"timeslots\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"day_of_week\": {\"type\": [\"null\", \"array\"]},\n \"end_time\": {\"type\": \"string\"},\n \"no_of_slots\": {\"type\": \"number\"},\n \"office\": {\"type\": [\"null\", \"number\"]},\n \"start_time\": {\"type\": \"string\"}\n },\n \"required\": [\"day_of_week\", \"end_time\", \"no_of_slots\",\n \"office\", \"start_time\"]\n },\n },\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n }\n },\n \"required\": [\"appointment_duration\", \"appointments_days_limit\",\n \"appointments_enabled_ind\", \"back_office_list\", \"civic_address\",\n \"counters\", \"exams_enabled_ind\", \"latitude\",\n \"longitude\", \"max_person_appointment_per_day\",\n \"office_appointment_message\", \"office_id\", \"office_name\",\n \"office_number\", \"online_status\", \"quick_list\", \"sb\", \"sb_id\",\n \"telephone\", \"timeslots\", \"timezone\"]\n },\n \"room_id\": {\"type\": \"number\"},\n \"room_name\": {\"type\": \"string\"}\n },\n \"required\": [\"capacity\", \"color\", \"deleted\", \"office\", \"room_id\", \"room_name\"]\n }\n },\n \"errors\": {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"rooms\", \"errors\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Room Schema\", function(){\n pm.expect(tv4.validate(jsonData, roomSchema)).to.be.true;\n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Exam-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"exam_schema_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the JSON Schema expected in response\nvar examSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"exam\": {\n \"type\": \"object\",\n \"properties\": {\n \"exam_type\": {\n \"type\": \"object\",\n \"properties\": {\n \"exam_color\": {\"type\": \"string\"},\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_type_name\": {\"type\": \"string\"},\n \"group_exam_ind\": {\"type\": \"number\"},\n \"ita_ind\": {\"type\": \"number\"},\n \"method_type\": {\"type\": \"string\"},\n \"number_of_hours\": {\"type\": \"number\"},\n \"number_of_minutes\": {\"type\": [\"number\", \"null\"]},\n \"pesticide_exam_ind\": {\"type\": \"number\" }\n },\n \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"group_exam_ind\", \"ita_ind\",\n \"method_type\", \"number_of_hours\", \"number_of_minutes\", \"pesticide_exam_ind\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"exam_type_id\": {\"type\": \"number\"},\n \"notes\": {\"type\": \"string\"},\n \"exam_written_ind\": {\"type\": \"number\"},\n \"examinee_email\": {\"type\": [\"null\", \"string\"]},\n \"exam_destroyed_date\": {\"type\": [\"null\", \"string\"]},\n \"receipt\": {\"type\": [\"null\", \"number\", \"string\"]},\n \"session_number\": {\"type\": [\"number\", \"null\"]},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n }\n },\n \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\",\n \"office_number\", \"timezone\"]\n },\n \"exam_id\": {\"type\": \"number\"},\n \"bcmp_job_id\": {\"type\": [\"null\", \"number\"]},\n \"expiry_date\": {\"type\": [\"string\", \"null\"]},\n \"sbc_managed_ind\": {\"type\": \"number\"},\n \"invigilator_id\": {\"type\": [\"null\", \"number\"]},\n \"examinee_phone\": {\"type\": [\"null\", \"string\"]},\n \"upload_received_ind\": {\"type\": \"number\"},\n \"booking_id\": {\"type\": [\"null\", \"number\"]},\n \"booking\": {\"type\": [\"null\", \"object\"]},\n \"invigilator\": {\"type\": [\"null\", \"object\"]},\n \"is_pesticide\": {\"type\": \"number\"},\n \"exam_returned_date\": {\"type\": [\"null\", \"string\"]},\n \"payee_email\": {\"type\": [\"null\", \"string\"]},\n \"candidates_list\": {\"type\": [\"null\", \"array\", \"object\"]},\n \"exam_returned_tracking_number\": {\"type\": [\"null\", \"string\"]},\n \"payee_name\": {\"type\": [\"null\", \"string\"]},\n \"deleted_date\": {\"type\": [\"null\", \"string\"]},\n \"payee_phone\": {\"type\": [\"null\", \"string\"]},\n \"event_id\": {\"type\": \"string\"},\n \"payee_ind\": {\"type\": \"number\"},\n \"exam_received_date\": {\"type\": [\"null\", \"string\"]},\n \"number_of_students\": {\"type\": \"number\"},\n \"exam_method\": {\"type\": \"string\"},\n \"offsite_location\": {\"type\": [\"null\", \"string\"]},\n \"exam_name\": {\"type\": \"string\"},\n \"examinee_name\": {\"type\": \"string\"},\n \"receipt_sent_ind\": {\"type\": \"number\"}\n },\n \"required\": [\"exam_type\", \"office_id\", \"exam_type_id\", \"notes\", \"exam_written_ind\", \"examinee_email\", \"exam_destroyed_date\", \"receipt\",\n \"session_number\", \"office\", \"exam_id\", \"bcmp_job_id\", \"expiry_date\", \"sbc_managed_ind\", \"invigilator_id\", \"examinee_phone\",\n \"upload_received_ind\", \"booking_id\", \"booking\", \"invigilator\", \"is_pesticide\", \"exam_returned_date\", \"payee_email\",\n \"candidates_list\", \"exam_returned_tracking_number\", \"payee_name\", \"deleted_date\", \"payee_phone\", \"event_id\", \"payee_ind\",\n \"exam_received_date\", \"number_of_students\", \"exam_method\", \"offsite_location\", \"exam_name\", \"examinee_name\", \"receipt_sent_ind\"]\n },\n \"errors\": {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"exam\", \"errors\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Exam Schema\", function(){\n pm.expect(tv4.validate(jsonData, examSchema)).to.be.true;\n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Exam-Data-Check", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"exam_data_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Make sure that jsonData has an exam property.\npm.test(\"Response should have exam property\", function(){\n pm.expect(jsonData.hasOwnProperty(\"exam\")).to.be.true;\n});\n\n// If jsonData has exam property, check data.\nif (jsonData.hasOwnProperty(\"exam\")) {\n\n //Test to see if Event ID field remains unchanged\n pm.test(\"Validate Event Id has expected value\", function(){\n pm.expect(jsonData.event_id === environment.event_id);\n });\n\n //Test to see if exam method field remains unchanged\n pm.test(\"Validate exam method has expected value\", function(){\n pm.expect(jsonData.exam_method === environment.exam_method);\n });\n\n //Test to see if exam name field remains unchanged\n pm.test(\"Validate exam name has expected value\", function(){\n pm.expect(jsonData.exam_name === environment.exam_name);\n });\n\n //Test to see if exam type field remains unchanged\n pm.test(\"Validate exam type id has expected value\", function(){\n pm.expect(jsonData.exam_type_id === environment.random_exam_type_id);\n });\n\n //Test to see if exam written indicator field remains unchanged\n pm.test(\"Validate exam written indicator has expected value\", function(){\n pm.expect(jsonData.exam_written_ind === environment.exam_written_ind);\n });\n\n //Test to see if examinee name field remains unchanged\n pm.test(\"Validate examinee name has expected value\", function(){\n pm.expect(jsonData.examinee_name === environment.examinee_name);\n });\n\n //Test to see if notes field remains unchanged\n pm.test(\"Validate notes has expected value\", function(){\n pm.expect(jsonData.notes === environment.notes);\n });\n\n //Test to see if number of students field remains unchanged\n pm.test(\"Validate number of students has expected value\", function(){\n pm.expect(jsonData.number_of_students === environment.number_of_students);\n });\n\n //Test to see if office id remains unchanged\n pm.test(\"Validate office id has expected value\", function(){\n pm.expect(jsonData.office_id === environment.current_office_id);\n });\n\n //Test to see if offsite location is expected\n pm.test(\"Validate offsite location has expected value\", function(){\n pm.expect(jsonData.offsite_location === environment.offsite_location);\n });\n}\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Exam-List-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"exam_schema_list_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the JSON Schema expected in response\nvar examSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"exams\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"exam_type\": {\n \"type\": \"object\",\n \"properties\": {\n \"exam_color\": {\"type\": \"string\"},\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_type_name\": {\"type\": \"string\"},\n \"group_exam_ind\": {\"type\": \"number\"},\n \"ita_ind\": {\"type\": \"number\"},\n \"method_type\": {\"type\": \"string\"},\n \"number_of_hours\": {\"type\": \"number\"},\n \"number_of_minutes\": {\"type\": [\"number\", \"null\"]},\n \"pesticide_exam_ind\": {\"type\": \"number\" }\n },\n \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"group_exam_ind\", \"ita_ind\",\n \"method_type\", \"number_of_hours\", \"number_of_minutes\", \"pesticide_exam_ind\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"exam_type_id\": {\"type\": \"number\"},\n \"notes\": {\"type\": [\"null\", \"string\"]},\n \"exam_written_ind\": {\"type\": \"number\"},\n \"examinee_email\": {\"type\": [\"null\", \"string\"]},\n \"exam_destroyed_date\": {\"type\": [\"null\", \"string\"]},\n \"receipt\": {\"type\": [\"null\", \"string\"]},\n \"session_number\": {\"type\": [\"number\", \"null\", \"string\"]},\n \"exam_id\": {\"type\": \"number\"},\n \"expiry_date\": {\"type\": [\"string\", \"null\"]},\n \"sbc_managed_ind\": {\"type\": \"number\"},\n \"invigilator_id\": {\"type\": [\"null\", \"number\"]},\n \"examinee_phone\": {\"type\": [\"null\", \"string\"]},\n \"upload_received_ind\": {\"type\": \"number\"},\n \"booking_id\": {\"type\": [\"null\", \"number\"]},\n \"booking\": {\"type\": [\"null\", \"object\"]},\n \"examinee_name\": {\"type\": [\"null\", \"string\"]},\n \"invigilator\": {\"type\": [\"null\", \"object\"]},\n \"is_pesticide\": {\"type\": \"number\"},\n \"exam_returned_date\": {\"type\": [\"null\", \"string\"]},\n \"payee_email\": {\"type\": [\"null\", \"string\"]},\n \"candidates_list\": {\"type\": [\"null\", \"array\", \"object\"]},\n \"exam_returned_tracking_number\": {\"type\": [\"null\", \"string\"]},\n \"payee_name\": {\"type\": [\"null\", \"string\"]},\n \"deleted_date\": {\"type\": [\"null\", \"string\"]},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n },\n },\n \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"timezone\"]\n },\n \"payee_phone\": {\"type\": [\"null\", \"string\"]},\n \"event_id\": {\"type\": [\"null\", \"string\"]},\n \"payee_ind\": {\"type\": \"number\"},\n \"exam_received_date\": {\"type\": [\"null\", \"string\"]},\n \"number_of_students\": {\"type\": [\"null\", \"number\"]},\n \"exam_method\": {\"type\": \"string\"},\n \"offsite_location\": {\"type\": [\"null\", \"string\"]},\n \"receipt_sent_ind\": {\"type\": \"number\"},\n \"exam_name\": {\"type\": \"string\"},\n \"bcmp_job_id\": {\"type\": [\"null\", \"string\"]}\n },\n \"required\": [\"exam_type\", \"office_id\", \"exam_type_id\", \"notes\", \"exam_written_ind\", \"examinee_email\", \"exam_destroyed_date\",\n \"receipt\", \"session_number\", \"exam_id\", \"expiry_date\", \"sbc_managed_ind\", \"invigilator_id\",\n \"examinee_phone\", \"upload_received_ind\", \"booking_id\", \"booking\", \"examinee_name\", \"invigilator\",\n \"is_pesticide\", \"exam_returned_date\", \"payee_email\", \"candidates_list\", \"exam_returned_tracking_number\",\n \"payee_name\", \"deleted_date\", \"office\", \"payee_phone\", \"event_id\", \"payee_ind\", \"exam_received_date\",\n \"number_of_students\", \"exam_method\", \"offsite_location\", \"receipt_sent_ind\", \"exam_name\", \"bcmp_job_id\"]\n },\n },\n \"errors\": {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"exams\", \"errors\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Exam List Schema\", function(){\n pm.expect(tv4.validate(jsonData, examSchema)).to.be.true;\n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Booking-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"booking_schema_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the JSON Schema expected in response\nvar bookingSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"booking\": {\n \"type\": \"object\",\n \"properties\": {\n \"blackout_flag\": {\"type\": \"string\"},\n \"blackout_notes\": {\"type\": [\"string\", \"null\"]},\n \"booking_contact_information\": {\"type\": [\"string\", \"null\"]},\n \"booking_id\": {\"type\": \"number\"},\n \"booking_name\": {\"type\": [\"string\", \"null\"]},\n \"end_time\": {\"type\": \"string\"},\n \"fees\": {\"type\": \"string\"},\n \"invigilators\": {\"type\": \"array\"},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n }\n },\n \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"timezone\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"recurring_uuid\": {\"type\": [\"string\", \"null\"]},\n \"room\": {\n \"type\": \"object\",\n \"properties\": {\n \"capacity\": {\"type\": \"number\"},\n \"color\": {\"type\": \"string\"},\n \"deleted\": {\"type\": [\"string\", \"null\"]},\n \"room_id\": {\"type\": \"number\"},\n \"room_name\": {\"type\": \"string\"}\n },\n \"required\": [\"capacity\", \"color\", \"room_id\", \"room_name\", \"deleted\"]\n },\n \"room_id\": {\"type\": \"number\"},\n \"sbc_staff_invigilated\": {\"type\": \"number\"},\n \"shadow_invigilator_id\": {\"type\": [\"number\", \"null\"]},\n \"start_time\": {\"type\": \"string\"}\n },\n \"required\": [\"blackout_flag\", \"blackout_notes\", \"booking_contact_information\", \"booking_id\",\n \"booking_name\", \"end_time\", \"fees\", \"invigilators\", \"office\", \"office_id\",\n \"recurring_uuid\", \"room\", \"room_id\", \"sbc_staff_invigilated\", \"shadow_invigilator_id\",\n \"start_time\"]\n },\n \"errors\": { \"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"booking\", \"errors\"]\n}\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Booking Schema\", function(){\n pm.expect(tv4.validate(jsonData, bookingSchema)).to.be.true;\n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Booking-Data-Check", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"booking_data_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Make sure that jsonData has an booking property.\npm.test(\"Response should have booking property\", function(){\n pm.expect(jsonData.hasOwnProperty(\"booking\")).to.be.true;\n});\n\n// If jsonData has booking property, check data.\nif (jsonData.hasOwnProperty(\"booking\")) {\n\n //Test to see if booking name has expected value\n pm.test(\"Validate Booking Name has expected value\", function(){\n pm.expect(jsonData.booking_name === environment.booking_name);\n });\n\n //Test to see if start time has expected value\n pm.test(\"Validate start time has expected value\", function(){\n pm.expect(jsonData.start_time === environment.start_time);\n });\n\n //Test to see if end time has expected value\n pm.test(\"Validate end time has expected value\", function(){\n pm.expect(jsonData.end_time === environment.end_time);\n });\n\n //Test to see if room id has expected value\n pm.test(\"Validate room id has expected value\", function(){\n pm.expect(jsonData.room_id === environment.room_id_1);\n });\n\n //Test to see if fees field has expected value\n pm.test(\"Validate fees has expected value\", function(){\n pm.expect(jsonData.fees === environment.fees);\n });\n\n //Test to see if office id field has expected value\n pm.test(\"Validate office id has expected value\", function(){\n pm.expect(jsonData.office_id === environment.current_office_id);\n });\n}\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Booking-List-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"booking_list_schema_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "var bookingSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"bookings\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"booking_name\": {\"type\": \"string\"},\n \"blackout_flag\": {\"type\": \"string\"},\n \"sbc_staff_invigilated\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"room_id\": {\"type\": [\"null\", \"number\"]},\n \"blackout_notes\": {\"type\": [\"null\", \"string\"]},\n \"shadow_invigilator_id\": {\"type\": [\"null\", \"number\"]},\n \"room\": {\n \"type\": [\"null\", \"object\"],\n \"properties\": {\n \"capacity\": {\"type\": \"number\"},\n \"color\": {\"type\": \"string\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"room_id\": {\"type\": \"number\"},\n \"room_name\": {\"type\": \"string\"}\n },\n \"required\": [\"capacity\", \"color\", \"deleted\", \"room_id\", \"room_name\"]\n },\n \"booking_id\": {\"type\": \"number\"},\n \"end_time\": {\"type\": \"string\"},\n \"booking_contact_information\": {\"type\": [\"null\", \"string\"]},\n \"recurring_uuid\": {\"type\": [\"null\", \"string\"]},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n }\n },\n \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"timezone\"]\n },\n \"invigilators\": {\"type\": \"array\"},\n \"fees\": {\"type\": [\"null\", \"string\"]},\n \"start_time\": {\"type\": \"string\"},\n },\n \"required\": [\"booking_name\", \"blackout_flag\", \"sbc_staff_invigilated\", \"office_id\", \"room_id\", \"blackout_notes\",\n \"shadow_invigilator_id\", \"room\", \"booking_id\", \"end_time\", \"booking_contact_information\", \"recurring_uuid\",\n \"office\", \"invigilators\", \"fees\", \"start_time\"]\n },\n },\n \"errors\": {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"bookings\", \"errors\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Booking List Schema\", function(){\n pm.expect(tv4.validate(jsonData, bookingSchema)).to.be.true;\n});" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Invigilator-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"invigilator_schema_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the JSON Schema expected in response\nvar invigilatorSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"invigilators\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"contact_email\": {\"type\": \"string\"},\n \"contact_phone\": {\"type\": \"string\"},\n \"contract_expiry_date\": {\"type\": \"string\"},\n \"contract_number\": {\"type\": \"string\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"invigilator_id\": {\"type\": \"number\"},\n \"invigilator_name\": {\"type\": \"string\"},\n \"invigilator_notes\": {\"type\": [\"null\", \"string\"]},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointment_duration\": {\"type\": [\"null\", \"number\"]},\n \"appointments_days_limit\": {\"type\": [\"null\", \"number\"]},\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"back_office_list\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"actual_service_ind\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\",\n \"external_service_name\", \"online_availability\",\n \"online_link\", \"parent\", \"parent_id\", \"prefix\",\n \"service_code\", \"service_desc\", \"service_id\",\n \"service_name\"]\n },\n },\n \"civic_address\": {\"type\": [\"null\", \"string\"]},\n \"counters\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter_id\": {\"type\": \"number\"},\n \"counter_name\": {\"type\": \"string\"}\n },\n \"required\": [\"counter_id\", \"counter_name\"]\n },\n },\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"latitude\": {\"type\": [\"null\", \"number\"]},\n \"longitude\": {\"type\": [\"null\", \"number\"]},\n \"max_person_appointment_per_day\": {\"type\": [\"null\", \"number\"]},\n \"office_appointment_message\": {\"type\": [\"null\", \"string\"]},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"online_status\": {\"type\": \"string\"},\n \"quick_list\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"actual_service_ind\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\",\n \"external_service_name\", \"online_availability\",\n \"online_link\", \"parent\", \"parent_id\", \"prefix\",\n \"service_code\", \"service_desc\", \"service_id\",\n \"service_name\"]\n },\n },\n \"sb\": {\n \"type\": \"object\",\n \"properties\": {\n \"sb_id\": {\"type\": \"number\"},\n \"sb_type\": {\"type\": \"string\"}\n },\n \"required\": [\"sb_id\", \"sb_type\"]\n },\n \"sb_id\": {\"type\": \"number\"},\n \"telephone\": {\"type\": [\"null\", \"string\"]},\n \"timeslots\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"day_of_week\": {\"type\": [\"null\", \"array\"]},\n \"end_time\": {\"type\": \"string\"},\n \"no_of_slots\": {\"type\": \"number\"},\n \"office\": {\"type\": [\"null\", \"number\"]},\n \"start_time\": {\"type\": \"string\"}\n },\n \"required\": [\"day_of_week\", \"end_time\", \"no_of_slots\",\n \"office\", \"start_time\"]\n },\n },\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n }\n },\n \"required\": [\"appointment_duration\", \"appointments_days_limit\",\n \"appointments_enabled_ind\", \"back_office_list\", \"civic_address\",\n \"counters\", \"exams_enabled_ind\", \"latitude\",\n \"longitude\", \"max_person_appointment_per_day\",\n \"office_appointment_message\", \"office_id\", \"office_name\",\n \"office_number\", \"online_status\", \"quick_list\", \"sb\", \"sb_id\",\n \"telephone\", \"timeslots\", \"timezone\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"shadow_count\": {\"type\": \"number\"},\n \"shadow_flag\": {\"type\": \"string\"}\n },\n \"required\": [\"contact_email\", \"contact_phone\", \"contract_expiry_date\", \"contract_number\",\n \"deleted\", \"invigilator_id\", \"invigilator_name\", \"invigilator_notes\",\n \"office\", \"office_id\", \"shadow_count\", \"shadow_flag\"]\n }\n },\n \"errors\": {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"invigilators\", \"errors\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Invigilator Response Schema\", function(){\n pm.expect(tv4.validate(jsonData, invigilatorSchema)).to.be.true;\n});" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Invig-One-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"invig_one_schema_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the JSON Schema expected in response\nvar invigilatorSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"invigilator\": {\n \"type\": \"object\",\n \"properties\": {\n \"contact_email\": {\"type\": \"string\"},\n \"contact_phone\": {\"type\": \"string\"},\n \"contract_expiry_date\": {\"type\": \"string\"},\n \"contract_number\": {\"type\": \"string\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"invigilator_id\": {\"type\": \"number\"},\n \"invigilator_name\": {\"type\": \"string\"},\n \"invigilator_notes\": {\"type\": \"string\"},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointment_duration\": {\"type\": [\"null\", \"number\"]},\n \"appointments_days_limit\": {\"type\": [\"null\", \"number\"]},\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"back_office_list\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"actual_service_ind\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\",\n \"external_service_name\", \"online_availability\",\n \"online_link\", \"parent\", \"parent_id\", \"prefix\",\n \"service_code\", \"service_desc\", \"service_id\",\n \"service_name\"]\n },\n },\n \"civic_address\": {\"type\": [\"null\", \"string\"]},\n \"counters\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter_id\": {\"type\": \"number\"},\n \"counter_name\": {\"type\": \"string\"}\n },\n \"required\": [\"counter_id\", \"counter_name\"]\n },\n },\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"latitude\": {\"type\": [\"null\", \"number\"]},\n \"longitude\": {\"type\": [\"null\", \"number\"]},\n \"max_person_appointment_per_day\": {\"type\": [\"null\", \"number\"]},\n \"office_appointment_message\": {\"type\": [\"null\", \"string\"]},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"online_status\": {\"type\": \"string\"},\n \"quick_list\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"actual_service_ind\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\",\n \"external_service_name\", \"online_availability\",\n \"online_link\", \"parent\", \"parent_id\", \"prefix\",\n \"service_code\", \"service_desc\", \"service_id\",\n \"service_name\"]\n },\n },\n \"sb\": {\n \"type\": \"object\",\n \"properties\": {\n \"sb_id\": {\"type\": \"number\"},\n \"sb_type\": {\"type\": \"string\"}\n },\n \"required\": [\"sb_id\", \"sb_type\"]\n },\n \"sb_id\": {\"type\": \"number\"},\n \"telephone\": {\"type\": [\"null\", \"string\"]},\n \"timeslots\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"day_of_week\": {\"type\": [\"null\", \"array\"]},\n \"end_time\": {\"type\": \"string\"},\n \"no_of_slots\": {\"type\": \"number\"},\n \"office\": {\"type\": [\"null\", \"number\"]},\n \"start_time\": {\"type\": \"string\"}\n },\n \"required\": [\"day_of_week\", \"end_time\", \"no_of_slots\",\n \"office\", \"start_time\"]\n },\n },\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n }\n },\n \"required\": [\"appointment_duration\", \"appointments_days_limit\",\n \"appointments_enabled_ind\", \"back_office_list\", \"civic_address\",\n \"counters\", \"exams_enabled_ind\", \"latitude\",\n \"longitude\", \"max_person_appointment_per_day\",\n \"office_appointment_message\", \"office_id\", \"office_name\",\n \"office_number\", \"online_status\", \"quick_list\", \"sb\", \"sb_id\",\n \"telephone\", \"timeslots\", \"timezone\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"shadow_count\": {\"type\": \"number\"},\n \"shadow_flag\": {\"type\": \"string\"}\n },\n \"required\": [\"contact_email\", \"contact_phone\", \"contract_expiry_date\", \"contract_number\",\n \"deleted\", \"invigilator_id\", \"invigilator_name\", \"invigilator_notes\",\n \"office\", \"office_id\", \"shadow_count\", \"shadow_flag\"]\n },\n \"errors\": {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"invigilator\", \"errors\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Invigilator Response Schema\", function(){\n pm.expect(tv4.validate(jsonData, invigilatorSchema)).to.be.true;\n});" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Appointment-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"appointment_schema_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the JSON Schema expected in response\nvar appointmentSchema = {\n \"type\": \"object\", \n \"properties\": {\n \"appointment\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointment_id\": {\"type\": \"number\"},\n \"checked_in_time\": {\"type\": [\"string\", \"null\"]},\n \"citizen_name\": {\"type\": \"string\"},\n \"comments\": {\"type\": \"string\"},\n \"contact_information\": {\"type\": [\"string\", \"null\"]},\n \"end_time\": {\"type\": \"string\"},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n },\n },\n \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"timezone\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"service_id\": {\"type\": [\"null\", \"number\"]},\n \"start_time\": {\"type\": \"string\"},\n \"blackout_flag\": {\"type\": \"string\"},\n \"citizen_id\": {\"type\": \"number\"},\n \"online_flag\": {\"type\": \"boolean\"},\n \"recurring_uuid\": {\"type\": [\"null\", \"string\"]},\n \"services\": {\n \"type\": \"object\",\n \"properties\": {\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"timeslot_duration\": {\"type\": [\"null\", \"number\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"service_name\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"actual_service_ind\": {\"type\": \"number\"},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]}\n },\n \"required\": [\"deleted\", \"display_dashboard_ind\", \"timeslot_duration\", \"parent\",\n \"service_name\", \"service_code\", \"actual_service_ind\", \"online_link\",\n \"service_desc\", \"service_id\", \"parent_id\", \"prefix\", \"online_availability\",\n \"external_service_name\"]\n }\n },\n \"required\": [\"appointment_id\", \"checked_in_time\", \"citizen_name\", \"comments\",\n \"contact_information\", \"end_time\", \"office\", \"office_id\", \"service_id\",\n \"start_time\", \"blackout_flag\", \"citizen_id\", \"online_flag\",\n \"recurring_uuid\", \"service\"],\n },\n \"errors\": {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"appointment\", \"errors\"],\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Appointments Schema\", function(){\n pm.expect(tv4.validate(jsonData, appointmentSchema)).to.be.true;\n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Appointment-Data-Check", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"appointment_data_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Make sure that jsonData has an appointment property.\npm.test(\"Response should have appointment property\", function(){\n pm.expect(jsonData.hasOwnProperty(\"appointment\")).to.be.true;\n});\n\nvar name = jsonData.appointment.citizen_name;\nvar comments = jsonData.appointment.comments;\nvar contact = jsonData.appointment.contact_information;\nvar name_expect = JSON.parse(pm.globals.get(\"appt_citizen_name\"));\nvar comments_expect = JSON.parse(pm.globals.get(\"appt_comments\"));\nvar contact_expect = JSON.parse(pm.globals.get(\"appt_contact_information\"));\n\n// If jsonData has booking property, check data.\nif (jsonData.hasOwnProperty(\"appointment\")) {\n\n //Test to see if service id has expected value\n pm.test(\"Validate Service ID has expected value\", function(){\n pm.expect(jsonData.service_id === environment.service_id);\n });\n\n //Test to see if office id has expected value\n pm.test(\"Validate office id has expected value\", function(){\n pm.expect(jsonData.office_id === environment.current_office_id);\n });\n\n //Test to see if start time has expected value\n pm.test(\"Validate start time has expected value\", function(){\n pm.expect(jsonData.start_time === environment.start_time);\n });\n\n //Test to see if end time has expected value\n pm.test(\"Validate end time has expected value\", function(){\n pm.expect(jsonData.end_time === environment.end_time);\n });\n\n //Test to see if category has expected value\n pm.test(\"Validate category has expected value\", function(){\n pm.expect(jsonData.category === environment.category);\n });\n\n //Test to see if citizen name field has expected value\n pm.test(\"Name should be '\" + name_expect + \"', it is '\" + name + \"'\", function(){\n pm.expect(name).to.be.eql(name_expect);\n });\n //Test to see if comments field has expected value\n pm.test(\"Comments should be '\" + comments_expect + \"'; it is '\" + comments +\"'\", function(){\n pm.expect(comments).to.be.eql(comments_expect);\n });\n //Test to see if contact info field has expected value\n pm.test(\"Contact should be '\" + contact_expect + \"'; it is '\" + contact +\"'\", function(){\n pm.expect(contact).to.be.eql(contact_expect);\n });\n};\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Appointment-List-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"appointment_list_schema_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the JSON Schema expected in response\nvar appointmentSchema = {\n \"type\": \"object\", \n \"properties\": {\n \"appointments\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointment_id\": {\"type\": \"number\"},\n \"checked_in_time\": {\"type\": [\"string\", \"null\"]},\n \"citizen_name\": {\"type\": \"string\"},\n \"comments\": {\"type\": [\"null\", \"string\"]},\n \"contact_information\": {\"type\": [\"null\", \"string\"]},\n \"end_time\": {\"type\": \"string\"},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n },\n },\n \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"timezone\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"service_id\": {\"type\": [\"null\", \"number\"]},\n \"start_time\": {\"type\": \"string\"},\n \"blackout_flag\": {\"type\": \"string\"},\n \"citizen_id\": {\"type\": \"number\"},\n \"online_flag\": {\"type\": \"boolean\"},\n \"recurring_uuid\": {\"type\": [\"null\", \"string\"]},\n \"services\": {\n \"type\": \"object\",\n \"properties\": {\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"timeslot_duration\": {\"type\": [\"null\", \"number\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"service_name\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"actual_service_ind\": {\"type\": \"number\"},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]}\n },\n \"required\": [\"deleted\", \"display_dashboard_ind\", \"timeslot_duration\", \"parent\",\n \"service_name\", \"service_code\", \"actual_service_ind\", \"online_link\",\n \"service_desc\", \"service_id\", \"parent_id\", \"prefix\", \"online_availability\",\n \"external_service_name\"]\n },\n },\n \"required\": [\"appointment_id\", \"checked_in_time\", \"citizen_name\", \"comments\",\n \"contact_information\", \"end_time\", \"office\", \"office_id\",\n \"service_id\", \"start_time\", \"blackout_flag\", \"citizen_id\",\n \"online_flag\", \"recurring_uuid\", \"service\"]\n }\n },\n \"errors\": {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"appointments\"],\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Appointment List Schema\", function(){\n pm.expect(tv4.validate(jsonData, appointmentSchema)).to.be.true;\n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "Who am I TheQ", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Make sure the CSR schema is OK.", - "eval(environment.csr_schema_check)", - "", - "//var jsonData = pm.response.json();", - "//pm.environment.set(\"csr_schema_check\", jsonData.data);", - "", - "if (jsonData.hasOwnProperty(\"csr\")) {", - "\tcurrentOfficeId = jsonData.csr.office_id;", - "\tcurrentOfficeNumber = jsonData.csr.office.office_number;", - "\tcurrentCsrId = jsonData.csr.csr_id;", - " postman.setEnvironmentVariable(\"current_office_id\", currentOfficeId);", - " postman.setEnvironmentVariable(\"current_office_number\", currentOfficeNumber);", - " postman.setEnvironmentVariable(\"current_csr_id\", currentCsrId);", - "};", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}csrs/me/", - "host": [ - "{{url}}csrs" - ], - "path": [ - "me", - "" - ] - } - }, - "response": [] - }, - { - "name": "Get Room IDs", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.room_schema_check);", - "", - "if (jsonData.hasOwnProperty(\"rooms\")) {", - " room_id_1 = jsonData.rooms[0].room_id;", - " room_id_2 = room_id_1;", - " if (jsonData.rooms.length > 1) {", - " room_id_2 = jsonData.rooms[1].room_id;", - " }", - " postman.setEnvironmentVariable(\"room_id_1\", JSON.stringify(room_id_1.toString()));", - " postman.setEnvironmentVariable(\"room_id_2\", JSON.stringify(room_id_2.toString()));", - "}", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}rooms/", - "host": [ - "{{url}}rooms" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Get Service IDs", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Run basic tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data, check the schema.", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.service_schema_check);", - "", - "// Loop to validate schema of each channel.", - "var allElements = jsonData.services;", - "var elementCount = 0;", - "var elementMax = Math.min(10, allElements.length);", - "//allElements.forEach(function(element) {", - "for (var currentElement = 0; currentElement < elementMax; currentElement++) {", - " element = allElements[currentElement];", - " elementCount ++;", - " var testTitle = \"Service (\" + elementCount + \"): \" + element.service_name;", - " ", - " // Test the authenticate response.", - " pm.test(\"--> \" + testTitle + \" dashboard_ind must be 0 or 1\", function() {", - " pm.expect(element.display_dashboard_ind).to.be.within(0,1);", - " });", - " pm.test(\"--> \" + testTitle + \" actual_service_ind must be 1\", function() {", - " pm.expect(element.actual_service_ind).to.be.eql(1);", - " });", - " pm.test(\"--> \" + testTitle + \" parent_id must not be null\", function() {", - " pm.expect(element.parent_id).to.not.be.null;", - " });", - "}", - "", - "// Declare and initialize variables.", - "var mspId = 0;", - "var taxId = 0;", - "var mspText = \"Payment - MSP\";", - "var propTaxText = \"Other - Rural PTAX\";", - "", - "// Look for the MSP and Property Tax IDs.", - "allElements.forEach(function(element) {", - " if (element.service_name === mspText) {", - " mspId = element.service_id;", - " }", - " if (element.service_name === propTaxText) {", - " taxId = element.service_id;", - " }", - "});", - "", - "// Check that you found the service IDs.", - "pm.test(\"The \" + mspText + \" service ID (\" + mspId.toString() + \") should not equal 0\", function() {", - " pm.expect(mspId).to.not.be.eql(0);", - "});", - "", - "pm.test(\"The \" + propTaxText + \" service ID (\" + taxId.toString() + \") should not equal 0\", function() {", - " pm.expect(taxId).to.not.be.eql(0);", - "});", - "", - "// Store these IDs for future use.", - "postman.setEnvironmentVariable(\"service_MSP_id\", JSON.stringify(mspId));", - "postman.setEnvironmentVariable(\"service_PropTax_id\", JSON.stringify(taxId));" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}services/", - "host": [ - "{{url}}services" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Check app health", - "item": [ - { - "name": "Check healthz driver Booking", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Set health response time variable.", - "max_response_time = 1500;", - "health_tries = 15;", - "counter = 1;", - "postman.setEnvironmentVariable(\"max_response_time\", JSON.stringify(max_response_time));", - "postman.setEnvironmentVariable(\"health_tries\", JSON.stringify(health_tries));", - "postman.setEnvironmentVariable(\"health_counter\", JSON.stringify(counter));", - "", - "var jsonData = JSON.parse(responseBody);", - "", - "// Test the health response.", - "pm.test(\"Response should have 'message' property\", function() {", - " pm.expect(jsonData).to.have.property('message');", - "});", - "", - "pm.test(\"Response message should be 'api is health'\", function() {", - " pm.expect(jsonData.message).to.be.eql('api is healthy');", - "});", - "", - "// If response time is OK, proceed to the next test.", - "if (pm.response.responseTime < max_response_time) {", - " postman.setNextRequest(\"Check the readyz endpoint Booking\");", - "}", - " ", - "// Response time is too long. Try again, give pod a chance to spin up.", - "else {", - " postman.setNextRequest(\"Check the healthz endpoint Booking\");", - "}" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}healthz/", - "host": [ - "{{url}}healthz" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Check the healthz endpoint Booking", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Get the maximum response time allowed.", - "max_load_time = JSON.parse(globals.max_load_time);", - "", - "// Get and update variables.", - "health_tries = JSON.parse(postman.getEnvironmentVariable(\"health_tries\"));", - "counter = JSON.parse(postman.getEnvironmentVariable(\"health_counter\")) + 1;", - "postman.setEnvironmentVariable(\"health_counter\", JSON.stringify(counter));", - "", - "// Get the response.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Test the health response.", - "pm.test(\"Health Driver: Try \" + counter.toString() + \": Response should have 'message' property\", function() {", - " pm.expect(jsonData).to.have.property('message');", - "});", - "", - "pm.test(\"Response message should be 'api is health'\", function() {", - " pm.expect(jsonData.message).to.be.eql('api is healthy');", - "});", - "", - "// If response time is OK, proceed to the next test.", - "if (pm.response.responseTime < max_load_time) {", - " postman.setNextRequest(\"Check the readyz endpoint Booking\");", - "}", - " ", - "// Response time is too long.", - "else {", - " ", - " // You haven't reached your maximum tries yet. Try again.", - " if (counter < health_tries) {", - " postman.setNextRequest(\"Check the healthz endpoint Booking\");", - " }", - " ", - " // You have reached the maximum. An error, go to next test.", - " else {", - " pm.test(\"Response should be below \" + max_load_time.toString() + ' in ' + health_tries.toString() + ' tries.', function() {", - " pm.expect(counter).to.be.below(health_tries);", - " });", - " postman.setNextRequest(\"Check the readyz endpoint Booking\");", - " }", - "}", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}healthz/", - "host": [ - "{{url}}healthz" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Check the readyz endpoint Booking", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Perform the standard tests.", - "eval(environment.basic_response_test);", - "", - "var jsonData = JSON.parse(responseBody);", - "", - "// Test the health response.", - "pm.test(\"Response should have 'message' property\", function() {", - " pm.expect(jsonData).to.have.property('message');", - "});", - "", - "pm.test(\"Response message should be 'api is ready'\", function() {", - " pm.expect(jsonData.message).to.be.eql('api is ready');", - "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}readyz/", - "host": [ - "{{url}}readyz" - ], - "path": [ - "" - ] - } - }, - "response": [] - } - ], - "description": "Checks the application health by calling the healthz and readyz endpoints" - }, - { - "name": "Get Exam Types", - "item": [ - { - "name": "Exam Type List", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Define the JSON Schema expected in response", - "var examTypeSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"exam_types\": {", - " \"type\": \"array\",", - " \"items\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"exam_color\": {\"type\": \"string\"},", - " \"exam_type_id\": {\"type\": \"number\"},", - " \"exam_type_name\": {\"type\": \"string\"},", - " \"group_exam_ind\": {\"type\": \"number\"},", - " \"ita_ind\": {\"type\": \"number\"},", - " \"method_type\": {\"type\": \"string\"},", - " \"number_of_hours\": {\"type\": \"number\"},", - " \"number_of_minutes\": {\"type\": [\"number\", \"null\"]},", - " \"pesticide_exam_ind\": {\"type\": \"number\"}", - " },", - " \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"group_exam_ind\", \"ita_ind\", \"method_type\",", - " \"number_of_hours\", \"number_of_minutes\", \"pesticide_exam_ind\"]", - " }", - " },", - " \"errors\": {\"type\": [\"object\", \"string\"]}", - " },", - " \"required\": [\"exam_types\", \"errors\"]", - "};", - "", - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "pm.test(\"Exam type response has valid schema\", function(){", - " pm.expect(tv4.validate(jsonData, examTypeSchema)).to.be.true;", - "});", - "", - "// Store all exam type IDs for future use in adding exams", - "var allExamIds = [];", - "", - "// Make sure some data returned.", - "pm.test(\"Response has exam_types property\", function(){", - " pm.expect(jsonData.hasOwnProperty(\"exam_types\")).to.be.true;", - "});", - "pm.test(\"Response has at least one exam_type\", function(){", - " pm.expect(jsonData.exam_types.length).to.be.above(0);", - "});", - "", - "// Set up list of valid exam types, create random functions.", - "eval(environment.init_exam_type_data);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}exam_types/", - "host": [ - "{{url}}exam_types" - ], - "path": [ - "" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Exams", - "item": [ - { - "name": "Exam Post End-point", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Get exam type data and functions.", - "exam_array = JSON.parse(postman.getEnvironmentVariable(\"exam_array_data\"));", - "eval(environment.create_random_functions);", - "", - "// Create an event number based on the time.", - "var ms = (new Date().getTime()).toString() + \"00\";", - "eventNumber = Number(ms.substring(ms.length-6, ms.len)) + 1;", - "postman.setEnvironmentVariable(\"event_number\", eventNumber);", - "", - "// Update the next event ID.", - "var eventId = \"pm\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", 0);", - "postman.setEnvironmentVariable(\"event_id\", JSON.stringify(eventId));", - "postman.setEnvironmentVariable(\"event_delete\", eventId);", - "", - "// Calculate a random exam type to use.", - "random_index = get_random_index(exam_array);", - "", - "// Store for use.", - "random_exam_type_id = exam_array[random_index].id;", - "postman.setEnvironmentVariable(\"random_exam_type_id\", JSON.stringify(random_exam_type_id.toString()));", - "", - "// Store other variables for later use.", - "postman.setEnvironmentVariable(\"exam_method\", JSON.stringify(\"paper\"));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"Postman Group Exam Name\"));", - "postman.setEnvironmentVariable(\"exam_written_ind\", JSON.stringify(\"0\"));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"Postman Examinee Name\"));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"Postman Test Notes\"));", - "postman.setEnvironmentVariable(\"number_of_students\", JSON.stringify(\"19\"));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"Postman test location\"));", - "", - "// Calculate an expiry date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+7);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format expiry date for the exam.", - "expiry_date = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", - "", - "// Store globals.", - "pm.globals.set(\"expiry_date\", JSON.stringify(expiry_date));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Get the max response time allowed.", - "var response_max = JSON.parse(globals.response_max);", - "", - "// Check Response code for request", - "pm.test(\"Response code for request is 201\", function(){", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.exam_schema_check);", - "eval(environment.exam_data_check);", - "", - "// If jsonData has an exam property, save exam ID.", - "if (jsonData.hasOwnProperty(\"exam\")) {", - "\tcurrentExamId = jsonData.exam.exam_id;", - " postman.setEnvironmentVariable(\"current_exam_id\", currentExamId);", - "}", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}", - "type": "text" - }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\n\t\"event_id\" : {{event_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : \"Postman Group Exam Name\",\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : \"Pm examinee name\",\n \"notes\" : \"Pm sample notes\",\n \"number_of_students\" : \"19\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : \"Pm test location\",\n \"expiry_date\": {{expiry_date}}\n}" - }, - "url": { - "raw": "{{url}}exams/", - "host": [ - "{{url}}exams" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Exam Detail End-point", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Get the max response time allowed.", - "var response_max = JSON.parse(globals.response_max);", - "", - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.exam_schema_check);", - "eval(environment.exam_data_check);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Exam List End-point", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.exam_schema_list_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}exams/", - "host": [ - "{{url}}exams" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Exam Put End-point", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = eventNumber;", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId.toString()));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"number_of_students\", JSON.stringify(\"21\"));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Get the max response time allowed.", - "var response_max = JSON.parse(globals.response_max);", - "", - "// Check Response code for request", - "pm.test(\"Response code for request is 201\", function(){", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.exam_schema_check);", - "eval(environment.exam_data_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : {{exam_method}},\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : {{exam_written_ind}},\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}\n" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Exam by ID", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.exam_schema_check);", - "eval(environment.exam_data_check);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Exam by Event", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "// Define the JSON Schema expected in response", - "var examSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"message\": {\"type\": \"boolean\"}", - " },", - " \"required\": [\"message\"]", - "};", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate Response Exam Schema\", function(){", - " pm.expect(tv4.validate(jsonData, examSchema)).to.be.true;", - "});", - "", - "// Make sure the message is true.", - "pm.test(\"Result is '\" + jsonData.message.toString() + \"', it should be 'true'\", function() {", - " pm.expect(jsonData.message).to.be.eql(true);", - "});", - "", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "// Put the event ID in the right format.\r", - "var event_number = JSON.parse(postman.getEnvironmentVariable(\"update_id\"))\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}exams/event_id/{{event_number}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "event_id", - "{{event_number}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Exam Delete End-point", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Get the max response time allowed.", - "var response_max = JSON.parse(globals.response_max);", - "", - "// Check Response code for request", - "pm.test(\"Response code for request is 204\", function(){", - " pm.response.to.have.status(204);", - "});", - "", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "DELETE", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Exams Export", - "item": [ - { - "name": "Exams Export List", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time less than 20,000ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(20000);", - "});" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "// Calculate a start date four weeks prior to today.", - "var start = new Date();", - "start.setDate(start.getDate()-28);", - "", - "// Get year, day, month from the start time.", - "start_year = start.getFullYear().toString();", - "start_month = (\"0\" + (start.getMonth() + 1).toString()).slice(-2);", - "start_day = (\"0\" + (start.getDate()).toString()).slice(-2);", - "start_date = start_year + \"-\" + start_month + \"-\" + start_day;", - "", - "// Get year, day, month from the current day.", - "var today = new Date();", - "end_year = today.getFullYear().toString();", - "end_month = (\"0\" + (today.getMonth() + 1).toString()).slice(-2);", - "end_day = (\"0\" + (today.getDate()).toString()).slice(-2);", - "end_date = end_year + \"-\" + end_month + \"-\" + end_day;", - "", - "console.log(\"Start: \" + start_date);", - "console.log(\"End: \" + end_date);", - "pm.globals.set(\"start_date\", start_date);", - "pm.globals.set(\"end_date\", end_date);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}exams/export/?start_date={{start_date}}&end_date={{end_date}}", - "host": [ - "{{url}}exams" - ], - "path": [ - "export", - "" - ], - "query": [ - { - "key": "start_date", - "value": "{{start_date}}" - }, - { - "key": "end_date", - "value": "{{end_date}}" - } - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Bookings", - "item": [ - { - "name": "Booking Post End-point", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 201\", function(){", - " pm.response.to.have.status(201);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "", - "var booking_id = jsonData.booking.booking_id;", - "", - "//Dynamic variable used for end-point testing later on", - "postman.setEnvironmentVariable(\"booking_id\", JSON.stringify(booking_id));" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+7);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format starting and ending time for the booking.", - "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", - "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", - "", - "// Store globals.", - "pm.globals.set(\"start_time\", JSON.stringify(start_time));", - "pm.globals.set(\"end_time\", JSON.stringify(end_time));", - "pm.globals.set(\"fees\", JSON.stringify(\"false\"));", - "pm.globals.set(\"booking_name\", JSON.stringify(\"Super big demo next week\"));", - "pm.globals.set(\"room_id\", pm.environment.get(\"room_id_1\"));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"room_id\": {{room_id}},\n \"fees\": {{fees}},\n \"booking_name\": {{booking_name}},\n \"office_id\" : {{current_office_id}}\n}\n" - }, - "url": { - "raw": "{{url}}bookings/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Booking Detail End-point", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}bookings/{{booking_id}}/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "{{booking_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Booking List End-point", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_list_schema_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}bookings/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Booking Put End-point", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+7);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format starting and ending time for the booking.", - "start_time = year + \"-\" + month + \"-\" + day + \"T21:00:00Z\";", - "end_time = year + \"-\" + month + \"-\" + day + \"T23:00:00Z\";", - "", - "pm.globals.set(\"start_time\", JSON.stringify(start_time));", - "pm.globals.set(\"end_time\", JSON.stringify(end_time));", - "pm.globals.set(\"fees\", JSON.stringify(\"true\"));", - "pm.globals.set(\"booking_name\", JSON.stringify(\"Time to pay your fees!\"));", - "pm.globals.set(\"room_id\", pm.environment.get(\"room_id_2\"));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"room_id\": {{room_id}},\n \"fees\": {{fees}},\n \"booking_name\": {{booking_name}},\n \"office_id\" : {{current_office_id}}\n}" - }, - "url": { - "raw": "{{url}}bookings/{{booking_id}}/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "{{booking_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Booking Detail End-point Again", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}bookings/{{booking_id}}/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "{{booking_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Booking Delete End-point", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 204\", function(){", - " pm.response.to.have.status(204);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "DELETE", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}bookings/{{booking_id}}/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "{{booking_id}}", - "" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Booking Recurring", - "item": [ - { - "name": "Book first recurring event", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 201\", function(){", - " pm.response.to.have.status(201);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "", - "var booking_id = jsonData.booking.booking_id;", - "", - "//Dynamic variable used for end-point testing later on", - "postman.setEnvironmentVariable(\"booking_id\", JSON.stringify(booking_id));" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+7);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format starting and ending time for the booking.", - "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", - "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", - "", - "// Store globals.", - "pm.globals.set(\"start_time\", JSON.stringify(start_time));", - "pm.globals.set(\"end_time\", JSON.stringify(end_time));", - "pm.globals.set(\"fees\", JSON.stringify(\"false\"));", - "pm.globals.set(\"booking_name\", JSON.stringify(\"Super big demo next week\"));", - "pm.globals.set(\"booking_contact_information\", JSON.stringify(\"Postman Contact\"));", - "pm.globals.set(\"room_id\", pm.environment.get(\"room_id_1\"));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"room_id\": {{room_id}},\n \"fees\": {{fees}},\n \"booking_name\": {{booking_name}},\n \"booking_contact_information\": {{booking_contact_information}},\n \"office_id\" : {{current_office_id}},\n \"recurring_uuid\": {{pm_booking_uuid}}\n}\n" - }, - "url": { - "raw": "{{url}}bookings/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Book second recurring event", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 201\", function(){", - " pm.response.to.have.status(201);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "", - "var booking_id = jsonData.booking.booking_id;", - "", - "//Dynamic variable used for end-point testing later on", - "postman.setEnvironmentVariable(\"second_event_id\", JSON.stringify(booking_id));" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+8);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format starting and ending time for the booking.", - "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", - "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", - "", - "// Store globals.", - "pm.globals.set(\"start_time\", JSON.stringify(start_time));", - "pm.globals.set(\"end_time\", JSON.stringify(end_time));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"room_id\": {{room_id}},\n \"fees\": {{fees}},\n \"booking_name\": {{booking_name}},\n \"booking_contact_information\": {{booking_contact_information}},\n \"office_id\" : {{current_office_id}},\n \"recurring_uuid\": {{pm_booking_uuid}}\n}\n" - }, - "url": { - "raw": "{{url}}bookings/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Book third recurring event", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 201\", function(){", - " pm.response.to.have.status(201);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "", - "var booking_id = jsonData.booking.booking_id;", - "", - "//Dynamic variable used for end-point testing later on", - "postman.setEnvironmentVariable(\"third_event_id\", JSON.stringify(booking_id));" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+9);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format starting and ending time for the booking.", - "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", - "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", - "", - "// Store globals.", - "pm.globals.set(\"start_time\", JSON.stringify(start_time));", - "pm.globals.set(\"end_time\", JSON.stringify(end_time));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"room_id\": {{room_id}},\n \"fees\": {{fees}},\n \"booking_name\": {{booking_name}},\n \"booking_contact_information\": {{booking_contact_information}},\n \"office_id\" : {{current_office_id}},\n \"recurring_uuid\": {{pm_booking_uuid}}\n}\n" - }, - "url": { - "raw": "{{url}}bookings/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Check first booking", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "", - "// Get booking data.", - "var name = jsonData.booking.booking_name;", - "var contact = jsonData.booking.booking_contact_information;", - "var name_expect = JSON.parse(pm.globals.get(\"booking_name\"));", - "var contact_expect = JSON.parse(pm.globals.get(\"booking_contact_information\"));", - "", - "// Make sure data for the first booking hasn't changed.", - "pm.test(\"Name should be '\" + name_expect + \"'; it is '\" + name + \"'\", function () {", - " pm.expect(name).to.be.eql(name_expect);", - "});", - "pm.test(\"Contact should be '\" + contact_expect + \"'; it is '\" + contact + \"'\", function () {", - " pm.expect(contact).to.be.eql(contact_expect);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}bookings/{{booking_id}}/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "{{booking_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Check second booking", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "", - "// Get booking data.", - "var name = jsonData.booking.booking_name;", - "var contact = jsonData.booking.booking_contact_information;", - "var name_expect = JSON.parse(pm.globals.get(\"booking_name\"));", - "var contact_expect = JSON.parse(pm.globals.get(\"booking_contact_information\"));", - "", - "// Make sure data for the first booking hasn't changed.", - "pm.test(\"Name should be '\" + name_expect + \"'; it is '\" + name + \"'\", function () {", - " pm.expect(name).to.be.eql(name_expect);", - "});", - "pm.test(\"Contact should be '\" + contact_expect + \"'; it is '\" + contact + \"'\", function () {", - " pm.expect(contact).to.be.eql(contact_expect);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}bookings/{{second_event_id}}/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "{{second_event_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Check third booking", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "", - "// Get booking data.", - "var name = jsonData.booking.booking_name;", - "var contact = jsonData.booking.booking_contact_information;", - "var name_expect = JSON.parse(pm.globals.get(\"booking_name\"));", - "var contact_expect = JSON.parse(pm.globals.get(\"booking_contact_information\"));", - "", - "// Make sure data for the first booking hasn't changed.", - "pm.test(\"Name should be '\" + name_expect + \"'; it is '\" + name + \"'\", function () {", - " pm.expect(name).to.be.eql(name_expect);", - "});", - "pm.test(\"Contact should be '\" + contact_expect + \"'; it is '\" + contact + \"'\", function () {", - " pm.expect(contact).to.be.eql(contact_expect);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}bookings/{{third_event_id}}/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "{{third_event_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Update second event", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+7);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format starting and ending time for the booking.", - "start_time = year + \"-\" + month + \"-\" + day + \"T21:00:00Z\";", - "end_time = year + \"-\" + month + \"-\" + day + \"T23:00:00Z\";", - "", - "pm.globals.set(\"start_time\", JSON.stringify(start_time));", - "pm.globals.set(\"end_time\", JSON.stringify(end_time));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\n \"booking_name\": \"Second booking event updated\",\n \"booking_contact_information\": \"My_favourite_postman@gmail.com\"\n}" - }, - "url": { - "raw": "{{url}}bookings/{{second_event_id}}/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "{{second_event_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Check first booking again", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "", - "// Get booking data.", - "var name = jsonData.booking.booking_name;", - "var contact = jsonData.booking.booking_contact_information;", - "var name_expect = JSON.parse(pm.globals.get(\"booking_name\"));", - "var contact_expect = JSON.parse(pm.globals.get(\"booking_contact_information\"));", - "", - "// Make sure data for the first booking hasn't changed.", - "pm.test(\"Name should be '\" + name_expect + \"'; it is '\" + name + \"'\", function () {", - " pm.expect(name).to.be.eql(name_expect);", - "});", - "pm.test(\"Contact should be '\" + contact_expect + \"'; it is '\" + contact + \"'\", function () {", - " pm.expect(contact).to.be.eql(contact_expect);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}bookings/{{booking_id}}/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "{{booking_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Check second booking after update", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "", - "// Get booking data.", - "var name = jsonData.booking.booking_name;", - "var contact = jsonData.booking.booking_contact_information;", - "var name_expect = \"Second booking event updated\";", - "var contact_expect = \"My_favourite_postman@gmail.com\";", - "", - "// Make sure data for the first booking hasn't changed.", - "pm.test(\"Name should be '\" + name_expect + \"'; it is '\" + name + \"'\", function () {", - " pm.expect(name).to.be.eql(name_expect);", - "});", - "pm.test(\"Contact should be '\" + contact_expect + \"'; it is '\" + contact + \"'\", function () {", - " pm.expect(contact).to.be.eql(contact_expect);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}bookings/{{second_event_id}}/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "{{second_event_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Check third booking again", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "", - "// Get booking data.", - "var name = jsonData.booking.booking_name;", - "var contact = jsonData.booking.booking_contact_information;", - "var name_expect = JSON.parse(pm.globals.get(\"booking_name\"));", - "var contact_expect = JSON.parse(pm.globals.get(\"booking_contact_information\"));", - "", - "// Make sure data for the first booking hasn't changed.", - "pm.test(\"Name should be '\" + name_expect + \"'; it is '\" + name + \"'\", function () {", - " pm.expect(name).to.be.eql(name_expect);", - "});", - "pm.test(\"Contact should be '\" + contact_expect + \"'; it is '\" + contact + \"'\", function () {", - " pm.expect(contact).to.be.eql(contact_expect);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}bookings/{{third_event_id}}/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "{{third_event_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Update all events", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "// Define the JSON Schema expected in response", - "var examSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"bookings\": {\"type\": \"object\"},", - " \"errors\": {\"type\": [\"object\", \"string\"]}", - " },", - " \"required\": [\"bookings\", \"errors\"]", - "};", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate Update all events schema\", function(){", - " pm.expect(tv4.validate(jsonData, examSchema)).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+7);", - "", - "// Print out the recurring booking ID.", - "console.log(\"Recurring booking uuid:\");", - "console.log(pm.globals.get(\"pm_booking_uuid\"));", - "pm_url_uuid = JSON.parse(pm.globals.get(\"pm_booking_uuid\"))", - "console.log(pm_url_uuid);", - "pm.globals.set(\"pm_url_uuid\", pm_url_uuid);", - " ", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format starting and ending time for the booking.", - "start_time = year + \"-\" + month + \"-\" + day + \"T21:00:00Z\";", - "end_time = year + \"-\" + month + \"-\" + day + \"T23:00:00Z\";", - "", - "pm.globals.set(\"start_time\", JSON.stringify(start_time));", - "pm.globals.set(\"end_time\", JSON.stringify(end_time));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\n \"booking_name\": \"All recurring pm events #2\",\n \"booking_contact_information\": \"My_second_favourite_postman@gmail.com\",\n \"invigilator_id\": []\n}" - }, - "url": { - "raw": "{{url}}bookings/recurring/{{pm_url_uuid}}", - "host": [ - "{{url}}bookings" - ], - "path": [ - "recurring", - "{{pm_url_uuid}}" - ] - } - }, - "response": [] - }, - { - "name": "Check first booking update all", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "", - "// Get booking data.", - "var name = jsonData.booking.booking_name;", - "var contact = jsonData.booking.booking_contact_information;", - "var name_expect = \"All recurring pm events #2\";", - "var contact_expect = \"My_second_favourite_postman@gmail.com\";", - "", - "// Make sure data for the first booking hasn't changed.", - "pm.test(\"Name should be '\" + name_expect + \"'; it is '\" + name + \"'\", function () {", - " pm.expect(name).to.be.eql(name_expect);", - "});", - "pm.test(\"Contact should be '\" + contact_expect + \"'; it is '\" + contact + \"'\", function () {", - " pm.expect(contact).to.be.eql(contact_expect);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}bookings/{{booking_id}}/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "{{booking_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Check second booking update all", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "", - "// Get booking data.", - "var name = jsonData.booking.booking_name;", - "var contact = jsonData.booking.booking_contact_information;", - "var name_expect = \"All recurring pm events #2\";", - "var contact_expect = \"My_second_favourite_postman@gmail.com\";", - "", - "// Make sure data for the first booking hasn't changed.", - "pm.test(\"Name should be '\" + name_expect + \"'; it is '\" + name + \"'\", function () {", - " pm.expect(name).to.be.eql(name_expect);", - "});", - "pm.test(\"Contact should be '\" + contact_expect + \"'; it is '\" + contact + \"'\", function () {", - " pm.expect(contact).to.be.eql(contact_expect);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}bookings/{{second_event_id}}/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "{{second_event_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Check third booking update all", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "", - "// Get booking data.", - "var name = jsonData.booking.booking_name;", - "var contact = jsonData.booking.booking_contact_information;", - "var name_expect = \"All recurring pm events #2\";", - "var contact_expect = \"My_second_favourite_postman@gmail.com\";", - "", - "// Make sure data for the first booking hasn't changed.", - "pm.test(\"Name should be '\" + name_expect + \"'; it is '\" + name + \"'\", function () {", - " pm.expect(name).to.be.eql(name_expect);", - "});", - "pm.test(\"Contact should be '\" + contact_expect + \"'; it is '\" + contact + \"'\", function () {", - " pm.expect(contact).to.be.eql(contact_expect);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}bookings/{{third_event_id}}/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "{{third_event_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Booking Delete End-point", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 204\", function(){", - " pm.response.to.have.status(204);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "DELETE", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}bookings/recurring/{{pm_url_uuid}}", - "host": [ - "{{url}}bookings" - ], - "path": [ - "recurring", - "{{pm_url_uuid}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Invigilators checks", - "item": [ - { - "name": "Invigilators", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.invigilator_schema_check);", - "", - "// Make sure there is at least one invigilator.", - "invigilators = jsonData.invigilators;", - "pm.test(\"Number of invigilators is \" + invigilators.length.toString() + \", must not be 0\", function() {", - " pm.expect(invigilators.length).to.not.be.eql(0);", - "})", - "", - "// Get the first invigilator.", - "first = invigilators[0];", - "", - "// Make sure the invigilator shadow count is 2, and the flag is \"Y\"", - "pm.test(\"Invigilator shadow count is \" + first.shadow_count.toString() + \", must be 2\", function() {", - " pm.expect(first.shadow_count).to.be.eql(2);", - "})", - "pm.test(\"Invigilator shadow flag is \" + first.shadow_flag.toString() + \", must be 'Y'\", function() {", - " pm.expect(first.shadow_flag).to.be.eql(\"Y\");", - "})", - "", - "// Save some values of the first invigilator.", - "invId = first.invigilator_id;", - "count = first.shadow_count;", - "flag = first.shadow_flag;", - "postman.setEnvironmentVariable(\"inv_id\", invId);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}invigilators/", - "host": [ - "{{url}}invigilators" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Invigilators offsite", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body, test the schema.", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.invigilator_schema_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}invigilators/offsite/", - "host": [ - "{{url}}invigilators" - ], - "path": [ - "offsite", - "" - ] - } - }, - "response": [] - }, - { - "name": "Invigilator subtract", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.invig_one_schema_check);", - "", - "first = jsonData.invigilator;", - "", - "// Save some values.", - "newId = first.invigilator_id;", - "newEmail = first.contact_email;", - "newPhone = first.contact_phone;", - "newNotes = first.invigilator_notes;", - "newCount = first.shadow_count;", - "newFlag = first.shadow_flag;", - "", - "// Temporary debugging.", - "console.log(\"==> New invigilator data:\");", - "console.log(\" --> id: \" + newId);", - "console.log(\" --> email: \" + newEmail);", - "console.log(\" --> phone: \" + newPhone);", - "console.log(\" --> notes: \" + newNotes);", - "console.log(\" --> count: \" + newCount);", - "console.log(\" --> flag: \" + newFlag);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "", - "value": "", - "type": "text", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}invigilator/{{inv_id}}/?subtract=True&add=False", - "host": [ - "{{url}}invigilator" - ], - "path": [ - "{{inv_id}}", - "" - ], - "query": [ - { - "key": "subtract", - "value": "True" - }, - { - "key": "add", - "value": "False" - } - ] - } - }, - "response": [] - }, - { - "name": "Invigilator add", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.invig_one_schema_check);", - "", - "first = jsonData.invigilator;", - "", - "// Save some values.", - "newId = first.invigilator_id;", - "newEmail = first.contact_email;", - "newPhone = first.contact_phone;", - "newNotes = first.invigilator_notes;", - "newCount = first.shadow_count;", - "newFlag = first.shadow_flag;", - "", - "// Temporary debugging.", - "console.log(\"==> New invigilator data:\");", - "console.log(\" --> id: \" + newId);", - "console.log(\" --> email: \" + newEmail);", - "console.log(\" --> phone: \" + newPhone);", - "console.log(\" --> notes: \" + newNotes);", - "console.log(\" --> count: \" + newCount);", - "console.log(\" --> flag: \" + newFlag);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "", - "value": "", - "type": "text", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}invigilator/{{inv_id}}/?subtract=False&add=True", - "host": [ - "{{url}}invigilator" - ], - "path": [ - "{{inv_id}}", - "" - ], - "query": [ - { - "key": "subtract", - "value": "False" - }, - { - "key": "add", - "value": "True" - } - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Rooms", - "item": [ - { - "name": "Room List End-point", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.room_schema_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}rooms/", - "host": [ - "{{url}}rooms" - ], - "path": [ - "" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "CSRS", - "item": [ - { - "name": "CSRS Me Get End-point", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.csr_schema_check);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}csrs/me/", - "host": [ - "{{url}}csrs" - ], - "path": [ - "me", - "" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Offices", - "item": [ - { - "name": "Office List End-point", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "eval(environment.all_office_schema_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}offices/", - "host": [ - "{{url}}offices" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Office Available Timeslots", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}offices/{{current_office_id}}/slots/", - "host": [ - "{{url}}offices" - ], - "path": [ - "{{current_office_id}}", - "slots", - "" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Appointments", - "item": [ - { - "name": "Appointment Post End-point", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 201\", function(){", - " pm.response.to.have.status(201);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "eval(environment.appointment_data_check);", - "", - "var appointment_id = jsonData.appointment.appointment_id;", - "", - "//Dynamic variable used for end-point testing later on", - "postman.setEnvironmentVariable(\"appointment_id\", JSON.stringify(appointment_id));" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+7);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format starting and ending time for the booking.", - "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", - "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", - "", - "pm.globals.set(\"start_time\", JSON.stringify(start_time));", - "pm.globals.set(\"end_time\", JSON.stringify(end_time));", - "pm.globals.set(\"category\", JSON.stringify(\"Exam\"));", - "pm.globals.set(\"service_id\", pm.environment.get(\"service_PropTax_id\"));", - "pm.globals.set(\"appt_comments\", JSON.stringify(\"Missed playoffs, needs to talk #1.\"));", - "pm.globals.set(\"appt_citizen_name\", JSON.stringify(\"LeBron James Appointment #1\"));", - "pm.globals.set(\"appt_contact_information\", JSON.stringify(\"My contact info\"));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"service_id\": {{service_id}},\n \"office_id\" : {{current_office_id}},\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"category\": {{category}},\n \"comments\": {{appt_comments}},\n \"citizen_name\": {{appt_citizen_name}},\n \"contact_information\": {{appt_contact_information}}\n}" - }, - "url": { - "raw": "{{url}}appointments/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Appointment Detail End-point", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "eval(environment.appointment_data_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}appointments/{{appointment_id}}/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "{{appointment_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Appointment List End-point", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid\\", - "eval(environment.appointment_list_schema_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}appointments/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Appointment Put End-point", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "eval(environment.appointment_data_check);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+7);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format starting and ending time for the booking.", - "start_time = year + \"-\" + month + \"-\" + day + \"T21:00:00Z\";", - "end_time = year + \"-\" + month + \"-\" + day + \"T23:00:00Z\";", - "", - "pm.globals.set(\"start_time\", JSON.stringify(start_time));", - "pm.globals.set(\"end_time\", JSON.stringify(end_time));", - "pm.globals.set(\"appt_comments\", JSON.stringify(\"super EARLY\"));" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"office_id\" : {{current_office_id}},\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"category\": {{category}},\n \"comments\": {{appt_comments}}\n}" - }, - "url": { - "raw": "{{url}}appointments/{{appointment_id}}/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "{{appointment_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Appointment Delete End-point", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 204\", function(){", - " pm.response.to.have.status(204);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "DELETE", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}appointments/{{appointment_id}}?office_id={{current_office_id}}", - "host": [ - "{{url}}appointments" - ], - "path": [ - "{{appointment_id}}", - "" - ], - "query": [ - { - "key": "office_id", - "value": "{{current_office_id}}" - } - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Appointments Recurring", - "item": [ - { - "name": "Book first appointment", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 201\", function(){", - " pm.response.to.have.status(201);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "eval(environment.appointment_data_check);", - "", - "var appointment_id = jsonData.appointment.appointment_id;", - "", - "//Dynamic variable used for end-point testing later on", - "postman.setEnvironmentVariable(\"appointment_id\", JSON.stringify(appointment_id));" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+7);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format starting and ending time for the booking.", - "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", - "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", - "", - "pm.globals.set(\"start_time\", JSON.stringify(start_time));", - "pm.globals.set(\"end_time\", JSON.stringify(end_time));", - "pm.globals.set(\"category\", JSON.stringify(\"Exam\"));", - "pm.globals.set(\"service_id\", pm.environment.get(\"service_PropTax_id\"));", - "pm.globals.set(\"appt_citizen_name\", JSON.stringify(\"BLACKOUT PERIOD\"));", - "pm.globals.set(\"appt_comments\", JSON.stringify(\"Office needs a break\"));", - "pm.globals.set(\"appt_contact_information\", JSON.stringify(\"Contact info, me@me.com\"));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"blackout_flag\" : \"Y\",\n \"citizen_name\" : {{appt_citizen_name}},\n \"comments\" : {{appt_comments}},\n \"contact_information\" : {{appt_contact_information}},\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"office_id\" : {{current_office_id}},\n \"recurring_uuid\": {{pm_appt_uuid}}\n}" - }, - "url": { - "raw": "{{url}}appointments/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Book second appointment", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 201\", function(){", - " pm.response.to.have.status(201);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "eval(environment.appointment_data_check);", - "", - "var appointment_id = jsonData.appointment.appointment_id;", - "", - "//Dynamic variable used for end-point testing later on", - "postman.setEnvironmentVariable(\"second_appt_id\", JSON.stringify(appointment_id));" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+8);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format starting and ending time for the booking.", - "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", - "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", - "", - "pm.globals.set(\"start_time\", JSON.stringify(start_time));", - "pm.globals.set(\"end_time\", JSON.stringify(end_time));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"blackout_flag\" : \"Y\",\n \"citizen_name\" : {{appt_citizen_name}},\n \"comments\" : {{appt_comments}},\n \"contact_information\" : {{appt_contact_information}},\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"office_id\" : {{current_office_id}},\n \"recurring_uuid\": {{pm_appt_uuid}}\n}" - }, - "url": { - "raw": "{{url}}appointments/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Book third appointment", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 201\", function(){", - " pm.response.to.have.status(201);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "eval(environment.appointment_data_check);", - "", - "var appointment_id = jsonData.appointment.appointment_id;", - "", - "//Dynamic variable used for end-point testing later on", - "postman.setEnvironmentVariable(\"third_appt_id\", JSON.stringify(appointment_id));" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+9);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format starting and ending time for the booking.", - "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", - "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", - "", - "pm.globals.set(\"start_time\", JSON.stringify(start_time));", - "pm.globals.set(\"end_time\", JSON.stringify(end_time));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"blackout_flag\" : \"Y\",\n \"citizen_name\" : {{appt_citizen_name}},\n \"comments\" : {{appt_comments}},\n \"contact_information\" : {{appt_contact_information}},\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"office_id\" : {{current_office_id}},\n \"recurring_uuid\": {{pm_appt_uuid}}\n}" - }, - "url": { - "raw": "{{url}}appointments/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Check first appointment", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "eval(environment.appointment_data_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}appointments/{{appointment_id}}/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "{{appointment_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Check second appointment", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "eval(environment.appointment_data_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}appointments/{{second_appt_id}}/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "{{second_appt_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Check third appointment", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "eval(environment.appointment_data_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}appointments/{{third_appt_id}}/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "{{third_appt_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Update second appointment", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "eval(environment.appointment_data_check);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+7);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format starting and ending time for the booking.", - "start_time = year + \"-\" + month + \"-\" + day + \"T21:00:00Z\";", - "end_time = year + \"-\" + month + \"-\" + day + \"T23:00:00Z\";", - "", - "pm.globals.set(\"start_time\", JSON.stringify(start_time));", - "pm.globals.set(\"end_time\", JSON.stringify(end_time));", - "", - "pm.globals.set(\"appt_citizen_name\", JSON.stringify(\"BLACKOUT UPDATE 2nd\"));", - "pm.globals.set(\"appt_comments\", JSON.stringify(\"Update blackout comments\"));", - "pm.globals.set(\"appt_contact_information\", JSON.stringify(\"Update blackout contact\"));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"citizen_name\" : {{appt_citizen_name}},\n \"comments\" : {{appt_comments}},\n \"contact_information\" : {{appt_contact_information}}\n}" - }, - "url": { - "raw": "{{url}}appointments/{{second_appt_id}}/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "{{second_appt_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Check second appointment again", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "eval(environment.appointment_data_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}appointments/{{second_appt_id}}/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "{{second_appt_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Check first appointment again", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "eval(environment.appointment_data_check);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "// Reset variables back to their first and third appt values.\r", - "pm.globals.set(\"appt_citizen_name\", JSON.stringify(\"BLACKOUT PERIOD\"));\r", - "pm.globals.set(\"appt_comments\", JSON.stringify(\"Office needs a break\"));\r", - "pm.globals.set(\"appt_contact_information\", JSON.stringify(\"Contact info, me@me.com\"));\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}appointments/{{appointment_id}}/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "{{appointment_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Check third appointment again", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "eval(environment.appointment_data_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}appointments/{{third_appt_id}}/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "{{third_appt_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Update all appointments", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "// Define the JSON Schema expected in response", - "var apptAllSchema = {", - " \"type\": \"object\", ", - " \"properties\": {", - " \"appointments\": {\"type\": \"object\"},", - " \"errors\": {\"type\": [\"object\", \"string\"]}", - " },", - " \"required\": [\"appointments\", \"errors\"],", - "};", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate Recurring Appointments Schema\", function(){", - " pm.expect(tv4.validate(jsonData, apptAllSchema)).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+7);", - "", - "// Print out the appointment ID.", - "pm_url_uuid = JSON.parse(pm.globals.get(\"pm_appt_uuid\"))", - "pm.globals.set(\"pm_url_uuid\", pm_url_uuid);", - "", - "pm.globals.set(\"appt_citizen_name\", JSON.stringify(\"BLACKOUT ALL UPDATE\"));", - "pm.globals.set(\"appt_comments\", JSON.stringify(\"All blackout comments\"));", - "pm.globals.set(\"appt_contact_information\", JSON.stringify(\"All Update blackout contacts\"));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"citizen_name\" : {{appt_citizen_name}},\n \"comments\" : {{appt_comments}},\n \"contact_information\" : {{appt_contact_information}}\n}" - }, - "url": { - "raw": "{{url}}appointments/recurring/{{pm_url_uuid}}", - "host": [ - "{{url}}appointments" - ], - "path": [ - "recurring", - "{{pm_url_uuid}}" - ] - } - }, - "response": [] - }, - { - "name": "Check first appointment all", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "eval(environment.appointment_data_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}appointments/{{appointment_id}}/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "{{appointment_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Check second appointment all", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "eval(environment.appointment_data_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}appointments/{{second_appt_id}}/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "{{second_appt_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Check third appointment all", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "eval(environment.appointment_data_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}appointments/{{appointment_id}}/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "{{appointment_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Appointment Delete End-point", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 204\", function(){", - " pm.response.to.have.status(204);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "DELETE", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}appointments/recurring/{{pm_url_uuid}}", - "host": [ - "{{url}}appointments" - ], - "path": [ - "recurring", - "{{pm_url_uuid}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Public User Appointments", - "item": [ - { - "name": "Authenticate and create user", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "var allSchema = {", - " \"type\": \"array\",", - " \"items\": {\"type\": \"object\"}", - "};", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate All Users Schema\", function(){", - " pm.expect(tv4.validate(jsonData, allSchema)).to.be.true;", - "});", - "", - "var firstUser = jsonData[0];", - "console.log(firstUser)", - "", - "var userSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"email\": {\"type\": \"string\"},", - " \"last_name\": {\"type\": \"string\"},", - " \"user_id\": {\"type\": \"number\"},", - " \"username\": {\"type\": \"string\"},", - " \"send_email_reminders\": {\"type\": \"boolean\"},", - " \"send_sms_reminders\": {\"type\": \"boolean\"},", - " \"display_name\": {\"type\": \"string\"},", - " \"telephone\": {\"type\": \"string\"}", - " },", - " \"required\": [\"email\", \"last_name\", \"user_id\", \"username\", \"send_email_reminders\", \"send_sms_reminders\",", - " \"display_name\", \"telephone\"]", - "};", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate First User Schema\", function(){", - " pm.expect(tv4.validate(firstUser, userSchema)).to.be.true;", - "});", - "", - "//Dynamic variables used for end-point testing later on", - "var user_id = firstUser.user_id;", - "var user_phone = firstUser.telephone;", - "postman.setEnvironmentVariable(\"user_id\", JSON.stringify(user_id));", - "postman.setEnvironmentVariable(\"user_phone\", JSON.stringify(user_phone));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{public_user_token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Typea", - "type": "text", - "value": "application/x-www-form-urlencoded" - } - ], - "body": { - "mode": "raw", - "raw": "grant_type=password&client_id={{clientid}}&username={{public_user_id}}&password={{public_user_password}}&client_secret={{client_secret}}" - }, - "url": { - "raw": "{{public_url}}users/", - "host": [ - "{{public_url}}users" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Book an appointment", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 201\", function(){", - " pm.response.to.have.status(201);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "", - "// Update the comments to include phone number, before data test.", - "var comments_old = JSON.parse(pm.globals.get(\"appt_comments\"));", - "var user_phone = JSON.parse(postman.getEnvironmentVariable(\"user_phone\"));", - "var comments_new = comments_old + '. Phone: ' + user_phone;", - "console.log(\"==> Old: \" + comments_old);", - "console.log(\"==> Phone: \" + user_phone);", - "console.log(\"==> New: \" + comments_new);", - "pm.globals.set(\"appt_comments\", JSON.stringify(comments_new));", - "", - "// Now ready for the data check.", - "eval(environment.appointment_data_check);", - "", - "//Dynamic variable used for end-point testing later on", - "var appointment_id = jsonData.appointment.appointment_id;", - "postman.setEnvironmentVariable(\"appointment_id\", JSON.stringify(appointment_id));", - "", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "var day = later.getDay();", - "later.setDate(later.getDate() + 5 + (day === 6 ? 2 : +!day) + (Math.floor((5 - 1 + (day % 6 || 1)) / 5) * 2));", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format starting and ending time for the booking.", - "start_time = year + \"-\" + month + \"-\" + day + \"T23:00:00Z\";", - "end_time = year + \"-\" + month + \"-\" + day + \"T23:30:00Z\";", - "", - "pm.globals.set(\"public_start_time\", JSON.stringify(start_time));", - "pm.globals.set(\"public_end_time\", JSON.stringify(end_time));", - "pm.globals.set(\"category\", JSON.stringify(\"Exam\"));", - "pm.globals.set(\"service_id\", pm.environment.get(\"service_PropTax_id\"));", - "pm.globals.set(\"appt_comments\", JSON.stringify(\"My self serve appt.\"));", - "pm.globals.set(\"appt_citizen_name\", JSON.stringify(\"cfms-postman-public-user\"));", - "pm.globals.set(\"appt_contact_information\", JSON.stringify(\"test@test.com\"));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{public_user_token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"service_id\": {{service_id}},\n \"office_id\" : {{current_office_id}},\n \"start_time\": {{public_start_time}},\n \"end_time\": {{public_end_time}},\n \"category\": {{category}},\n \"comments\": {{appt_comments}},\n \"citizen_name\": {{appt_citizen_name}},\n \"contact_information\": {{appt_contact_information}}\n}" - }, - "url": { - "raw": "{{public_url}}appointments/", - "host": [ - "{{public_url}}appointments" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Edit user profile", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "var allSchema = {", - " \"type\": \"array\",", - " \"items\": {\"type\": \"object\"}", - "};", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate All Users Schema\", function(){", - " pm.expect(tv4.validate(jsonData, allSchema)).to.be.true;", - "});", - "", - "var firstUser = jsonData[0];", - "", - "var userSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"email\": {\"type\": \"string\"},", - " \"last_name\": {\"type\": \"string\"},", - " \"user_id\": {\"type\": \"number\"},", - " \"username\": {\"type\": \"string\"},", - " \"send_email_reminders\": {\"type\": \"boolean\"},", - " \"send_sms_reminders\": {\"type\": \"boolean\"},", - " \"display_name\": {\"type\": \"string\"},", - " \"telephone\": {\"type\": \"string\"}", - " },", - " \"required\": [\"email\", \"last_name\", \"user_id\", \"username\", \"send_email_reminders\", \"send_sms_reminders\",", - " \"display_name\", \"telephone\"]", - "};", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate First User Schema\", function(){", - " pm.expect(tv4.validate(firstUser, userSchema)).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{public_user_token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"email\": \"test@test.com\",\n \"telephone\": \"0000000000\",\n \"send_email_reminders\": true,\n \"send_sms_reminders\": true\n}" - }, - "url": { - "raw": "{{public_url}}users/{{user_id}}/", - "host": [ - "{{public_url}}users" - ], - "path": [ - "{{user_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Get user profile", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "var allSchema = {", - " \"type\": \"array\",", - " \"items\": {\"type\": \"object\"}", - "};", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate All Users Schema\", function(){", - " pm.expect(tv4.validate(jsonData, allSchema)).to.be.true;", - "});", - "", - "var firstUser = jsonData[0];", - "", - "var userSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"email\": {\"type\": \"string\"},", - " \"last_name\": {\"type\": \"string\"},", - " \"user_id\": {\"type\": \"number\"},", - " \"username\": {\"type\": \"string\"},", - " \"send_email_reminders\": {\"type\": \"boolean\"},", - " \"send_sms_reminders\": {\"type\": \"boolean\"},", - " \"display_name\": {\"type\": \"string\"},", - " \"telephone\": {\"type\": \"string\"}", - " },", - " \"required\": [\"email\", \"last_name\", \"user_id\", \"username\", \"send_email_reminders\", \"send_sms_reminders\",", - " \"display_name\", \"telephone\"]", - "};", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate First User Schema\", function(){", - " pm.expect(tv4.validate(firstUser, userSchema)).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{public_user_token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "", - "type": "text", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{public_url}}users/me/", - "host": [ - "{{public_url}}users" - ], - "path": [ - "me", - "" - ] - } - }, - "response": [] - }, - { - "name": "List all appointments", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid\\", - "eval(environment.appointment_list_schema_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{public_user_token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{public_url}}users/appointments/", - "host": [ - "{{public_url}}users" - ], - "path": [ - "appointments", - "" - ] - } - }, - "response": [] - }, - { - "name": "Appointment Delete End-point", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 204\", function(){", - " pm.response.to.have.status(204);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{public_user_token}}", - "type": "string" - } - ] - }, - "method": "DELETE", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{public_url}}appointments/{{appointment_id}}/", - "host": [ - "{{public_url}}appointments" - ], - "path": [ - "{{appointment_id}}", - "" - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "auth_url = globals.auth_url;", - "realm = globals.realm;", - "clientid = globals.clientid;", - "userid = globals.public_user_id;", - "password = globals.public_user_password;", - "client_secret = globals.client_secret;", - "", - "const echoPostRequest = {", - " url: auth_url + '/auth/realms/' + realm + '/protocol/openid-connect/token',", - " method: 'POST',", - " header: 'Content-Type:application/x-www-form-urlencoded',", - " body: {", - " mode: 'raw',", - " raw: 'grant_type=password&client_id=' + clientid ", - " + '&username=' + userid ", - " + '&password=' + password", - " + '&client_secret=' + client_secret", - " }", - "};", - "pm.sendRequest(echoPostRequest, function (err, res) {", - " var jsonData = res.json();", - " if (jsonData.hasOwnProperty('access_token')) {", - " \tpm.globals.set(\"public_user_token\", jsonData.access_token);", - "\t pm.globals.set(\"public_user_refresh_token\", jsonData.refresh_token);", - "\t if (err) {", - "\t console.log(err);", - "\t }", - "\t // console.log(err ? err : res.json());", - "\t} else {", - "\t pm.globals.set(\"public_user_token\", 0);", - "\t pm.globals.set(\"public_user_refresh_token\", 0);", - "\t}", - "});" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - } - ] -} \ No newline at end of file + "info": { + "_postman_id": "614e41a1-da60-4f20-be17-c5fd6b52c6d2", + "name": "API_Test_TheQ_Booking Copy6-9", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "Setup TheQ", + "item": [ + { + "name": "Setup-Variables", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "// See if the use-prefix global has been set. Use default if not.", + "let usePrefix = '';", + "if (pm.globals.get('use-prefix')) {", + " console.log(\"==> use-prefix exists\");", + " usePrefix = pm.globals.get('use-prefix');", + " console.log(\" --> Prefix is: \" + usePrefix);", + " ", + " // Set up all globals, using the correct prefix.", + " pm.globals.set('auth_url', pm.globals.get(usePrefix + 'auth_url'));", + " pm.globals.set('realm', pm.globals.get(usePrefix + 'realm'));", + " pm.globals.set('clientid', pm.globals.get(usePrefix + 'clientid'));", + " pm.globals.set('client_secret', pm.globals.get(usePrefix + 'client_secret'));", + " pm.globals.set('url', pm.globals.get(usePrefix + 'url'));", + "", + " pm.globals.set('public_url', pm.globals.get(usePrefix + 'public_url'));", + " pm.globals.set('public_user_id', pm.globals.get(usePrefix + 'public_user_id'));", + " pm.globals.set('public_user_password', pm.globals.get(usePrefix + 'public_user_password'));", + "}", + "else {", + " console.log(\"==> use-prefix does not exist\");", + " console.log(\" --> No default globals set.\");", + "}", + "", + "// If no maximum load time defined, set a default.", + "if (!pm.globals.get('max_load_time')) {", + " console.log(\"==> max_load_time not present, default set.\");", + " pm.globals.set(\"max_load_time\", JSON.stringify(1503));", + "}", + "", + "// If no maximum response defined, set a default.", + "if (!pm.globals.get('max_response_time')) {", + " console.log(\"==> max_response_time not present, default set.\");", + " pm.globals.set(\"max_response_time\", JSON.stringify(15005));", + "}", + "", + "// Display the values of all globals.", + "console.log(\"\");", + "console.log(\" --> auth_url: \" + pm.globals.get(\"auth_url\"));", + "console.log(\" --> realm: \" + pm.globals.get(\"realm\"));", + "console.log(\" --> clientid: \" + pm.globals.get(\"clientid\"));", + "console.log(\" --> client_secret: \" + pm.globals.get(\"client_secret\"));", + "console.log(\" --> url: \" + pm.globals.get(\"url\"));", + "console.log(\" --> max_load_time: \" + pm.globals.get(\"max_load_time\"));", + "console.log(\" --> max_response_time: \" + pm.globals.get(\"max_response_time\"));", + "console.log(\" --> public_url: \" + pm.globals.get(\"public_url\"));", + "console.log(\" --> public_user_id: \" + pm.globals.get(\"public_user_id\"));", + "console.log(\" --> public_user_password: \" + pm.globals.get(\"public_user_password\"));", + "", + "", + "// Clear run-scoped variables so reruns do not inherit stale state.", + "pm.globals.unset(\"auth_failure_reason\");", + "pm.globals.unset(\"operator_token\");", + "pm.globals.unset(\"operator_refresh_token\");", + "pm.globals.unset(\"nonqtxn_token\");", + "pm.globals.unset(\"nonqtxn_refresh_token\");", + "pm.globals.unset(\"public_user_token\");", + "pm.globals.unset(\"public_user_refresh_token\");", + "pm.globals.unset(\"token\");", + "pm.globals.unset(\"refresh_token\");", + "pm.globals.unset(\"token_expires\");", + "pm.globals.unset(\"refresh_token_expires\");", + "pm.globals.unset(\"expires_in\");", + "pm.globals.unset(\"refresh_expires_in\");", + "pm.environment.unset(\"current_client\");", + "pm.environment.unset(\"first_sr_id\");", + "pm.environment.unset(\"second_sr_id\");", + "pm.environment.unset(\"current_csr_id\");", + "pm.environment.unset(\"current_office_id\");", + "pm.environment.unset(\"current_office_number\");", + "pm.environment.unset(\"counter_id\");", + "pm.environment.unset(\"qtxn_id\");", + "pm.environment.unset(\"channel_telephone_id\");", + "pm.environment.unset(\"channel_email_id\");", + "pm.environment.unset(\"qtxn_id_number\");", + "pm.environment.unset(\"counter_id_number\");", + "pm.environment.unset(\"service_PropTax_id\");", + "pm.environment.unset(\"service_MSP_id\");", + "pm.environment.unset(\"user_id\");", + "pm.environment.unset(\"user_phone\");", + "pm.environment.unset(\"appointment_id\");", + "pm.environment.unset(\"public_office_id\");", + "pm.environment.unset(\"public_office_timezone\");", + "pm.environment.unset(\"public_service_id\");" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Dummy data." + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Basic-Response-Tests", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"basic_response_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Get the maximum response time allowed.\nmax_response_time = JSON.parse(globals.max_response_time);\n\npm.test('Response time less than ' + max_response_time.toString() + 'ms', function(){\n pm.expect(pm.response.responseTime).to.be.below(max_response_time);\n});\n\nvar contentType = pm.response.headers.get(\"content-type\") || \"\";\n\npm.test(\"Response code for request is 200\", function(){\n pm.expect(pm.response.code).to.eql(200);\n});\npm.test(\"Response header should include Content-Type application/json\", function() {\n pm.expect(contentType.toLowerCase()).to.include(\"application/json\");\n});\npm.test(\"Response body should be valid JSON\", function() {\n pm.expect(function () { pm.response.json(); }).to.not.throw();\n});\n\nif (pm.response.code !== 200) {\n console.log(\"Unexpected status for \" + pm.info.requestName + \": \" + pm.response.code);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected HTTP 200 but received \" + pm.response.code);\n}\n\nif (contentType.toLowerCase().indexOf(\"application/json\") === -1) {\n console.log(\"Unexpected content-type for \" + pm.info.requestName + \": \" + contentType);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected application/json response\");\n}\n\ntry {\n pm.response.json();\n} catch (parseErr) {\n console.log(\"Response body was not valid JSON for \" + pm.info.requestName + \".\");\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw parseErr;\n}" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Complex-Response-Tests", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"complex_response_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Get the maximum response time allowed.\nmax_response_time = JSON.parse(globals.max_response_time);\n\npm.test('Response time less than ' + max_response_time.toString() + 'ms', function(){\n pm.expect(pm.response.responseTime).to.be.below(max_response_time);\n});\n\nvar contentType = pm.response.headers.get(\"content-type\") || \"\";\n\npm.test(\"Response code for request is 200\", function(){\n pm.expect(pm.response.code).to.eql(200);\n});\npm.test(\"Response header should include Content-Type application/json\", function() {\n pm.expect(contentType.toLowerCase()).to.include(\"application/json\");\n});\npm.test(\"Response body should be valid JSON\", function() {\n pm.expect(function () { pm.response.json(); }).to.not.throw();\n});\n\nif (pm.response.code !== 200) {\n console.log(\"Unexpected status for \" + pm.info.requestName + \": \" + pm.response.code);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected HTTP 200 but received \" + pm.response.code);\n}\n\nif (contentType.toLowerCase().indexOf(\"application/json\") === -1) {\n console.log(\"Unexpected content-type for \" + pm.info.requestName + \": \" + contentType);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected application/json response\");\n}\n\ntry {\n pm.response.json();\n} catch (parseErr) {\n console.log(\"Response body was not valid JSON for \" + pm.info.requestName + \".\");\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw parseErr;\n}" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Create-Response-Tests", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"create_response_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Get the maximum response time allowed.\nmax_response_time = JSON.parse(globals.max_response_time);\n\npm.test('Response time less than ' + max_response_time.toString() + 'ms', function(){\n pm.expect(pm.response.responseTime).to.be.below(max_response_time);\n});\n\nvar contentType = pm.response.headers.get(\"content-type\") || \"\";\n\npm.test(\"Response status code should be 201 CREATED\", function(){\n pm.expect(pm.response.code).to.eql(201);\n});\npm.test(\"Response header should include Content-Type application/json\", function() {\n pm.expect(contentType.toLowerCase()).to.include(\"application/json\");\n});\npm.test(\"Response body should be valid JSON\", function() {\n pm.expect(function () { pm.response.json(); }).to.not.throw();\n});\n\nif (pm.response.code !== 201) {\n console.log(\"Unexpected status for \" + pm.info.requestName + \": \" + pm.response.code);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected HTTP 201 but received \" + pm.response.code);\n}\n\nif (contentType.toLowerCase().indexOf(\"application/json\") === -1) {\n console.log(\"Unexpected content-type for \" + pm.info.requestName + \": \" + contentType);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected application/json response\");\n}\n\ntry {\n pm.response.json();\n} catch (parseErr) {\n console.log(\"Response body was not valid JSON for \" + pm.info.requestName + \".\");\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw parseErr;\n}" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Citizen-Response-Tests", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"citizen_response_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "var citizenSchema = {\n \"type\" : \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"accurate_time_ind\": {\"type\": \"number\"},\n \"ticket_number\": {\"type\": [\"null\", \"string\"]},\n \"citizen_name\": {\"type\": [\"null\", \"string\"]},\n \"qt_xn_citizen_ind\": {\"type\": \"number\"},\n \"user_id\": {\"type\": [\"null\", \"number\"]},\n \"service_reqs\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"channel\": {\n \"type\": \"object\",\n \"properties\": {\n \"channel_name\": {\"type\": \"string\"}\n },\n \"required\": [\"channel_name\"]\n },\n \"channel_id\": {\"type\": \"number\"},\n \"citizen_id\": {\"type\": \"number\"},\n \"periods\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"csr\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter_id\": {\"type\": \"number\"},\n \"qt_xn_csr_ind\": {\"type\": \"number\"},\n \"username\": {\"type\": \"string\"},\n },\n \"required\": [\"counter_id\", \"qt_xn_csr_ind\", \"username\"]\n },\n \"csr_id\": {\"type\": \"number\"},\n \"period_id\": {\"type\": \"number\"},\n \"ps\": {\n \"type\": \"object\",\n \"properties\": {\n \"ps_name\": {\"type\": \"string\"}\n },\n \"required\": [\"ps_name\"]\n },\n \"ps_id\": {\"type\": \"number\"},\n \"time_end\": {\"type\": [\"null\", \"string\"]},\n \"time_start\": {\"type\": \"string\"}\n },\n \"required\": [\"csr\", \"csr_id\", \"period_id\", \"ps\", \"ps_id\", \"time_end\", \"time_start\"]\n }\n },\n \"quantity\": {\"type\": \"number\"},\n \"service\": {\n \"type\": \"object\",\n \"properties\": {\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"},\n },\n \"required\": [\"external_service_name\", \"online_availability\", \"online_link\", \"parent\", \"parent_id\", \"service_name\"]\n },\n \"service_id\": {\"type\": \"number\"},\n \"sr_id\": {\"type\": \"number\"},\n \"sr_number\": {\"type\": \"number\"},\n \"sr_state\": {\n \"type\": \"object\",\n \"properties\": {\n \"sr_code\": {\"type\": \"string\"}\n },\n \"required\": [\"sr_code\"]\n }\n },\n \"required\": [\"channel\", \"channel_id\", \"citizen_id\", \"periods\", \"quantity\", \"service\", \"service_id\",\n \"sr_id\", \"sr_number\", \"sr_state\"]\n }\n },\n \"user\": {\"type\": [\"null\", \"object\"]},\n \"citizen_id\": {\"type\": \"number\"},\n \"counter_id\": {\"type\": [\"null\", \"number\"]},\n \"counter\": {\"type\": [\"null\", \"number\"]},\n \"start_time\": {\"type\": \"string\"},\n \"citizen_comments\": {\"type\": [\"null\", \"string\"]},\n \"priority\": {\"type\": \"number\"},\n \"cs\": {\n \"type\": \"object\",\n \"properties\": {\n \"cs_state_name\": {\"type\": \"string\"}\n },\n \"required\": [\"cs_state_name\"]\n },\n \"office_id\": {\"type\": \"number\"},\n },\n \"required\": [\"accurate_time_ind\", \"ticket_number\", \"citizen_name\", \"qt_xn_citizen_ind\", \"user_id\",\n \"service_reqs\", \"citizen_id\", \"counter_id\", \"start_time\",\n \"citizen_comments\", \"priority\", \"cs\", \"office_id\"]\n },\n};\n\n// Declare, initialize variables.\nvar allElements = null;\n\nif (jsonData.hasOwnProperty(\"citizens\")) {\n\tallElements = jsonData.citizens;\n};\n\nif (jsonData.hasOwnProperty(\"citizen\")) {\n\tallElements = [];\n\tallElements.push(jsonData.citizen);\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Citizen Schema\", function(){\n pm.expect(tv4.validate(allElements, citizenSchema)).to.be.true;\n});\n\nvar elementCount = 0;\n\n// If there are some citizens, proceed with tests.\nif (allElements !== null) {\n\n // Loop to validate schema of each channel, create list of citizen ids.\n allElements.forEach(function(element) {\n elementCount ++;\n var testTitle = \"Citizen (\" + elementCount + \"): \" + element.citizen_id + \" - \";\n // tests[testTitle + \"conforms to schema\"] = tv4.validate(element, citizenSchema);\n\n //Test to see if response schema is valid\n pm.test(testTitle + \"conforms to schema\", function(){\n pm.expect(tv4.validate(allElements, citizenSchema)).to.be.true;\n });\n\n\n // Test the authenticate response.\n pm.test(testTitle + \"qt_xn_citizen_ind must be 0 or 1\", function() {\n pm.expect(element.qt_xn_citizen_ind).to.be.within(0,1);\n });\n });\n};" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Service-Schema-Tests", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"service_schema_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the schema.\nvar serviceSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"data\": {\n \n \"properties\": {\n \"services\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"timeslot_duration\": {\"type\": [\"null\", \"number\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"service_name\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"actual_service_ind\": {\"type\": \"number\"},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]}\n },\n \"required\": [\"deleted\", \"display_dashboard_ind\", \"timeslot_duration\", \"parent\",\n \"service_name\", \"service_code\", \"actual_service_ind\", \"online_link\",\n \"service_desc\", \"service_id\", \"parent_id\", \"prefix\", \"online_availability\",\n \"external_service_name\"]\n }\n },\n \"errors\": {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"services\", \"errors\"],\n}\n}\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Service Schema\", function(){\n pm.expect(tv4.validate(jsonData, serviceSchema)).to.be.true;\n});\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Service-Request-Tests", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"service_request_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "var schema = {\n \"properties\" : {\n \"channel\" : {\n \"type\" : \"object\",\n \"properties\": {\n \"challen_name\": {\"type\": \"string\"}\n },\n \"required\": [\"channel_name\"]\n },\n \"channel_id\" : {\"type\" : \"number\"},\n \"citizen\" : {\n \"type\" : \"object\",\n \"properties\": {\n \"accurate_time_ind\": {\"type\": \"number\"},\n \"ticket_number\": {\"type\": \"string\"},\n \"citizen_name\": {\"type\": \"string\"},\n \"qt_xn_citizen_ind\": {\"type\": \"number\"},\n \"user_id\": {\"type\": \"null\"},\n \"user\": {\"type\": \"null\"},\n \"citizen_id\": {\"type\": \"number\"},\n \"counter_id\": {\"type\": \"number\"},\n \"counter\": {\"type\": \"number\"},\n \"start_time\": {\"type\": \"string\"},\n \"citizen_comments\": {\"type\": \"string\"},\n \"priority\": {\"type\": \"number\"},\n \"cs\": {\n \"type\": \"object\",\n \"properties\": {\n \"cs_state_name\": {\"type\": \"string\"}\n },\n \"required\": [\"cs_state_name\"]\n },\n \"office_id\": {\"type\": \"number\"},\n },\n \"required\": [\"accurate_time_ind\", \"ticket_number\", \"citizen_name\", \"qt_xn_citizen_ind\",\n \"user_id\", \"citizen_id\", \"counter_id\", \"start_time\",\n \"citizen_comments\", \"priority\", \"cs\", \"office_id\"]\n },\n \"citizen_id\" : {\"type\" : \"number\"},\n \"periods\" : {\n \"type\" : \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"csr\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter_id\": {\"type\": \"number\"},\n \"qt_xn_csr_ind\": {\"type\": \"number\"},\n \"username\": {\"type\": \"string\"},\n },\n \"required\": [\"counter_id\", \"qt_xn_csr_ind\", \"username\"]\n },\n \"csr_id\": {\"type\": \"number\"},\n \"period_id\": {\"type\": \"number\"},\n \"ps\": {\n \"type\": \"object\",\n \"properties\": {\n \"ps_name\": {\"type\": \"string\"}\n },\n \"required\": [\"ps_name\"]\n },\n \"ps_id\": {\"type\": \"number\"},\n \"time_end\": {\"type\": [\"null\", \"string\"]},\n \"time_start\": {\"type\": \"string\"}\n },\n \"required\": [\"csr\", \"csr_id\", \"period_id\", \"ps\", \"ps_id\",\n \"time_end\", \"time_start\"]\n }\n },\n \"quantity\" : {\"type\" : \"number\"},\n \"service\" : {\n \"type\" : \"object\",\n \"properties\": {\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"},\n },\n \"required\": [\"external_service_name\", \"online_availability\", \"online_link\",\n \"parent\", \"parent_id\", \"service_name\"]\n },\n \"service_id\" : {\"type\" : \"number\"},\n \"sr_id\" : {\"type\" : \"number\"},\n \"sr_number\": {\"type\": \"number\"},\n \"sr_state\" : {\n \"type\" : \"object\",\n \"properties\": {\n \"sr_code\": {\"type\": \"string\"}\n },\n \"required\": [\"sr_code\"]\n }\n },\n \"required\" : [\n \t\"sr_id\", \"sr_state\", \"periods\", \"service\", \"citizen\", \"quantity\",\n \t\"service_id\", \"citizen_id\", \"channel\", \"channel_id\"\n ]\n};\n\n// Declare, initialize variables.\nvar allElements = null;\n\nif (jsonData.hasOwnProperty(\"service_requests\")) {\n\tallElements = jsonData.service_requests;\n};\n\nif (jsonData.hasOwnProperty(\"service_request\")) {\n allElements = [];\n\tallElements.push(jsonData.service_request);\n}\n\nvar elementCount = 0;\n\n// If there are some service requests, proceed with tests.\nif (allElements !== null) {\n\n // Loop to validate schema of each service request.\n allElements.forEach(function(element) {\n elementCount ++;\n var testTitle = \"Service Request (\" + elementCount + \"): \" + element.sr_id + \" - \";\n tests[testTitle + \"conforms to schema\"] = tv4.validate(element, schema);\n });\n};" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-One-Service-Request-Tests", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"one_service_request_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "var serviceRequestSchema = {\n \"type\": \"object\",\n \"properties\" : {\n \"service_request\": {\n \"type\": \"object\",\n \"properties\": {\n \"channel\" : {\n \"type\" : \"object\",\n \"properties\": {\n \"channel_name\": {\"type\": \"string\"}\n },\n \"required\": [\"channel_name\"]\n },\n \"channel_id\" : {\"type\" : \"number\"},\n \"citizen\" : {\n \"type\" : \"object\",\n \"properties\": {\n \"cs\": {\n \"type\": \"object\",\n \"properties\": {\n \"cs_state_name\": {\"type\": \"string\"}\n },\n \"required\": [\"cs_state_name\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"priority\": {\"type\": \"number\"},\n \"start_time\": {\"type\": \"string\"},\n \"citizen_id\": {\"type\": \"number\"},\n \"citizen_name\": {\"type\": [\"null\", \"string\"]},\n \"qt_xn_citizen_ind\": {\"type\": \"number\"},\n \"user_id\": {\"type\": [\"null\", \"number\"]},\n \"counter_id\": {\"type\": \"number\"},\n \"counter\": {\"type\": \"number\"},\n \"citizen_comments\": {\"type\": \"string\"},\n \"accurate_time_ind\": {\"type\": \"number\"},\n \"ticket_number\": {\"type\": [\"null\", \"string\"]},\n \"user\": {\"type\": [\"null\", \"object\"]}\n },\n \"required\": [\"cs\", \"office_id\", \"priority\", \"start_time\", \"citizen_id\", \"citizen_name\", \"qt_xn_citizen_ind\",\n \"user_id\", \"counter_id\", \"citizen_comments\", \"accurate_time_ind\", \"ticket_number\"]\n },\n \"citizen_id\" : {\"type\" : \"number\"},\n \"periods\" : {\n \"type\" : \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"csr\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter_id\": {\"type\": \"number\"},\n \"qt_xn_csr_ind\": {\"type\": \"number\"},\n \"username\": {\"type\": \"string\"}\n },\n \"required\": [\"counter_id\", \"qt_xn_csr_ind\", \"username\"]\n },\n \"csr_id\": {\"type\": \"number\"},\n \"period_id\": {\"type\": \"number\"},\n \"ps\": {\n \"type\": \"object\",\n \"properties\": {\n \"ps_name\": {\"type\": \"string\"}\n },\n \"required\": [\"ps_name\"]\n },\n \"ps_id\": {\"type\": \"number\"},\n \"time_end\": {\"type\": [\"null\", \"string\"]},\n \"time_start\": {\"type\": \"string\"}\n },\n \"required\": [\"csr\", \"csr_id\", \"period_id\", \"ps\", \"ps_id\", \"time_end\", \"time_start\"]\n }\n },\n \"quantity\" : {\"type\" : \"number\"},\n \"service\" : {\n \"type\" : \"object\",\n \"properties\": {\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n }\n }\n },\n \"service_id\" : {\"type\" : \"number\"},\n \"sr_id\" : {\"type\" : \"number\"},\n \"sr_number\": {\"type\": \"number\"},\n \"sr_state\" : {\n \"type\" : \"object\",\n \"properties\": {\n \"sr_code\": {\"type\": \"string\"}\n },\n \"required\": [\"sr_code\"]\n },\n },\n \"required\" : [\"channel\", \"channel_id\", \"citizen\", \"citizen_id\", \"periods\",\n \"quantity\", \"service\", \"service_id\", \"sr_id\", \"sr_number\", \"sr_state\"]\n },\n \"errors\": {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"service_request\", \"errors\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Service Request Schema\", function(){\n pm.expect(tv4.validate(jsonData, serviceRequestSchema)).to.be.true;\n});" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Get-Active-Citizens-Tests", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"get_active_citizens_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Declare and initialize variables.\nvar elementCount = 0;\nvar srCount = 0;\nvar isFirstCitizen = true;\n\n\n// Loop to create list of active citizen ids.\nallElements.forEach(function(element) {\n srCount = element.service_reqs.length;\n\n // If citizen active, add to the list.\n if (element.cs.cs_state_name === \"Active\") {\n //console.log(\"Citizen (\" + elementCount + \") \" + element.citizen_id +\n // \" Active: SRCount = \" + srCount);\n citizenIds.push(element.citizen_id);\n\n // Save the first citizen.\n if (isFirstCitizen) {\n currentCitizen = element;\n isFirstCitizen = false;\n }\n }\n \n // Increment count.\n elementCount++;\n});" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-CSR-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"csr_schema_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the JSON Schema expected in response\nvar csrSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"csr\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter\": {\"type\": \"number\"},\n \"counter_id\": {\"type\": \"number\"},\n \"csr_id\": {\"type\": \"number\"},\n \"csr_state\": {\n \"type\": \"object\",\n \"properties\": {\n \"csr_state_desc\": {\"type\": \"string\"},\n \"csr_state_id\": {\"type\": \"number\"},\n \"csr_state_name\": {\"type\": \"string\"}\n },\n \"required\": [\"csr_state_desc\", \"csr_state_id\", \"csr_state_name\"]\n },\n \"csr_state_id\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"finance_designate\": {\"type\": \"number\"},\n \"ita2_designate\": {\"type\": \"number\"},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointment_duration\": {\"type\": [\"null\", \"number\"]},\n \"appointments_days_limit\": {\"type\": [\"null\", \"number\"]},\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"back_office_list\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"actual_service_ind\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\",\n \"external_service_name\", \"online_availability\",\n \"online_link\", \"parent\", \"parent_id\", \"prefix\",\n \"service_code\", \"service_desc\", \"service_id\",\n \"service_name\"]\n },\n },\n \"civic_address\": {\"type\": [\"null\", \"string\"]},\n \"counters\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter_id\": {\"type\": \"number\"},\n \"counter_name\": {\"type\": \"string\"}\n },\n \"required\": [\"counter_id\", \"counter_name\"]\n },\n },\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"latitude\": {\"type\": \"number\"},\n \"longitude\": {\"type\": \"number\"},\n \"max_person_appointment_per_day\": {\"type\": [\"null\", \"number\"]},\n \"office_appointment_message\": {\"type\": [\"null\", \"string\"]},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"online_status\": {\"type\": \"string\"},\n \"quick_list\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"actual_service_ind\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\",\n \"external_service_name\", \"online_availability\",\n \"online_link\", \"parent\", \"parent_id\", \"prefix\",\n \"service_code\", \"service_desc\", \"service_id\",\n \"service_name\"]\n },\n },\n \"sb\": {\n \"type\": \"object\",\n \"properties\": {\n \"sb_id\": {\"type\": \"number\"},\n \"sb_type\": {\"type\": \"string\"}\n },\n \"required\": [\"sb_id\", \"sb_type\"]\n },\n \"sb_id\": {\"type\": \"number\"},\n \"telephone\": {\"type\": [\"null\", \"string\"]},\n \"timeslots\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"day_of_week\": {\"type\": [\"null\", \"array\"]},\n \"end_time\": {\"type\": \"string\"},\n \"no_of_slots\": {\"type\": \"number\"},\n \"office\": {\"type\": [\"null\", \"number\"]},\n \"start_time\": {\"type\": \"string\"}\n },\n \"required\": [\"day_of_week\", \"end_time\", \"no_of_slots\",\n \"office\", \"start_time\"]\n },\n },\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n }\n },\n \"required\": [\"appointment_duration\", \"appointments_days_limit\",\n \"appointments_enabled_ind\", \"back_office_list\", \"civic_address\",\n \"counters\", \"exams_enabled_ind\", \"latitude\",\n \"longitude\", \"max_person_appointment_per_day\",\n \"office_appointment_message\", \"office_id\", \"office_name\",\n \"office_number\", \"online_status\", \"quick_list\", \"sb\", \"sb_id\",\n \"telephone\", \"timeslots\", \"timezone\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"office_manager\": {\"type\": \"number\"},\n \"pesticide_designate\": {\"type\": \"number\"},\n \"qt_xn_csr_ind\": {\"type\": \"number\"},\n \"receptionist_ind\": {\"type\": \"number\"},\n \"role\": {\n \"type\": \"object\",\n \"properties\": {\n \"role_code\": {\"type\": \"string\"},\n \"role_desc\": {\"type\": \"string\"},\n \"role_id\": {\"type\": \"number\"}\n },\n \"required\": [\"role_code\", \"role_desc\", \"role_id\"]\n },\n \"role_id\": {\"type\": \"number\"},\n \"username\": {\"type\": \"string\"}\n },\n \"required\": [\"counter\", \"counter_id\", \"csr_id\", \"csr_state\",\n \"csr_state_id\", \"deleted\", \"finance_designate\",\n \"ita2_designate\", \"office_id\", \"office_manager\",\n \"pesticide_designate\", \"qt_xn_csr_ind\", \"receptionist_ind\",\n \"role\", \"role_id\", \"username\"]\n },\n \"attention_needed\": {\"type\": \"boolean\"},\n \"active_citizens\": {\"type\": \"array\"},\n \"back_office_display\": {\"type\": \"string\"},\n \"recurring_feature_flag\": {\"type\": \"string\"},\n \"errors\": {}\n },\n \"required\": [\"csr\", \"attention_needed\", \"active_citizens\",\n \"back_office_display\", \"recurring_feature_flag\", \"errors\"],\n};\n\n//Test to see if response schema is valid" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-One-CSR-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"onecsr_schema_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the JSON Schema expected in response\nvar csrSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"csr\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter\": {\"type\": \"number\"},\n \"counter_id\": {\"type\": \"number\"},\n \"csr_id\": {\"type\": \"number\"},\n \"csr_state\": {\n \"type\": \"object\",\n \"properties\": {\n \"csr_state_desc\": {\"type\": \"string\"},\n \"csr_state_id\": {\"type\": \"number\"},\n \"csr_state_name\": {\"type\": \"string\"}\n },\n \"required\": [\"csr_state_desc\", \"csr_state_id\", \"csr_state_name\"]\n },\n \"csr_state_id\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"finance_designate\": {\"type\": \"number\"},\n \"ita2_designate\": {\"type\": \"number\"},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointment_duration\": {\"type\": [\"null\", \"number\"]},\n \"appointments_days_limit\": {\"type\": [\"null\", \"number\"]},\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"back_office_list\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"actual_service_ind\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\",\n \"external_service_name\", \"online_availability\",\n \"online_link\", \"parent\", \"parent_id\", \"prefix\",\n \"service_code\", \"service_desc\", \"service_id\",\n \"service_name\"]\n },\n },\n \"civic_address\": {\"type\": [\"null\", \"string\"]},\n \"counters\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter_id\": {\"type\": \"number\"},\n \"counter_name\": {\"type\": \"string\"}\n },\n \"required\": [\"counter_id\", \"counter_name\"]\n },\n },\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"latitude\": {\"type\": \"number\"},\n \"longitude\": {\"type\": \"number\"},\n \"max_person_appointment_per_day\": {\"type\": [\"null\", \"number\"]},\n \"office_appointment_message\": {\"type\": [\"null\", \"string\"]},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"online_status\": {\"type\": \"string\"},\n \"quick_list\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"actual_service_ind\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\",\n \"external_service_name\", \"online_availability\",\n \"online_link\", \"parent\", \"parent_id\", \"prefix\",\n \"service_code\", \"service_desc\", \"service_id\",\n \"service_name\"]\n },\n },\n \"sb\": {\n \"type\": \"object\",\n \"properties\": {\n \"sb_id\": {\"type\": \"number\"},\n \"sb_type\": {\"type\": \"string\"}\n },\n \"required\": [\"sb_id\", \"sb_type\"]\n },\n \"sb_id\": {\"type\": \"number\"},\n \"telephone\": {\"type\": [\"null\", \"string\"]},\n \"timeslots\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"day_of_week\": {\"type\": [\"null\", \"array\"]},\n \"end_time\": {\"type\": \"string\"},\n \"no_of_slots\": {\"type\": \"number\"},\n \"office\": {\"type\": [\"null\", \"number\"]},\n \"start_time\": {\"type\": \"string\"}\n },\n \"required\": [\"day_of_week\", \"end_time\", \"no_of_slots\",\n \"office\", \"start_time\"]\n },\n },\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n }\n },\n \"required\": [\"appointment_duration\", \"appointments_days_limit\",\n \"appointments_enabled_ind\", \"back_office_list\", \"civic_address\",\n \"counters\", \"exams_enabled_ind\", \"latitude\",\n \"longitude\", \"max_person_appointment_per_day\",\n \"office_appointment_message\", \"office_id\", \"office_name\",\n \"office_number\", \"online_status\", \"quick_list\", \"sb\", \"sb_id\",\n \"telephone\", \"timeslots\", \"timezone\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"office_manager\": {\"type\": \"number\"},\n \"pesticide_designate\": {\"type\": \"number\"},\n \"qt_xn_csr_ind\": {\"type\": \"number\"},\n \"receptionist_ind\": {\"type\": \"number\"},\n \"role\": {\n \"type\": \"object\",\n \"properties\": {\n \"role_code\": {\"type\": \"string\"},\n \"role_desc\": {\"type\": \"string\"},\n \"role_id\": {\"type\": \"number\"}\n },\n \"required\": [\"role_code\", \"role_desc\", \"role_id\"]\n },\n \"role_id\": {\"type\": \"number\"},\n \"username\": {\"type\": \"string\"}\n },\n \"required\": [\"counter\", \"counter_id\", \"csr_id\", \"csr_state\",\n \"csr_state_id\", \"deleted\", \"finance_designate\",\n \"ita2_designate\", \"office_id\", \"office_manager\",\n \"pesticide_designate\", \"qt_xn_csr_ind\", \"receptionist_ind\",\n \"role\", \"role_id\", \"username\"]\n },\n \"errors\" : {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"csr\", \"errors\"]\n};\n\n//Test to see if response schema is valid" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Many-CSRs-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"manycsrs_schema_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the JSON Schema expected in response\nvar manyCsrsSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"csrs\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter\": {\"type\": \"number\"},\n \"counter_id\": {\"type\": \"number\"},\n \"csr_id\": {\"type\": \"number\"},\n \"csr_state\": {\n \"type\": \"object\",\n \"properties\": {\n \"csr_state_desc\": {\"type\": \"string\"},\n \"csr_state_id\": {\"type\": \"number\"},\n \"csr_state_name\": {\"type\": \"string\"}\n },\n \"required\": [\"csr_state_desc\", \"csr_state_id\", \"csr_state_name\"]\n },\n \"csr_state_id\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"finance_designate\": {\"type\": \"number\"},\n \"ita2_designate\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_manager\": {\"type\": \"number\"},\n \"pesticide_designate\": {\"type\": \"number\"},\n \"qt_xn_csr_ind\": {\"type\": \"number\"},\n \"receptionist_ind\": {\"type\": \"number\"},\n \"role\": {\n \"type\": \"object\",\n \"properties\": {\n \"role_code\": {\"type\": \"string\"},\n \"role_desc\": {\"type\": \"string\"},\n \"role_id\": {\"type\": \"number\"}\n },\n \"required\": [\"role_code\", \"role_desc\", \"role_id\"]\n },\n \"role_id\": {\"type\": \"number\"},\n \"username\": {\"type\": \"string\"}\n },\n \"required\": [\"counter\", \"counter_id\", \"csr_id\", \"csr_state\",\n \"csr_state_id\", \"deleted\", \"finance_designate\",\n \"ita2_designate\", \"office_id\", \"office_manager\",\n \"pesticide_designate\", \"qt_xn_csr_ind\", \"receptionist_ind\",\n \"role\", \"role_id\", \"username\"]\n }\n }\n }\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate many CSRs Schema\", function(){\n pm.expect(tv4.validate(jsonData, manyCsrsSchema)).to.be.true;\n});\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Office-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"office_schema_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the JSON Schema expected in response\nvar officeSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"appointment_duration\": {\"type\": [\"null\", \"number\"]},\n \"appointments_days_limit\": {\"type\": [\"null\", \"number\"]},\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"back_office_list\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"actual_service_ind\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\",\n \"external_service_name\", \"online_availability\",\n \"online_link\", \"parent\", \"parent_id\", \"prefix\",\n \"service_code\", \"service_desc\", \"service_id\",\n \"service_name\"]\n },\n },\n \"civic_address\": {\"type\": [\"null\", \"string\"]},\n \"counters\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter_id\": {\"type\": \"number\"},\n \"counter_name\": {\"type\": \"string\"}\n },\n \"required\": [\"counter_id\", \"counter_name\"]\n },\n },\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"latitude\": {\"type\": \"number\"},\n \"longitude\": {\"type\": \"number\"},\n \"max_person_appointment_per_day\": {\"type\": [\"null\", \"number\"]},\n \"office_appointment_message\": {\"type\": [\"null\", \"string\"]},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"online_status\": {\"type\": \"string\"},\n \"quick_list\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"actual_service_ind\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\",\n \"external_service_name\", \"online_availability\",\n \"online_link\", \"parent\", \"parent_id\", \"prefix\",\n \"service_code\", \"service_desc\", \"service_id\",\n \"service_name\"]\n },\n },\n \"sb\": {\n \"type\": \"object\",\n \"properties\": {\n \"sb_id\": {\"type\": \"number\"},\n \"sb_type\": {\"type\": \"string\"}\n },\n \"required\": [\"sb_id\", \"sb_type\"]\n },\n \"sb_id\": {\"type\": \"number\"},\n \"telephone\": {\"type\": [\"null\", \"string\"]},\n \"timeslots\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"day_of_week\": {\"type\": [\"null\", \"array\"]},\n \"end_time\": {\"type\": \"string\"},\n \"no_of_slots\": {\"type\": \"number\"},\n \"office\": {\"type\": [\"null\", \"number\"]},\n \"start_time\": {\"type\": \"string\"}\n },\n \"required\": [\"day_of_week\", \"end_time\", \"no_of_slots\",\n \"office\", \"start_time\"]\n },\n },\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n }\n },\n \"required\": [\"appointment_duration\", \"appointments_days_limit\",\n \"appointments_enabled_ind\", \"back_office_list\", \"civic_address\",\n \"counters\", \"exams_enabled_ind\", \"latitude\",\n \"longitude\", \"max_person_appointment_per_day\",\n \"office_appointment_message\", \"office_id\", \"office_name\",\n \"office_number\", \"online_status\", \"quick_list\", \"sb\", \"sb_id\",\n \"telephone\", \"timeslots\", \"timezone\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate the Office Schema\", function(){\n pm.expect(tv4.validate(jsonData, officeSchema)).to.be.true;\n});\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-All-Offices-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"all_office_schema_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the JSON Schema expected in response\nvar allOfficeSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"offices\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"max_person_appointment_per_day\": {\"type\": \"number\"},\n \"telephone\": {\"type\": [\"null\", \"string\"]},\n \"appointment_days_limit\": {\"type\": \"number\"},\n \"online_status:\": {\"type\": \"string\"},\n \"sb_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n },\n \"office_number\": {\"type\": \"number\"},\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"sb\": {\n \"type\": \"object\",\n \"properties\": {\n \"sb_id\": {\"type\": \"number\"},\n \"sb_type\": {\"type\": \"string\"}\n },\n \"required\": [\"sb_id\", \"sb_type\"]\n },\n \"civic_address\": {\"type\": [\"null\", \"string\"]},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_appointment_message\": {\"type\": [\"null\", \"string\"]},\n \"latitude\": {\"type\": [\"null\", \"number\"]},\n \"counters\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter_id\": {\"type\": \"number\"},\n \"counter_name\": {\"type\": \"string\"}\n },\n \"required\": [\"counter_id\", \"counter_name\"]\n }\n },\n \"back_office_list\": {\"type\": \"array\"},\n \"longitude\": {\"type\": [\"null\", \"number\"]},\n \"appointment_duration\": {\"type\": \"number\"},\n \"quick_list\": {\"type\": \"array\"},\n \"timeslots\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"day_of_week\": {\"type\": \"array\"},\n \"end_time\": {\"type\": \"string\"},\n \"no_of_slots\": {\"type\": \"number\"},\n \"office\": {\"type\": \"number\"},\n \"start_time\": {\"type\": \"string\"}\n },\n \"required\": [\"day_of_week\", \"end_time\", \"no_of_slots\", \"office\", \"start_time\"]\n }\n }\n },\n }\n },\n \"errors\": {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"offices\", \"errors\"]\n};" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Video-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"video_schema_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the JSON Schema expected in response\nvar videoSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"videofiles\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\"type\": \"string\"},\n \"date\": {\"type\": \"string\"},\n \"size\": {\"type\": \"string\"}\n },\n \"required\": [\"name\", \"date\", \"size\"]\n }\n },\n \"manifest\": {\"type\": \"string\"},\n \"errors\": {\"type\": \"string\"},\n \"code\": {\"type\": \"number\"},\n \"space\": {\n \"type\": \"object\",\n \"properties\": {\n \"total\": {\"type\": \"number\"},\n \"used\": {\"type\": \"number\"},\n \"freespace\": {\"type\": \"number\"}\n },\n \"required\": [\"total\", \"used\", \"freespace\"]\n }\n },\n \"required\": [\"videofiles\", \"manifest\", \"errors\", \"code\", \"space\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate the Videofiles Schema\", function(){\n pm.expect(tv4.validate(jsonData, videoSchema)).to.be.true;\n});\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + } + ], + "description": "This folder performs basic authentication features." + }, + { + "name": "Check app health", + "item": [ + { + "name": "Check healthz driver TheQ", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Get the maximum response time allowed.", + "max_load_time = JSON.parse(globals.max_load_time);", + "", + "// Set health response time variable.", + "health_tries = 15;", + "counter = 1;", + "postman.setEnvironmentVariable(\"health_tries\", JSON.stringify(health_tries));", + "postman.setEnvironmentVariable(\"health_counter\", JSON.stringify(counter));", + "", + "// Get the response.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Test the health response.", + "pm.test(\"Health Driver: Try \" + counter.toString() + \": Response should have 'message' property\", function() {", + " pm.expect(jsonData).to.have.property('message');", + "});", + "", + "pm.test(\"Response message should be 'api is healthy'\", function() {", + " pm.expect(jsonData.message).to.be.eql('api is healthy');", + "});", + "", + "// If response time is OK, proceed to the next test.", + "if (pm.response.responseTime < max_load_time) {", + " postman.setNextRequest(\"Check the readyz endpoint TheQ\");", + "}", + " ", + "// Response time is too long. Try again, give pod a chance to spin up.", + "else {", + " postman.setNextRequest(\"Check the healthz endpoint TheQ\");", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}healthz/", + "host": [ + "{{url}}healthz" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Check the healthz endpoint TheQ", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Get the maximum load time allowed.", + "max_load_time = JSON.parse(postman.getEnvironmentVariable(\"max_load_time\"));", + "", + "// Get and update variables.", + "health_tries = JSON.parse(postman.getEnvironmentVariable(\"health_tries\"));", + "counter = JSON.parse(postman.getEnvironmentVariable(\"health_counter\")) + 1;", + "postman.setEnvironmentVariable(\"health_counter\", JSON.stringify(counter));", + "", + "// Get the response.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Test the health response.", + "pm.test(\"Health Driver: Try \" + counter.toString() + \": Response should have 'message' property\", function() {", + " pm.expect(jsonData).to.have.property('message');", + "});", + "", + "pm.test(\"Response message should be 'api is healthy'\", function() {", + " pm.expect(jsonData.message).to.be.eql('api is healthy');", + "});", + "", + "// If response time is OK, proceed to the next test.", + "if (pm.response.responseTime < max_load_time) {", + " postman.setNextRequest(\"Check the readyz endpoint TheQ\");", + "}", + " ", + "// Response time is too long.", + "else {", + " ", + " // You haven't reached your maximum tries yet. Try again.", + " if (counter < health_tries) {", + " postman.setNextRequest(\"Check the healthz endpoint\");", + " }", + " ", + " // You have reached the maximum. An error, go to next test.", + " else {", + " pm.test(\"Response should be below \" + max_load_time.toString() + ' in ' + health_tries.toString() + ' tries.', function() {", + " pm.expect(counter).to.be.below(health_tries);", + " });", + " postman.setNextRequest(\"Check the readyz endpoint TheQ\");", + " }", + "}", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}healthz/", + "host": [ + "{{url}}healthz" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Check the readyz endpoint TheQ", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Perform the standard tests.", + "eval(environment.basic_response_test);", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "// Test the health response.", + "pm.test(\"Response should have 'message' property\", function() {", + " pm.expect(jsonData).to.have.property('message');", + "});", + "", + "pm.test(\"Response message should be 'api is ready'\", function() {", + " pm.expect(jsonData.message).to.be.eql('api is ready');", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}readyz/", + "host": [ + "{{url}}readyz" + ], + "path": [ + "" + ] + } + }, + "response": [] + } + ], + "description": "Checks the application health by calling the healthz and readyz endpoints" + }, + { + "name": "Check user login", + "item": [ + { + "name": "Authenticate default QTxn user", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"auth_url\",\"realm\",\"clientid\",\"userid\",\"password\",\"client_secret\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Parse response body", + "var jsonData = {};", + "try {", + " jsonData = JSON.parse(responseBody);", + "} catch (parseErr) {", + " console.log(\"Authentication response body was not JSON.\");", + " console.log(responseBody);", + " pm.globals.set(\"auth_failure_reason\", \"Non-JSON auth response\");", + " pm.execution.setNextRequest(null);", + " throw parseErr;", + "}", + "", + "var authFailureReason = jsonData.error_description || jsonData.error || (\"HTTP \" + pm.response.code);", + "if (pm.response.code !== 200 || !jsonData.access_token) {", + " console.log(\"Authentication failed for \" + pm.info.requestName + \".\");", + " console.log(responseBody);", + " pm.globals.set(\"auth_failure_reason\", authFailureReason);", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Authentication failed: \" + authFailureReason);", + "}", + "", + "pm.test(\"Response code for request is 200\", function(){", + " pm.expect(pm.response.code).to.eql(200);", + "});", + "pm.test(\"Access token exists\", function(){", + " pm.expect(jsonData).to.have.property(\"access_token\");", + " pm.expect(jsonData.access_token).to.be.a(\"string\").and.not.empty;", + "});", + "pm.test(\"Refresh token exists\", function(){", + " pm.expect(jsonData).to.have.property(\"refresh_token\");", + " pm.expect(jsonData.refresh_token).to.be.a(\"string\").and.not.empty;", + "});", + "pm.test(\"Expires In is present\", function(){", + " pm.expect(jsonData).to.have.property(\"expires_in\");", + " pm.expect(jsonData.expires_in).to.not.eql(null);", + "});", + "pm.test(\"Refresh Expires In is present\", function(){", + " pm.expect(jsonData).to.have.property(\"refresh_expires_in\");", + " pm.expect(jsonData.refresh_expires_in).to.not.eql(null);", + "});", + "", + "pm.globals.unset(\"auth_failure_reason\");", + "pm.globals.set(\"operator_token\", jsonData.access_token);", + "pm.globals.set(\"operator_refresh_token\", jsonData.refresh_token);", + "pm.globals.set(\"token_expires\", Date.now() + (jsonData.expires_in * 1000));", + "pm.globals.set(\"refresh_token_expires\", Date.now() + (jsonData.refresh_expires_in * 1000));", + "pm.globals.set(\"expires_in\", jsonData.expires_in);", + "pm.globals.set(\"refresh_expires_in\", jsonData.refresh_expires_in);", + "pm.globals.set(\"token\", jsonData.access_token);", + "pm.globals.set(\"refresh_token\", jsonData.refresh_token);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/x-www-form-urlencoded" + } + ], + "body": { + "mode": "raw", + "raw": "grant_type=password&client_id={{clientid}}&username={{userid}}&password={{password}}&client_secret={{client_secret}}" + }, + "url": { + "raw": "{{auth_url}}/auth/realms/{{realm}}/protocol/openid-connect/token?Content-Type=application/x-www-form-urlencoded", + "host": [ + "{{auth_url}}" + ], + "path": [ + "auth", + "realms", + "{{realm}}", + "protocol", + "openid-connect", + "token" + ], + "query": [ + { + "key": "Content-Type", + "value": "application/x-www-form-urlencoded" + } + ] + }, + "description": "Make sure the operator ID can log in" + }, + "response": [] + }, + { + "name": "Authenticate non-QTxn user", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"auth_url\",\"realm\",\"clientid\",\"userid_nonqtxn\",\"password_nonqtxn\",\"client_secret\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Parse response body", + "var jsonData = {};", + "try {", + " jsonData = JSON.parse(responseBody);", + "} catch (parseErr) {", + " console.log(\"Authentication response body was not JSON.\");", + " console.log(responseBody);", + " pm.globals.set(\"auth_failure_reason\", \"Non-JSON auth response\");", + " pm.execution.setNextRequest(null);", + " throw parseErr;", + "}", + "", + "var authFailureReason = jsonData.error_description || jsonData.error || (\"HTTP \" + pm.response.code);", + "if (pm.response.code !== 200 || !jsonData.access_token) {", + " console.log(\"Authentication failed for \" + pm.info.requestName + \".\");", + " console.log(responseBody);", + " pm.globals.set(\"auth_failure_reason\", authFailureReason);", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Authentication failed: \" + authFailureReason);", + "}", + "", + "pm.test(\"Response code for request is 200\", function(){", + " pm.expect(pm.response.code).to.eql(200);", + "});", + "pm.test(\"Access token exists\", function(){", + " pm.expect(jsonData).to.have.property(\"access_token\");", + " pm.expect(jsonData.access_token).to.be.a(\"string\").and.not.empty;", + "});", + "pm.test(\"Refresh token exists\", function(){", + " pm.expect(jsonData).to.have.property(\"refresh_token\");", + " pm.expect(jsonData.refresh_token).to.be.a(\"string\").and.not.empty;", + "});", + "pm.test(\"Expires In is present\", function(){", + " pm.expect(jsonData).to.have.property(\"expires_in\");", + " pm.expect(jsonData.expires_in).to.not.eql(null);", + "});", + "pm.test(\"Refresh Expires In is present\", function(){", + " pm.expect(jsonData).to.have.property(\"refresh_expires_in\");", + " pm.expect(jsonData.refresh_expires_in).to.not.eql(null);", + "});", + "", + "pm.globals.unset(\"auth_failure_reason\");", + "pm.globals.set(\"nonqtxn_token\", jsonData.access_token);", + "pm.globals.set(\"nonqtxn_refresh_token\", jsonData.refresh_token);", + "pm.globals.set(\"token_expires\", Date.now() + (jsonData.expires_in * 1000));", + "pm.globals.set(\"refresh_token_expires\", Date.now() + (jsonData.refresh_expires_in * 1000));", + "pm.globals.set(\"expires_in\", jsonData.expires_in);", + "pm.globals.set(\"refresh_expires_in\", jsonData.refresh_expires_in);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/x-www-form-urlencoded" + } + ], + "body": { + "mode": "raw", + "raw": "grant_type=password&client_id={{clientid}}&username={{userid_nonqtxn}}&password={{password_nonqtxn}}&client_secret={{client_secret}}" + }, + "url": { + "raw": "{{auth_url}}/auth/realms/{{realm}}/protocol/openid-connect/token", + "host": [ + "{{auth_url}}" + ], + "path": [ + "auth", + "realms", + "{{realm}}", + "protocol", + "openid-connect", + "token" + ] + } + }, + "response": [] + }, + { + "name": "Who am I TheQ", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data, make sure schema is OK.", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.csr_schema_check)", + "", + "// Make sure the postman operator is a GA.", + "if (jsonData.hasOwnProperty(\"csr\")) {", + " role = jsonData.csr.role.role_code;", + "}", + "else {", + " role = \"Unknown\"", + "};", + "", + "pm.test(\"The cfms-postman-operator role is \" + role + \", must be GA\", function() {", + " pm.expect(role).to.be.eql(\"GA\")", + "});", + "", + "if (jsonData.hasOwnProperty(\"csr\")) {", + "\tcurrentOfficeId = jsonData.csr.office_id;", + "\tcurrentOfficeNumber = jsonData.csr.office.office_number;", + "\tcurrentCsrId = jsonData.csr.csr_id;", + " postman.setEnvironmentVariable(\"current_office_id\", currentOfficeId);", + " postman.setEnvironmentVariable(\"current_office_number\", currentOfficeNumber);", + " postman.setEnvironmentVariable(\"current_csr_id\", currentCsrId);", + "};", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}csrs/me/", + "host": [ + "{{url}}csrs" + ], + "path": [ + "me", + "" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Check channels", + "item": [ + { + "name": "Get channels", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "var schema = {", + " \"properties\" : {", + " \"channel_name\" : {", + " \"type\" : \"string\"", + " },", + " \"channel_id\" : {", + " \"type\" : [\"number\", \"object\"]", + " }", + " },", + " \"required\" : [\"channel_name\", \"channel_id\"]", + "};", + "", + "// Loop to validate schema of each channel.", + "var allChannels = jsonData.channels;", + "var channelCount = 0;", + "var phoneId = 0;", + "var emailId = 0;", + "var phoneText = \"Phone\";", + "var emailText = \"Email/Fax/Mail\";", + "allChannels.forEach(function(channel) {", + " channelCount ++;", + " var testTitle = \"Channel (\" + channelCount + \"): ID \" + channel.channel_id + \" Name \" + channel.channel_name + \" conforms to schema\";", + " tests[testTitle] = tv4.validate(channel, schema);", + " if (channel.channel_name === phoneText) {", + " phoneId = channel.channel_id;", + " }", + " if (channel.channel_name === emailText) {", + " emailId = channel.channel_id;", + " }", + "});", + "", + "// Check that you found the phone ID.", + "pm.test(phoneText + ' id was ' + phoneId.toString() + ' (should not equal 0)', function() {", + " pm.expect(phoneId).to.not.be.eql(0);", + "});", + "", + "// Check that you found the email ID.", + "pm.test(emailText + ' id was ' + emailId.toString() + ' (should not equal 0)', function() {", + " pm.expect(emailId).to.not.be.eql(0);", + "});", + "", + "// Store this ID for future use.", + "postman.setEnvironmentVariable(\"channel_telephone_id\", JSON.stringify(phoneId));", + "postman.setEnvironmentVariable(\"channel_email_id\", JSON.stringify(emailId));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + } + ], + "url": { + "raw": "{{url}}channels/", + "host": [ + "{{url}}channels" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Check counters", + "item": [ + { + "name": "Store CSR and Office Info", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data, make sure schema is OK.", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.csr_schema_check)", + "", + "// Make sure that jsonData has an csr property.", + "pm.test(\"Response should have csr property\", function(){", + " pm.expect(jsonData.hasOwnProperty(\"csr\")).to.be.true;", + "});", + "", + "var csr = 0;", + "var office = 0;", + "var counters = 0;", + "var counter_text = \"Counter\";", + "var counter_id = 0;", + "var qtxn_text = \"Quick Trans\";", + "var qtxn_id = 0;", + "", + "if (jsonData.hasOwnProperty(\"csr\")) {", + "\tcurrentOfficeId = jsonData.csr.office_id;", + "\tcurrentOfficeNumber = jsonData.csr.office.office_number;", + " postman.setEnvironmentVariable(\"current_office_id\", currentOfficeId);", + " postman.setEnvironmentVariable(\"current_office_number\", currentOfficeNumber);", + " postman.setEnvironmentVariable(\"current_csr_id\", jsonData.csr.csr_id);", + " ", + " csr = jsonData.csr;", + " counter_id = 0;", + " qtxn_id = 0;", + "", + " // Make sure that jsonData has an booking property.", + " pm.test(\"CSR should have office property\", function(){", + " pm.expect(csr.hasOwnProperty(\"office\")).to.be.true;", + " });", + " ", + " // Make sure office has counter property.", + " if (csr.hasOwnProperty(\"office\")) {", + " office = csr.office;", + " ", + " // Make sure that jsonData has an booking property.", + " pm.test(\"Office should have counters property\", function(){", + " pm.expect(office.hasOwnProperty(\"counters\")).to.be.true;", + " });", + "", + " // Make sure office has counter property.", + " if (office.hasOwnProperty(\"counters\")) {", + " counters = office.counters;", + " ", + " // Search for Counter and Quick Trans counters", + " counters.forEach(function(counter) {", + " if (counter.counter_name === counter_text) {", + " counter_id = counter.counter_id;", + " }", + " if (counter.counter_name === qtxn_text) {", + " qtxn_id = counter.counter_id;", + " }", + " });", + " ", + " // Make sure you found the right IDs.", + " pm.test(\"Counter ID (\" + counter_id.toString() + \") should not be 0\", function(){", + " pm.expect(counter_id).to.not.be.eql(0);", + " });", + " pm.test(\"Quick Transaction ID (\" + qtxn_id.toString() + \") should not be 0\", function(){", + " pm.expect(qtxn_id).to.not.be.eql(0);", + " });", + " ", + " // Store the ids for future use.", + " // postman.setEnvironmentVariable(\"counter_id\", counter_id);", + " // postman.setEnvironmentVariable(\"qtxn_id\", qtxn_id);", + " postman.setEnvironmentVariable(\"counter_id\", JSON.stringify(counter_id.toString()));", + " postman.setEnvironmentVariable(\"qtxn_id\", JSON.stringify(qtxn_id.toString()));", + " }", + "", + " ", + " }", + "", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}csrs/me/", + "host": [ + "{{url}}csrs" + ], + "path": [ + "me", + "" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Check categories", + "item": [ + { + "name": "Get categories", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "var schema = {", + " \"properties\" : {", + " \"actual_service_ind\" : { \"type\" : \"number\" },", + " \"deleted\" : { \"type\" : [\"string\", \"null\"] },", + " \"display_dashboard_ind\" : { \"type\" : \"number\" },", + " \"external_service_name\": {\"type\": [\"null\", \"string\"]},", + " \"online_availability\" : {\"type\": [\"null\", \"string\"]},", + " \"online_link\": {\"type\": [\"null\", \"string\"]},", + " \"parent\": {\"type\": \"null\"},", + " \"parent_id\": {\"type\": \"null\"},", + " \"prefix\" : {\"type\" : \"string\"},", + " \"service_code\" : {\"type\" : \"string\"},", + " \"service_desc\" : {\"type\" : \"string\"},", + " \"service_id\" : {\"type\" : [\"number\", \"object\"]},", + " \"service_name\" : {\"type\" : \"string\"},", + " \"timeslot_duration\": {\"type\": [\"null\", \"number\"]}", + " },", + " \"required\" : [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\", \"external_service_name\",", + " \"online_availability\", \"online_link\", \"parent\", \"parent_id\", \"prefix\", \"service_code\",", + " \"service_desc\", \"service_id\", \"service_name\",", + " \"timeslot_duration\"]", + "};", + "", + "// Loop to validate schema of each channel.", + "var allCategories = jsonData.categories;", + "var categoryCount = 0;", + "allCategories.forEach(function(category) {", + " categoryCount ++;", + " var testTitle = \"Category (\" + categoryCount + \"): \" + category.service_name + \" - \";", + " tests[testTitle + \"conforms to schema\"] = tv4.validate(category, schema);", + " var displayInd = category.display_dashboard_ind;", + " var serviceInd = category.actual_service_ind;", + "", + " // Test that returned data is valid.", + " pm.test(\"--> \" + testTitle + \"display_dashboard_ind must be 0 (is \" + displayInd.toString() + \")\", function(){", + " pm.expect(displayInd).to.be.eql(0);", + " });", + "", + " pm.test(\"--> \" + testTitle + \"actual_service_ind must be 0 (is \" + serviceInd.toString() + \")\", function(){", + " pm.expect(serviceInd).to.be.eql(0);", + " });", + " ", + " pm.test(\"--> \" + testTitle + \"parent_id must be null\", function(){", + " pm.expect(category.parent_id).to.be.null;", + " });", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + } + ], + "url": { + "raw": "{{url}}categories/", + "host": [ + "{{url}}categories" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Check services", + "item": [ + { + "name": "Get services", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.service_schema_check);", + "", + "// Loop to validate schema of each channel.", + "var allElements = jsonData.services;", + "var elementCount = 0;", + "var elementMax = Math.min(10, allElements.length);", + "//allElements.forEach(function(element) {", + "for (var currentElement = 0; currentElement < elementMax; currentElement++) {", + " element = allElements[currentElement];", + " elementCount ++;", + " var testTitle = \"Service (\" + elementCount + \"): \" + element.service_name + \" - \";", + " displayInd = element.display_dashboard_ind;", + " serviceInd = element.actual_service_ind;", + "", + " // Test that returned data is valid.", + " pm.test(\"--> \" + testTitle + \"display_dashboard_ind must be 0 or 1 (is \" + displayInd.toString() + \")\", function(){", + " pm.expect(displayInd).to.be.within(0, 1);", + " });", + "", + " // Test that returned data is valid.", + " pm.test(\"--> \" + testTitle + \"actual_service_ind must be 1 (is \" + serviceInd.toString() + \")\", function(){", + " pm.expect(serviceInd).to.be.eql(1);", + " });", + " ", + " // Test that returned data is valid.", + " pm.test(\"--> \" + testTitle + \"parent_id must not be null\", function(){", + " pm.expect(element.parent_id).to.not.be.null;", + " });", + "}", + "", + "// Declare and initialize variables.", + "var mspId = 0;", + "var taxId = 0;", + "var mspText = \"Payment - MSP\";", + "var propTaxText = \"Other - Rural PTAX\";", + "", + "// Look for the MSP and Property Tax IDs.", + "allElements.forEach(function(element) {", + " if (element.service_name === mspText) {", + " mspId = element.service_id;", + " }", + " if (element.service_name === propTaxText) {", + " taxId = element.service_id;", + " }", + "});", + "", + "// Check that you found the MSP service.", + "pm.test(mspText + ' id was ' + mspId.toString() + ' (should not equal 0)', function() {", + " pm.expect(mspId).to.not.be.eql(0);", + "});", + "", + "// Check that you found the Property Tax service.", + "pm.test(propTaxText + ' id was ' + taxId.toString() + ' (should not equal 0)', function() {", + " pm.expect(taxId).to.not.be.eql(0);", + "});", + "", + "// Store these IDs for future use.", + "postman.setEnvironmentVariable(\"service_MSP_id\", JSON.stringify(mspId));", + "postman.setEnvironmentVariable(\"service_PropTax_id\", JSON.stringify(taxId));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + } + ], + "url": { + "raw": "{{url}}services/", + "host": [ + "{{url}}services" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Update quick lists", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_office_id\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data, make sure schema is OK.", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.office_schema_check)", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + } + ], + "url": { + "raw": "{{url}}services/refresh/?office_id={{current_office_id}}", + "host": [ + "{{url}}services" + ], + "path": [ + "refresh", + "" + ], + "query": [ + { + "key": "office_id", + "value": "{{current_office_id}}" + } + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Check smartboard", + "item": [ + { + "name": "Get smartboard", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_office_number\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Define the JSON Schema expected in response", + "var smartboardSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"office_type\": {\"type\": \"string\"},", + " \"citizens\": {", + " \"type\": \"array\",", + " \"items\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"ticket_number\": {\"type\": \"string\"},", + " \"active_period\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"period_id\": {\"type\": \"number\"},", + " \"ps\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"ps_name\": \"string\"", + " },", + " \"required\": [\"ps_name\"]", + " },", + " \"ps_id\": {\"type\": \"number\"},", + " \"time_end\": {\"type\": [\"null\", \"string\"]},", + " \"time_start\": {\"type\": \"string\"}", + " },", + " \"required\": [\"period_id\", \"ps\", \"ps_id\", \"time_end\", \"time_start\"]", + " },", + " },", + " \"required\": [\"ticket_number\", \"active_period\"]", + " },", + " },", + " },", + " \"required\": [\"office_type\", \"citizens\"]", + "};", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate the Smartboard Schema\", function(){", + " pm.expect(tv4.validate(jsonData, smartboardSchema)).to.be.true;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + } + ], + "url": { + "raw": "{{url}}smartboard/?office_number={{current_office_number}}", + "host": [ + "{{url}}smartboard" + ], + "path": [ + "" + ], + "query": [ + { + "key": "office_number", + "value": "{{current_office_number}}" + } + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Check videofiles", + "item": [ + { + "name": "Get videofiles", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data, make sure schema is OK.", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.video_schema_check)", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + } + ], + "url": { + "raw": "{{url}}videofiles/", + "host": [ + "{{url}}videofiles" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Get videofiles for office", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_office_number\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data, make sure schema is OK.", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.video_schema_check)", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + } + ], + "url": { + "raw": "{{url}}videofiles/?office_number={{current_office_number}}", + "host": [ + "{{url}}videofiles" + ], + "path": [ + "" + ], + "query": [ + { + "key": "office_number", + "value": "{{current_office_number}}" + } + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Check CSRs and States", + "item": [ + { + "name": "Get CSRs", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data, make sure schema is OK.", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.manycsrs_schema_check)", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + } + ], + "url": { + "raw": "{{url}}csrs/", + "host": [ + "{{url}}csrs" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Check Postman Finance No", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_csr_id\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.onecsr_schema_check);", + "", + "pm.test(\"Response should include csr object\", function() {", + " pm.expect(jsonData).to.have.property(\"csr\");", + " pm.expect(jsonData.csr).to.be.an(\"object\");", + "});", + "", + "if (!jsonData.csr) {", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Response missing csr object\");", + "}", + "", + "// Make sure the CSR finance designation is correct.", + "var finance = jsonData.csr.finance_designate;", + "pm.test(\"Finance designate is \" + finance.toString() + \" - it should be 0\", function() {", + " pm.expect(finance).to.be.eql(0);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"finance_designate\": 0\r\n}" + }, + "url": { + "raw": "{{url}}csrs/{{current_csr_id}}/", + "host": [ + "{{url}}csrs" + ], + "path": [ + "{{current_csr_id}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Check Postman Finance Yes", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_csr_id\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.onecsr_schema_check);", + "", + "pm.test(\"Response should include csr object\", function() {", + " pm.expect(jsonData).to.have.property(\"csr\");", + " pm.expect(jsonData.csr).to.be.an(\"object\");", + "});", + "", + "if (!jsonData.csr) {", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Response missing csr object\");", + "}", + "", + "// Make sure the CSR finance designation is correct.", + "var finance = jsonData.csr.finance_designate;", + "pm.test(\"Finance designate is \" + finance.toString() + \" - it should be 1\", function() {", + " pm.expect(finance).to.be.eql(1);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"finance_designate\": 1\r\n}" + }, + "url": { + "raw": "{{url}}csrs/{{current_csr_id}}/", + "host": [ + "{{url}}csrs" + ], + "path": [ + "{{current_csr_id}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Get CSR states", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Define the JSON Schema expected in response", + "var csrStateSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"csr_states\" : {", + " \"type\": \"array\",", + " \"items\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"csr_state_desc\": {\"type\": \"string\"},", + " \"csr_state_id\": {\"type\": \"number\"},", + " \"csr_state_name\": {\"type\": \"string\"},", + " },", + " \"required\": [\"csr_state_desc\", \"csr_state_id\", \"csr_state_name\"]", + " }", + " },", + " \"errors\": {\"type\": [\"object\", \"string\"]}", + " },", + " \"required\": [\"csr_states\", \"errors\"]", + "};", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate CSR States Schema\", function(){", + " pm.expect(tv4.validate(jsonData, csrStateSchema)).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + } + ], + "url": { + "raw": "{{url}}csr_states/", + "host": [ + "{{url}}csr_states" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Clear queue for tests", + "item": [ + { + "name": "Delete citizen queue driver", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Delete citizens, if there are any.", + " if (citizenIds.length > 0) {", + " ", + " // Set the current_client, to be deleted.", + " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", + " postman.setEnvironmentVariable(\"current_queue\", JSON.stringify(citizenIds));", + " ", + " if (currentCitizen.service_reqs.length === 0) {", + " postman.setNextRequest(\"Next citizen left\");", + " // // Temporary kludge. Citizen left not working, so add SR, then delete.", + " // postman.setNextRequest(\"Temporary add MSP service request\");", + " }", + " else {", + " postman.setNextRequest(\"Next citizen finish service\");", + " }", + " }", + " ", + " // No more citizens. Clear the current, queue variables.", + " else {", + " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(\"\"));", + " postman.setEnvironmentVariable(\"current_queue\", JSON.stringify(\"\"));", + " postman.setNextRequest(\"End clear queue via healthz endpoint\");", + " }", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Next citizen finish service", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "var citizenToBeDeleted = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "var citizenData = jsonData.citizen;", + "var testTitle = \"Check citizen finish service\";", + "", + "// Make sure the response is valid.", + "pm.test(testTitle + \": Response should have property 'citizen'\", function(){", + " pm.expect(jsonData.hasOwnProperty(\"citizen\")).to.be.true;", + "});", + "pm.test(testTitle + \": Response should not have property 'message' indicating an error\", function(){", + " pm.expect(jsonData.hasOwnProperty(\"message\")).to.be.false;", + "});", + "pm.test(testTitle + \": Citizen marked as finished should be citizen \" + citizenToBeDeleted.toString(), function(){", + " pm.expect(citizenData.citizen_id).to.be.eql(citizenToBeDeleted);", + "});", + "", + "// Go back to the delete citizen queue driver.", + "postman.setNextRequest(\"Delete citizen queue driver\");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/finish_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "finish_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Next citizen citizen left", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get environment variables.", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + " // Perform checks.", + " pm.test(\"Check there are no citizens waiting\", function(){", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test(\"Citizen that left must be \" + currentCitizen.citizen_id.toString() + \" (is \" + currentCitizenId.toString(), function(){", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + "}", + "", + "// Go back to the delete citizen queue driver.", + "postman.setNextRequest(\"Delete citizen queue driver\");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/citizen_left/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "citizen_left", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Temporary add MSP service request", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"service_MSP_id\",\"current_client\",\"channel_telephone_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run create tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "var svcReq = jsonData.service_request;", + "", + "// Run service request tests.", + "eval(environment.one_service_request_test);", + "", + "// Make sure the response is valid.", + "pm.test(\"Response has service_request property\", function(){", + " pm.expect(jsonData.hasOwnProperty(\"service_request\")).to.be.true;", + "});", + "pm.test(\"Response has errors property\", function(){", + " pm.expect(jsonData.hasOwnProperty(\"errors\")).to.be.true;", + "});", + "", + "// Go back to the clear citizen driver.", + "postman.setNextRequest(\"Next citizen finish service\");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_MSP_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : 1,\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" + }, + "url": { + "raw": "{{url}}service_requests/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "End clear queue via healthz endpoint", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Perform the standard tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Test the health response.", + "pm.test(\"Response should have 'message' property\", function() {", + " pm.expect(jsonData).to.have.property('message');", + "});", + "", + "pm.test(\"Response message should be 'api is healthy'\", function() {", + " pm.expect(jsonData.message).to.be.eql('api is healthy');", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}healthz/", + "host": [ + "{{url}}healthz" + ], + "path": [ + "" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Check citizen through queue (QT1)", + "item": [ + { + "name": "Check no citizens (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var allOK = true;", + "", + "// If citizen property was present.", + "if (allElements !== null) {", + "", + " // Make sure it had a length of 0.", + " if (allElements.length !== 0) {", + " allOK = false;", + " }", + "}", + "", + "pm.test(\"There should be no citizens in the office\", function() {", + " pm.expect(allOK).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Create citizen (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " pm.test(\"Only one citizen should be in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + " ", + " // Store the ID of the citizen just created.", + " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{}" + }, + "url": { + "raw": "{{url}}citizens/0/add_citizen/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "0", + "add_citizen", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Edit specific citizen (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\",\"citizen_name\",\"citizen_comment\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + "", + " // Perform tests.", + " pm.test(\"Must be one active citizen in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}}\n}" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Add property tax via phone service request (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"service_PropTax_id\",\"current_client\",\"citizen_quantity\",\"channel_telephone_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get the current service request, check schema.", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.one_service_request_test);", + "", + "// Get the SR ID.", + "if (jsonData.hasOwnProperty(\"service_request\")) {", + "\tcurrentSrId = jsonData.service_request.sr_id;", + "}", + "else {", + " currentSrId = 0;", + "}", + "", + "// The service request ID must not be 0.", + "pm.test(\"The Service Request ID is \" + currentSrId.toString() + \", must not be 0\", function() {", + " pm.expect(currentSrId).to.not.be.eql(0)", + "});", + "", + "// Save the service request ID.", + "postman.setEnvironmentVariable(\"first_sr_id\", currentSrId);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" + }, + "url": { + "raw": "{{url}}service_requests/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "List specific citizen (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request must have one period', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", + " });", + " pm.test('Service request period channel must be ' + citizenChannel, function() {", + " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", + " });", + " pm.test('Service request period state must be \"Ticket Creation\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/{{current_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Add citizen to queue (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Pending\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (now two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Waiting\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/add_to_queue/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "add_to_queue", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Invite specific citizen (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 3 (now three periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(3);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Invited\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Invited\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/invite/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "invite", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Begin serving citizen (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 4 (now four periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(4);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Being Served\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/begin_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "begin_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Add MSP via email service request (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"service_MSP_id\",\"current_client\",\"citizen_quantity\",\"channel_email_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get the current service request, check schema.", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.one_service_request_test);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_MSP_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_email_id}}\n\t}\n}" + }, + "url": { + "raw": "{{url}}service_requests/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Activate property tax service (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"first_sr_id\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get the current service request ID.", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.one_service_request_test);", + "", + "if (jsonData.hasOwnProperty(\"service_request\")) {", + "\tcurrentSrId = jsonData.service_request.sr_id;", + "}", + "else {", + " currentSrId = 0;", + "}", + "", + "// Get the first service request ID.", + "first_id = JSON.parse(postman.getEnvironmentVariable(\"first_sr_id\"));", + "", + "// The service request ID must not be 0.", + "pm.test(\"The Service Request ID is \" + currentSrId.toString() + \", must be \" + first_id.toString(), function() {", + " pm.expect(currentSrId).to.be.eql(first_id)", + "});", + "", + "// Save the service request ID.", + "postman.setEnvironmentVariable(\"second_sr_id\", currentSrId);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}service_requests/{{first_sr_id}}/activate/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "{{first_sr_id}}", + "activate", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Finish serving citizen (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be no active citizens in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('There must be two service requests', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(2);", + " });", + " pm.test('Service request state must be \"Complete\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 5 (five periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(5);", + " });", + " pm.test('There must be no open periods', function() {", + " pm.expect(openPeriodCount).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/finish_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "finish_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Check citizen begin-hold-finish (QT2)", + "item": [ + { + "name": "Check no citizens (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var allOK = true;", + "", + "// If citizen property was present.", + "if (allElements !== null) {", + "", + " // Make sure it had a length of 0.", + " if (allElements.length !== 0) {", + " allOK = false;", + " }", + "}", + "", + "pm.test(\"There should be no citizens in the office\", function() {", + " pm.expect(allOK).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Create citizen (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Perform tests.", + " pm.test(\"Only one citizen should be in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + " ", + " // Store the ID of the citizen just created.", + " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", + "} ", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{}" + }, + "url": { + "raw": "{{url}}citizens/0/add_citizen/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "0", + "add_citizen", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Edit specific citizen (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\",\"citizen_name\",\"citizen_comment\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// // Get data, create JSON body.", + "// var citizenName = postman.getEnvironmentVariable(\"citizen_name\");", + "// var citizenComments = postman.getEnvironmentVariable(\"citizen_comment\");", + "// var bodyData = {", + "// \"citizen_name\" : citizenName,", + "// \"citizen_comments\" : citizenComments", + "// }", + "// // Store the data in an environment variable.", + "// postman.setEnvironmentVariable(\"putBody\", JSON.stringify(bodyData));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + "", + " // Perform tests.", + " pm.test(\"Must be one active citizen in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}}\n}" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Add property tax via phone service request (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"service_PropTax_id\",\"current_client\",\"citizen_quantity\",\"channel_telephone_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get the current service request, check schema.", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.one_service_request_test);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" + }, + "url": { + "raw": "{{url}}service_requests/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "List specific citizen (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request must have one period', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", + " });", + " pm.test('Service request period channel must be ' + citizenChannel, function() {", + " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", + " });", + " pm.test('Service request period state must be \"Ticket Creation\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/{{current_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Begin serving citizen (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (now two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Being Served\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/begin_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "begin_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Place citizen on hold (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 3 (now three periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(3);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"On hold\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"On hold\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/place_on_hold/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "place_on_hold", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Get service requests (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.service_request_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + "var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + "var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get periods for the first service request.", + " var allPeriods = allElements[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " var allPeriodCount = 0;", + "", + " // Find how many periods there are with null end time.", + " // Also, check schema.", + " allPeriods.forEach(function(onePeriod) {", + " ", + " // Find the open period.", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " ", + " });", + "} ", + "", + "// If there are some service requests, proceed with tests.", + "if (allElements !== null) {", + "", + " // Perform tests.", + " pm.test('There must be only one service request', function() {", + " pm.expect(allElements.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(allElements[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(allElements[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(allElements[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request must have three periods', function() {", + " pm.expect(allPeriods.length).to.be.eql(3);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('Service request period state must be \"On hold\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"On hold\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/{{current_client}}/service_requests/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "service_requests", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Call citizen from hold (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 4 (now four periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(4);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Being Served\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/begin_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "begin_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Finish serving citizen (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + " ", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = allElements[0].service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be no active citizens in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Complete\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 4 (still four periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(4);", + " });", + " pm.test('There must be no open periods', function() {", + " pm.expect(openPeriodCount).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/finish_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "finish_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Check citizen leave after create (QT3)", + "item": [ + { + "name": "Check no citizens (QT3)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var allOK = true;", + "", + "// If citizen property was present.", + "if (allElements !== null) {", + "", + " // Make sure it had a length of 0.", + " if (allElements.length !== 0) {", + " allOK = false;", + " }", + "}", + "", + "pm.test(\"There should be no citizens in the office\", function() {", + " pm.expect(allOK).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Create citizen (QT3)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Perform tests.", + " pm.test(\"Only one citizen should be in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "", + " // Store the ID of the citizen just created.", + " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{}" + }, + "url": { + "raw": "{{url}}citizens/0/add_citizen/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "0", + "add_citizen", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Citizen left (QT3)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get environment variables.", + " var citizenName = postman.getEnvironmentVariable(\"citizen_name\");", + " var citizenComment = postman.getEnvironmentVariable(\"citizen_comment\");", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = null;", + " if (currentCitizen.service_reqs.length !== 0) {", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " }", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " if (allPeriods !== null) {", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + " }", + "", + " // Perform tests.", + " pm.test(\"Must be no active citizens in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/citizen_left/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "citizen_left", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Check citizen leave after waiting (QT4)", + "item": [ + { + "name": "Check no citizens (QT4)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var allOK = true;", + "", + "// If citizen property was present.", + "if (allElements !== null) {", + "", + " // Make sure it had a length of 0.", + " if (allElements.length !== 0) {", + " allOK = false;", + " }", + "}", + "", + "pm.test(\"There should be no citizens in the office\", function() {", + " pm.expect(allOK).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Create citizen (QT4)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Perform tests.", + " pm.test(\"Only one citizen should be in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "", + " // Store the ID of the citizen just created.", + " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{}" + }, + "url": { + "raw": "{{url}}citizens/0/add_citizen/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "0", + "add_citizen", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Edit specific citizen (QT4)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\",\"citizen_name\",\"citizen_comment\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// // Get data, create JSON body.", + "// var citizenName = postman.getEnvironmentVariable(\"citizen_name\");", + "// var citizenComments = postman.getEnvironmentVariable(\"citizen_comment\");", + "// var bodyData = {", + "// \"citizen_name\" : citizenName,", + "// \"citizen_comments\" : citizenComments", + "// }", + "// // Store the data in an environment variable.", + "// postman.setEnvironmentVariable(\"putBody\", JSON.stringify(bodyData));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + "", + " // Perform tests.", + " pm.test(\"Must be one active citizen in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}}\n}" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Add property tax via phone service request (QT4)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"service_PropTax_id\",\"current_client\",\"citizen_quantity\",\"channel_telephone_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get the current service request, check schema.", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.one_service_request_test);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" + }, + "url": { + "raw": "{{url}}service_requests/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "List specific citizen (QT4)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request must have one period', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", + " });", + " pm.test('Service request period channel must be ' + citizenChannel, function() {", + " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", + " });", + " pm.test('Service request period state must be \"Ticket Creation\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/{{current_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Add citizen to queue (QT4)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Pending\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (now two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Waiting\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/add_to_queue/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "add_to_queue", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Citizen left (QT4)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test(\"Must be no active citizens in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test(\"Citizen should have one service request\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Complete\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (now two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must be no open periods', function() {", + " pm.expect(openPeriodCount).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/citizen_left/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "citizen_left", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Check no citizens (QT4)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var allOK = true;", + "", + "// If citizen property was present.", + "if (allElements !== null) {", + "", + " // Make sure it had a length of 0.", + " if (allElements.length !== 0) {", + " allOK = false;", + " }", + "}", + "", + "pm.test(\"There should be no citizens in the office\", function() {", + " pm.expect(allOK).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Check update service information (QT5)", + "item": [ + { + "name": "Check no citizens (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var allOK = true;", + "", + "// If citizen property was present.", + "if (allElements !== null) {", + "", + " // Make sure it had a length of 0.", + " if (allElements.length !== 0) {", + " allOK = false;", + " }", + "}", + "", + "pm.test(\"There should be no citizens in the office\", function() {", + " pm.expect(allOK).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Create citizen (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Perform tests.", + " pm.test(\"Only one citizen should be in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "", + " // Store the ID of the citizen just created.", + " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{}" + }, + "url": { + "raw": "{{url}}citizens/0/add_citizen/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "0", + "add_citizen", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Edit specific citizen (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\",\"citizen_name\",\"citizen_comment\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// // Get data, create JSON body.", + "// var citizenName = postman.getEnvironmentVariable(\"citizen_name\");", + "// var citizenComments = postman.getEnvironmentVariable(\"citizen_comment\");", + "// var bodyData = {", + "// \"citizen_name\" : citizenName,", + "// \"citizen_comments\" : citizenComments", + "// };", + "// // Store the data in an environment variable.", + "// postman.setEnvironmentVariable(\"putBody\", JSON.stringify(bodyData));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + " ", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + "", + " // Perform tests.", + " pm.test(\"Must be one active citizen in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}}\n}" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Add property tax via phone service request (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"service_PropTax_id\",\"current_client\",\"citizen_quantity\",\"channel_telephone_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get the current service request, check schema.", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.one_service_request_test);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" + }, + "url": { + "raw": "{{url}}service_requests/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "List specific citizen (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + " ", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request must have one period', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", + " });", + " pm.test('Service request period channel must be ' + citizenChannel, function() {", + " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", + " });", + " pm.test('Service request period state must be \"Ticket Creation\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", + " });", + "", + " // Save the service request ID for later.", + " var mySRId = allElements[0].service_reqs[0].sr_id;", + " postman.setEnvironmentVariable(\"current_sr_id\", JSON.stringify(mySRId));", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/{{current_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Begin serving citizen (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (now two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Being Served\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/begin_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "begin_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Update quantity from 3 to 5 (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_sr_id\",\"operator_token\",\"citizen_quantity_update\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.service_request_test);", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Only check for an updated quantity. Get environment variables.", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", + "", + " // Perform tests.", + " pm.test('Updated service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(allElements[0].quantity).to.be.eql(citizenQuantity);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"quantity\" : {{citizen_quantity_update}}\n}" + }, + "url": { + "raw": "{{url}}service_requests/{{current_sr_id}}/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "{{current_sr_id}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Update service from PropTax to MSP (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_sr_id\",\"operator_token\",\"service_MSP_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.service_request_test);", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Only check for an updated quantity. Get environment variables.", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", + "", + " // Perform tests.", + " pm.test('Updated service request service must be ' + citizenService, function() {", + " pm.expect(allElements[0].service_id).to.be.eql(citizenService);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_id\" : {{service_MSP_id}}\n}" + }, + "url": { + "raw": "{{url}}service_requests/{{current_sr_id}}/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "{{current_sr_id}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Finish serving citizen (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be no active citizens in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Complete\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (should be two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must be no open periods', function() {", + " pm.expect(openPeriodCount).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/finish_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "finish_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Check pick qtxn customer (QT6)", + "item": [ + { + "name": "Check no citizens (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var citizenCount = 0;", + "", + "// If citizen property was present.", + "if (allElements !== null) {", + "", + " // Get number of citizens in the queue.", + " citizenCount = allElements.length;", + "}", + "", + "pm.test(\"There should be no citizens in the office\", function() {", + " pm.expect(citizenCount).to.be.eql(0);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "First citizen - Create (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Perform tests.", + " pm.test(\"Only one citizen should have been created\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "", + " // Store the ID of the citizen just created.", + " postman.setEnvironmentVariable(\"first_client\", JSON.stringify(citizenIds.shift()));", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{}" + }, + "url": { + "raw": "{{url}}citizens/0/add_citizen/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "0", + "add_citizen", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "First citizen - Edit (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"first_client\",\"operator_token\",\"citizen_name\",\"citizen_comment\",\"counter_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + "", + " // Perform tests.", + " pm.test(\"Must be one active citizen in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}},\n \"counter_id\": {{counter_id}}\n}" + }, + "url": { + "raw": "{{url}}citizens/{{first_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{first_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "First citizen - Prop Tax via phone (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"service_PropTax_id\",\"first_client\",\"citizen_quantity\",\"channel_telephone_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get the current service request, check schema.", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.one_service_request_test);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{first_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" + }, + "url": { + "raw": "{{url}}service_requests/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "First citizen - List (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"first_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request must have one period', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", + " });", + " pm.test('Service request period channel must be ' + citizenChannel, function() {", + " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", + " });", + " pm.test('Service request period state must be \"Ticket Creation\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/{{first_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{first_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "First citizen - Add to queue (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"first_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Pending\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (now two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Waiting\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{first_client}}/add_to_queue/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{first_client}}", + "add_to_queue", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - Create (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Perform tests.", + " pm.test(\"Only one citizen should have been created\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "", + " // Store the ID of the citizen just created.", + " postman.setEnvironmentVariable(\"second_client\", JSON.stringify(citizenIds.shift()));", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{}" + }, + "url": { + "raw": "{{url}}citizens/1/add_citizen/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "1", + "add_citizen", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - Edit QTxn (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"second_client\",\"operator_token\",\"citizen_name_quick\",\"citizen_comment_quick\",\"qtxn_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// // Get data, create JSON body.", + "// var citizenName = postman.getEnvironmentVariable(\"citizen_name_quick\");", + "// var citizenComments = postman.getEnvironmentVariable(\"citizen_comment_quick\");", + "// var bodyData = {", + "// \"citizen_name\" : citizenName,", + "// \"citizen_comments\" : citizenComments,", + "// \"qt_xn_citizen_ind\" : 1", + "// };", + "// // Store the data in an environment variable.", + "// postman.setEnvironmentVariable(\"putBody\", JSON.stringify(bodyData));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", + "", + " // Perform tests.", + " pm.test(\"Should be updating single citizen\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"citizen_name\" : {{citizen_name_quick}},\n \"citizen_comments\" : {{citizen_comment_quick}},\n \"qt_xn_citizen_ind\" : 1,\n \"counter_id\": {{qtxn_id}}\n}" + }, + "url": { + "raw": "{{url}}citizens/{{second_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{second_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - MSP via email (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"service_MSP_id\",\"second_client\",\"citizen_quantity_update\",\"channel_email_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get the current service request, check schema.", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.one_service_request_test);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_MSP_id}},\n\t\t\"citizen_id\" : {{second_client}},\n\t\t\"quantity\" : {{citizen_quantity_update}},\n\t\t\"channel_id\" : {{channel_email_id}}\n\t}\n}" + }, + "url": { + "raw": "{{url}}service_requests/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - List (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"second_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", + "", + " // Perform tests.", + " pm.test('Should be updating one citizen', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request must have one period', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", + " });", + " pm.test('Service request period channel must be ' + citizenChannel, function() {", + " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", + " });", + " pm.test('Service request period state must be \"Ticket Creation\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/{{second_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{second_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - Add to queue (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"second_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Should be adding one citizen to the queue', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Pending\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (now two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Waiting\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{second_client}}/add_to_queue/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{second_client}}", + "add_to_queue", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Check 2 citizens in queue (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var citizenCount = 0;", + "", + "// If citizen property was present.", + "if (allElements !== null) {", + "", + " // Get number of citizens in the queue.", + " citizenCount = allElements.length;", + "}", + "", + "pm.test('Must be two active citizens in the office', function() {", + " pm.expect(citizenCount).to.be.eql(2);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Set CSR to QTxn (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_csr_id\",\"operator_token\",\"qtxn_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Turn the qtxn ID from character to number.", + "qtxn_id_number = JSON.parse(environment.qtxn_id);", + "postman.setEnvironmentVariable(\"qtxn_id_number\", qtxn_id_number);" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body, test the schema", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.onecsr_schema_check)", + "", + "// Ensure the CSR is now set to take quick transactions.", + "csrType = jsonData.csr.counter;", + "csrNeed = JSON.parse(environment.qtxn_id_number);", + "pm.test('CSR counter type is ' + csrType.toString() + '; must be ' + csrNeed.toString(), function() {", + " pm.expect(csrType).to.be.eql(csrNeed);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"counter_id\": {{qtxn_id_number}}\n}" + }, + "url": { + "raw": "{{url}}csrs/{{current_csr_id}}/", + "host": [ + "{{url}}csrs" + ], + "path": [ + "{{current_csr_id}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Invite next citizen - should be second one (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Should only be inviting one citizen', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 3 (now three periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(3);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Invited\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Invited\");", + " });", + "}", + "", + "// Store the ID of the citizen just invited.", + "postman.setEnvironmentVariable(\"current_client\", JSON.stringify(currentCitizenId));", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/invite/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "invite", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - begin serving (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one citizen being served', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 4 (now four periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(4);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Being Served\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/begin_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "begin_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - finish serving (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be no active citizen being served', function() {", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Complete\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 4 (still four periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(4);", + " });", + " pm.test('There must be no open periods', function() {", + " pm.expect(openPeriodCount).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/finish_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "finish_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Invite next citizen - should be first one (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Should only be inviting one citizen', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 3 (now three periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(3);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Invited\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Invited\");", + " });", + "}", + "", + "// Store the ID of the citizen just invited.", + "postman.setEnvironmentVariable(\"current_client\", JSON.stringify(currentCitizenId));", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/invite/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "invite", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "First citizen - citizen left (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test(\"Must be no active citizen being served\", function() {", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test(\"Citizen should have one service request\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Complete\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 3 (now three periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(3);", + " });", + " pm.test('There must be no open periods', function() {", + " pm.expect(openPeriodCount).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/citizen_left/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "citizen_left", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Check pick non-qtxn customer (QT7)", + "item": [ + { + "name": "Bootstrap non-QTxn CSR (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"nonqtxn_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse the current CSR payload.", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.csr_schema_check);", + "", + "pm.environment.unset(\"first_client\");", + "pm.environment.unset(\"second_client\");", + "pm.environment.unset(\"current_client\");", + "", + "pm.test(\"Response should have csr property\", function(){", + " pm.expect(jsonData.hasOwnProperty(\"csr\")).to.be.true;", + "});", + "", + "if (jsonData.hasOwnProperty(\"csr\")) {", + " postman.setEnvironmentVariable(\"current_office_id\", jsonData.csr.office_id);", + " postman.setEnvironmentVariable(\"current_office_number\", jsonData.csr.office.office_number);", + " postman.setEnvironmentVariable(\"current_csr_id\", jsonData.csr.csr_id);", + "}", + "", + "pm.test(\"Non-QTxn CSR id is available\", function(){", + " pm.expect(pm.environment.get(\"current_csr_id\")).to.not.be.oneOf([null, undefined, \"\"]);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{nonqtxn_token}}", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "url": { + "raw": "{{url}}csrs/me/", + "host": [ + "{{url}}csrs" + ], + "path": [ + "me", + "" + ] + } + }, + "response": [] + }, + { + "name": "Check no citizens (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"nonqtxn_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var citizenCount = 0;", + "", + "// If citizen property was present.", + "if (allElements !== null) {", + "", + " // Get number of citizens in the queue.", + " citizenCount = allElements.length;", + "}", + "", + "pm.test(\"There should be no citizens in the office\", function() {", + " pm.expect(citizenCount).to.be.eql(0);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{nonqtxn_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "First citizen - Create (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"nonqtxn_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Perform tests.", + " pm.test(\"Only one citizen should have been created\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "", + " // Store the ID of the citizen just created.", + " postman.setEnvironmentVariable(\"first_client\", JSON.stringify(citizenIds.shift()));", + " pm.test(\"Stored first_client for later QT7 requests\", function() {", + " pm.expect(postman.getEnvironmentVariable(\"first_client\")).to.not.be.oneOf([null, undefined, \"\"]);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{nonqtxn_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{}" + }, + "url": { + "raw": "{{url}}citizens/0/add_citizen/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "0", + "add_citizen", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "First citizen - Edit QTxn (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"first_client\",\"nonqtxn_token\",\"citizen_name_quick\",\"citizen_comment_quick\",\"qtxn_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", + "", + " // Perform tests.", + " pm.test(\"Must be editing only one citizen\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{nonqtxn_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"citizen_name\" : {{citizen_name_quick}},\n \"citizen_comments\" : {{citizen_comment_quick}},\n \"qt_xn_citizen_ind\" : 1,\n \"counter_id\": {{qtxn_id}}\n}" + }, + "url": { + "raw": "{{url}}citizens/{{first_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{first_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "First citizen - MSP via email (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"nonqtxn_token\",\"service_MSP_id\",\"first_client\",\"citizen_quantity_update\",\"channel_email_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get the current service request, check schema.", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.one_service_request_test);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{nonqtxn_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_MSP_id}},\n\t\t\"citizen_id\" : {{first_client}},\n\t\t\"quantity\" : {{citizen_quantity_update}},\n\t\t\"channel_id\" : {{channel_email_id}}\n\t}\n}" + }, + "url": { + "raw": "{{url}}service_requests/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "First citizen - List (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"first_client\",\"nonqtxn_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", + "", + " // Perform tests.", + " pm.test('Must be editing only one citizen', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request must have one period', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", + " });", + " pm.test('Service request period channel must be ' + citizenChannel, function() {", + " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", + " });", + " pm.test('Service request period state must be \"Ticket Creation\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{nonqtxn_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/{{first_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{first_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "First citizen - Add to queue (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"first_client\",\"nonqtxn_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be adding only one citizen to the queue', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Pending\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (now two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Waiting\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{nonqtxn_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{first_client}}/add_to_queue/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{first_client}}", + "add_to_queue", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - Create (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"nonqtxn_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Perform tests.", + " pm.test(\"Only one citizen should have been created\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "", + " // Store the ID of the citizen just created.", + " postman.setEnvironmentVariable(\"second_client\", JSON.stringify(citizenIds.shift()));", + " pm.test(\"Stored second_client for later QT7 requests\", function() {", + " pm.expect(postman.getEnvironmentVariable(\"second_client\")).to.not.be.oneOf([null, undefined, \"\"]);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{nonqtxn_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{}" + }, + "url": { + "raw": "{{url}}citizens/1/add_citizen/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "1", + "add_citizen", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - Edit (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"second_client\",\"nonqtxn_token\",\"citizen_name\",\"citizen_comment\",\"counter_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + "", + " // Perform tests.", + " pm.test(\"Should be updating single citizen\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{nonqtxn_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}},\n \"counter_id\": {{counter_id}}\n}" + }, + "url": { + "raw": "{{url}}citizens/{{second_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{second_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - Prop Tax via phone (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"nonqtxn_token\",\"service_PropTax_id\",\"second_client\",\"citizen_quantity\",\"channel_telephone_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get the current service request, check schema.", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.one_service_request_test);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{nonqtxn_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{second_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" + }, + "url": { + "raw": "{{url}}service_requests/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - List (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"second_client\",\"nonqtxn_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", + "", + " // Perform tests.", + " pm.test('Should be updating one citizen', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request must have one period', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", + " });", + " pm.test('Service request period channel must be ' + citizenChannel, function() {", + " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", + " });", + " pm.test('Service request period state must be \"Ticket Creation\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{nonqtxn_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/{{second_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{second_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - Add to queue (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"second_client\",\"nonqtxn_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Should be adding one citizen to the queue', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Pending\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (now two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Waiting\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{nonqtxn_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{second_client}}/add_to_queue/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{second_client}}", + "add_to_queue", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Check 2 citizens in queue (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"nonqtxn_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var citizenCount = 0;", + "", + "// If citizen property was present.", + "if (allElements !== null) {", + "", + " // Get number of citizens in the queue.", + " citizenCount = allElements.length;", + "}", + "", + "pm.test('Must be two active citizens in the office', function() {", + " pm.expect(citizenCount).to.be.eql(2);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{nonqtxn_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Set CSR to Counter (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_csr_id\",\"nonqtxn_token\",\"counter_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Turn the qtxn ID from character to number.", + "counter_id_number = JSON.parse(environment.counter_id);", + "postman.setEnvironmentVariable(\"counter_id_number\", counter_id_number);" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body, test the schema", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.onecsr_schema_check)", + "", + "// Ensure the CSR is now set to take quick transactions.", + "csrType = jsonData.csr.counter;", + "csrNeed = JSON.parse(environment.counter_id_number);", + "pm.test('CSR counter type is ' + csrType.toString() + '; must be ' + csrNeed.toString(), function() {", + " pm.expect(csrType).to.be.eql(csrNeed);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{nonqtxn_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"counter_id\": {{counter_id_number}}\n}" + }, + "url": { + "raw": "{{url}}csrs/{{current_csr_id}}/", + "host": [ + "{{url}}csrs" + ], + "path": [ + "{{current_csr_id}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Invite next citizen - should be second one (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"nonqtxn_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Should only be inviting one citizen', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 3 (now three periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(3);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Invited\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Invited\");", + " });", + "}", + "", + "// Store the ID of the citizen just invited.", + "postman.setEnvironmentVariable(\"current_client\", JSON.stringify(currentCitizenId));", + "pm.test(\"Stored current_client for later QT7 requests\", function() {", + " pm.expect(postman.getEnvironmentVariable(\"current_client\")).to.not.be.oneOf([null, undefined, \"\"]);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{nonqtxn_token}}" + }, + { + "key": "Content-Type", + "value": "application/json", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/invite/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "invite", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - begin serving (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"nonqtxn_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one citizen being served', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 4 (now four periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(4);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Being Served\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{nonqtxn_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/begin_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "begin_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - finish serving (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"nonqtxn_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be no active citizen being served', function() {", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Complete\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 4 (still four periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(4);", + " });", + " pm.test('There must be no open periods', function() {", + " pm.expect(openPeriodCount).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{nonqtxn_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/finish_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "finish_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Invite next citizen - should be first one (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"nonqtxn_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Should only be inviting one citizen', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 3 (now three periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(3);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Invited\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Invited\");", + " });", + "}", + "", + "// Store the ID of the citizen just invited.", + "postman.setEnvironmentVariable(\"current_client\", JSON.stringify(currentCitizenId));", + "pm.test(\"Stored current_client for later QT7 requests\", function() {", + " pm.expect(postman.getEnvironmentVariable(\"current_client\")).to.not.be.oneOf([null, undefined, \"\"]);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{nonqtxn_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/invite/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "invite", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "First citizen - citizen left (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"nonqtxn_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test(\"Must be no active citizen being served\", function() {", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test(\"Citizen should have one service request\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Complete\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 3 (now three periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(3);", + " });", + " pm.test('There must be no open periods', function() {", + " pm.expect(openPeriodCount).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{nonqtxn_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/citizen_left/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "citizen_left", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Setup Booking", + "item": [ + { + "name": "Setup-Variables", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "// See if the use-prefix global has been set. Use default if not.", + "let usePrefix = '';", + "", + "// Hardcode recurring booking and appointment UUIDs.", + "pm.globals.set('pm_booking_uuid', JSON.stringify(pm.variables.replaceIn('{{$guid}}')));", + "pm.globals.set('pm_appt_uuid', JSON.stringify(pm.variables.replaceIn('{{$guid}}')));", + "", + "if (pm.globals.get('use-prefix')) {", + " console.log(\"==> use-prefix exists\");", + " usePrefix = pm.globals.get('use-prefix');", + " console.log(\" --> Prefix is: \" + usePrefix);", + " ", + " // Set up all globals, using the correct prefix.", + " pm.globals.set('auth_url', pm.globals.get(usePrefix + 'auth_url'));", + " pm.globals.set('realm', pm.globals.get(usePrefix + 'realm'));", + " pm.globals.set('clientid', pm.globals.get(usePrefix + 'clientid'));", + " pm.globals.set('client_secret', pm.globals.get(usePrefix + 'client_secret'));", + " pm.globals.set('url', pm.globals.get(usePrefix + 'url'));", + "", + " pm.globals.set('public_url', pm.globals.get(usePrefix + 'public_url'));", + " pm.globals.set('public_user_id', pm.globals.get(usePrefix + 'public_user_id'));", + " pm.globals.set('public_user_password', pm.globals.get(usePrefix + 'public_user_password'));", + "}", + "else {", + " console.log(\"==> use-prefix does not exist\");", + " console.log(\" --> No default globals set.\");", + "}", + "", + "// If no maximum load time defined, set a default.", + "if (!pm.globals.get('max_load_time')) {", + " console.log(\"==> max_load_time not present, default set.\");", + " pm.globals.set(\"max_load_time\", JSON.stringify(1503));", + "}", + "", + "// If no maximum response defined, set a default.", + "if (!pm.globals.get('max_response_time')) {", + " console.log(\"==> max_response_time not present, default set.\");", + " pm.globals.set(\"max_response_time\", JSON.stringify(15005));", + "}", + "", + "// Display the values of all globals.", + "console.log(\"\");", + "console.log(\"==> Globals are:\");", + "console.log(\" --> auth_url: \" + pm.globals.get(\"auth_url\"));", + "console.log(\" --> realm: \" + pm.globals.get(\"realm\"));", + "console.log(\" --> clientid: \" + pm.globals.get(\"clientid\"));", + "console.log(\" --> client_secret: \" + pm.globals.get(\"client_secret\"));", + "console.log(\" --> url: \" + pm.globals.get(\"url\"));", + "console.log(\" --> max_load_time: \" + pm.globals.get(\"max_load_time\"));", + "console.log(\" --> max_response_time: \" + pm.globals.get(\"max_response_time\"));", + "console.log(\" --> booking_uuid: \" + pm.globals.get(\"pm_booking_uuid\"));", + "console.log(\" --> appointment_uuid: \" + pm.globals.get(\"pm_appt_uuid\"));", + "console.log(\" --> public_url: \" + pm.globals.get(\"public_url\"));", + "console.log(\" --> public_user_id: \" + pm.globals.get(\"public_user_id\"));", + "", + "", + "// Clear run-scoped variables so reruns do not inherit stale state.", + "pm.globals.unset(\"auth_failure_reason\");", + "pm.globals.unset(\"operator_token\");", + "pm.globals.unset(\"operator_refresh_token\");", + "pm.globals.unset(\"nonqtxn_token\");", + "pm.globals.unset(\"nonqtxn_refresh_token\");", + "pm.globals.unset(\"public_user_token\");", + "pm.globals.unset(\"public_user_refresh_token\");", + "pm.globals.unset(\"token\");", + "pm.globals.unset(\"refresh_token\");", + "pm.globals.unset(\"token_expires\");", + "pm.globals.unset(\"refresh_token_expires\");", + "pm.globals.unset(\"expires_in\");", + "pm.globals.unset(\"refresh_expires_in\");", + "pm.environment.unset(\"current_client\");", + "pm.environment.unset(\"first_sr_id\");", + "pm.environment.unset(\"second_sr_id\");", + "pm.environment.unset(\"current_csr_id\");", + "pm.environment.unset(\"current_office_id\");", + "pm.environment.unset(\"current_office_number\");", + "pm.environment.unset(\"counter_id\");", + "pm.environment.unset(\"qtxn_id\");", + "pm.environment.unset(\"channel_telephone_id\");", + "pm.environment.unset(\"channel_email_id\");", + "pm.environment.unset(\"qtxn_id_number\");", + "pm.environment.unset(\"counter_id_number\");", + "pm.environment.unset(\"service_PropTax_id\");", + "pm.environment.unset(\"service_MSP_id\");", + "pm.environment.unset(\"user_id\");", + "pm.environment.unset(\"user_phone\");", + "pm.environment.unset(\"appointment_id\");", + "pm.environment.unset(\"public_office_id\");", + "pm.environment.unset(\"public_office_timezone\");", + "pm.environment.unset(\"public_service_id\");" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Dummy data." + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "Authentication Token", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"auth_url\",\"realm\",\"clientid\",\"userid\",\"password\",\"client_secret\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Parse response body", + "var jsonData = {};", + "try {", + " jsonData = JSON.parse(responseBody);", + "} catch (parseErr) {", + " console.log(\"Authentication response body was not JSON.\");", + " console.log(responseBody);", + " pm.globals.set(\"auth_failure_reason\", \"Non-JSON auth response\");", + " pm.execution.setNextRequest(null);", + " throw parseErr;", + "}", + "", + "var authFailureReason = jsonData.error_description || jsonData.error || (\"HTTP \" + pm.response.code);", + "if (pm.response.code !== 200 || !jsonData.access_token) {", + " console.log(\"Authentication failed for \" + pm.info.requestName + \".\");", + " console.log(responseBody);", + " pm.globals.set(\"auth_failure_reason\", authFailureReason);", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Authentication failed: \" + authFailureReason);", + "}", + "", + "pm.test(\"Response code for request is 200\", function(){", + " pm.expect(pm.response.code).to.eql(200);", + "});", + "pm.test(\"Access token exists\", function(){", + " pm.expect(jsonData).to.have.property(\"access_token\");", + " pm.expect(jsonData.access_token).to.be.a(\"string\").and.not.empty;", + "});", + "pm.test(\"Refresh token exists\", function(){", + " pm.expect(jsonData).to.have.property(\"refresh_token\");", + " pm.expect(jsonData.refresh_token).to.be.a(\"string\").and.not.empty;", + "});", + "pm.test(\"Expires In is present\", function(){", + " pm.expect(jsonData).to.have.property(\"expires_in\");", + " pm.expect(jsonData.expires_in).to.not.eql(null);", + "});", + "pm.test(\"Refresh Expires In is present\", function(){", + " pm.expect(jsonData).to.have.property(\"refresh_expires_in\");", + " pm.expect(jsonData.refresh_expires_in).to.not.eql(null);", + "});", + "", + "pm.globals.unset(\"auth_failure_reason\");", + "pm.globals.set(\"operator_token\", jsonData.access_token);", + "pm.globals.set(\"operator_refresh_token\", jsonData.refresh_token);", + "pm.globals.set(\"token_expires\", Date.now() + (jsonData.expires_in * 1000));", + "pm.globals.set(\"refresh_token_expires\", Date.now() + (jsonData.refresh_expires_in * 1000));", + "pm.globals.set(\"expires_in\", jsonData.expires_in);", + "pm.globals.set(\"refresh_expires_in\", jsonData.refresh_expires_in);", + "pm.globals.set(\"token\", jsonData.access_token);", + "pm.globals.set(\"refresh_token\", jsonData.refresh_token);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/x-www-form-urlencoded", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "grant_type=password&client_id={{clientid}}&username={{userid}}&password={{password}}&client_secret={{client_secret}}" + }, + "url": { + "raw": "{{auth_url}}/auth/realms/{{realm}}/protocol/openid-connect/token?Content-Type=application/x-www-form-urlencoded", + "host": [ + "{{auth_url}}" + ], + "path": [ + "auth", + "realms", + "{{realm}}", + "protocol", + "openid-connect", + "token" + ], + "query": [ + { + "key": "Content-Type", + "value": "application/x-www-form-urlencoded" + } + ] + } + }, + "response": [] + }, + { + "name": "CFMS-Install-Basic-Response-Tests", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"basic_response_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Get the maximum response time allowed.\nmax_response_time = JSON.parse(globals.max_response_time);\n\npm.test('Response time less than ' + max_response_time.toString() + 'ms', function(){\n pm.expect(pm.response.responseTime).to.be.below(max_response_time);\n});\n\nvar contentType = pm.response.headers.get(\"content-type\") || \"\";\n\npm.test(\"Response code for request is 200\", function(){\n pm.expect(pm.response.code).to.eql(200);\n});\npm.test(\"Response header should include Content-Type application/json\", function() {\n pm.expect(contentType.toLowerCase()).to.include(\"application/json\");\n});\npm.test(\"Response body should be valid JSON\", function() {\n pm.expect(function () { pm.response.json(); }).to.not.throw();\n});\n\nif (pm.response.code !== 200) {\n console.log(\"Unexpected status for \" + pm.info.requestName + \": \" + pm.response.code);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected HTTP 200 but received \" + pm.response.code);\n}\n\nif (contentType.toLowerCase().indexOf(\"application/json\") === -1) {\n console.log(\"Unexpected content-type for \" + pm.info.requestName + \": \" + contentType);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected application/json response\");\n}\n\ntry {\n pm.response.json();\n} catch (parseErr) {\n console.log(\"Response body was not valid JSON for \" + pm.info.requestName + \".\");\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw parseErr;\n}" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Exam-Type-Data", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"init_exam_type_data\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Finds an exam name in the JSON list allTypes of exam types.\nfunction find_exam(input_exam_name, allTypes) {\n\texam_id_value = -1;\n\n // Loop to look for the input exam name.\n if (allTypes) {\n allTypes.forEach(function(type) {\n if ((type.exam_type_name) == input_exam_name) {\n exam_id_value = type.exam_type_id;\n }\n });\n }\n \n // If the exam wasn't found, set it to be the first exam.\n if (exam_id_value == -1) {\n exam_id_value = allTypes[0].exam_type_id;\n }\n\n // Return the exam_id_type of the input exam name.\n return exam_id_value;\n}\n\n// Get the list of all possible exam types.\nallTypes = null;\nvar jsonData = JSON.parse(responseBody);\nif (jsonData.hasOwnProperty(\"exam_types\")) {\n\tallTypes = jsonData.exam_types;\n}\n\nexam_array = [];\nexam_array.push({name: \"IPSE - 4HR Single Exam\", weight: 40.2, id: find_exam(\"IPSE - 4HR Single Exam\", allTypes)});\nname = \"IPSE - 4HR Single Exam\";\nexam_array.push({name: name, weight: exam_array[0].weight + 14.5, id: find_exam(name, allTypes)});\nname = \"SLE - 3HR Group Exam\";\nexam_array.push({name: name, weight: exam_array[1].weight + 7.4, id: find_exam(name, allTypes)});\nname = \"COFQ - 3HR Group Exam\";\nexam_array.push({name: name, weight: exam_array[2].weight + 5.8, id: find_exam(name, allTypes)});\nname = \"IPSE - 4HR Group Exam\";\nexam_array.push({name: name, weight: exam_array[3].weight + 5.7, id: find_exam(name, allTypes)});\nname = \"COFQ - 3HR Single Exam\";\nexam_array.push({name: name, weight: exam_array[4].weight + 5.5, id: find_exam(name, allTypes)});\nname = \"Monthly Session Exam\";\nexam_array.push({name: name, weight: exam_array[5].weight + 3.8, id: find_exam(name, allTypes)});\nname = \"SLE - 3HR Single Exam\";\nexam_array.push({name: name, weight: exam_array[6].weight + 3.5, id: find_exam(name, allTypes)});\nname = \"Angling Guide Outfitter\";\nexam_array.push({name: name, weight: exam_array[7].weight + 2.4, id: find_exam(name, allTypes)});\nname = \"IPSE - 5HR Single Exam - Time Extension\";\nexam_array.push({name: name, weight: exam_array[8].weight + 2.3, id: find_exam(name, allTypes)});\nname = \"Exam Booking - 3 Hour Miscellaneous\";\nexam_array.push({name: name, weight: exam_array[9].weight + 1.7, id: find_exam(name, allTypes)});\n\n// Store the initialized exam data for later use.\npostman.setEnvironmentVariable(\"exam_array_data\", JSON.stringify(exam_array));" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Exam-Get-Random", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"create_random_functions\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Function returns a weighted randomized exam type index.\nfunction get_random_index(exam_array) {\n\n // Generate a random number up to the maximum weight allowed.\n random_number = Math.floor(Math.random() * exam_array[exam_array.length - 1].weight);\n \n // Get the index of the exam type corresponding to that weight.\n index = get_index(random_number, exam_array);\n\n // Return the index.\n return index;\n}\n\n// Based on a random number, turns it into a weighted randomized exam type index.\nfunction get_index(random_value, exam_array) {\n index = 0;\n var i;\n for (i = 0; i < exam_array.length; i++) {\n if (random_value <= exam_array[i].weight) {\n index = i;\n break;\n }\n }\n \n return index;\n}\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Room-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"room_schema_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the JSON Schema expected in response\nvar roomSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"rooms\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"capacity\": {\"type\": \"number\"},\n \"color\": {\"type\": \"string\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointment_duration\": {\"type\": [\"null\", \"number\"]},\n \"appointments_days_limit\": {\"type\": [\"null\", \"number\"]},\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"back_office_list\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"actual_service_ind\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\",\n \"external_service_name\", \"online_availability\",\n \"online_link\", \"parent\", \"parent_id\", \"prefix\",\n \"service_code\", \"service_desc\", \"service_id\",\n \"service_name\"]\n },\n },\n \"civic_address\": {\"type\": [\"null\", \"string\"]},\n \"counters\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter_id\": {\"type\": \"number\"},\n \"counter_name\": {\"type\": \"string\"}\n },\n \"required\": [\"counter_id\", \"counter_name\"]\n },\n },\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"latitude\": {\"type\": \"number\"},\n \"longitude\": {\"type\": \"number\"},\n \"max_person_appointment_per_day\": {\"type\": [\"null\", \"number\"]},\n \"office_appointment_message\": {\"type\": [\"null\", \"string\"]},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"online_status\": {\"type\": \"string\"},\n \"quick_list\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"actual_service_ind\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\",\n \"external_service_name\", \"online_availability\",\n \"online_link\", \"parent\", \"parent_id\", \"prefix\",\n \"service_code\", \"service_desc\", \"service_id\",\n \"service_name\"]\n },\n },\n \"sb\": {\n \"type\": \"object\",\n \"properties\": {\n \"sb_id\": {\"type\": \"number\"},\n \"sb_type\": {\"type\": \"string\"}\n },\n \"required\": [\"sb_id\", \"sb_type\"]\n },\n \"sb_id\": {\"type\": \"number\"},\n \"telephone\": {\"type\": [\"null\", \"string\"]},\n \"timeslots\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"day_of_week\": {\"type\": [\"null\", \"array\"]},\n \"end_time\": {\"type\": \"string\"},\n \"no_of_slots\": {\"type\": \"number\"},\n \"office\": {\"type\": [\"null\", \"number\"]},\n \"start_time\": {\"type\": \"string\"}\n },\n \"required\": [\"day_of_week\", \"end_time\", \"no_of_slots\",\n \"office\", \"start_time\"]\n },\n },\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n }\n },\n \"required\": [\"appointment_duration\", \"appointments_days_limit\",\n \"appointments_enabled_ind\", \"back_office_list\", \"civic_address\",\n \"counters\", \"exams_enabled_ind\", \"latitude\",\n \"longitude\", \"max_person_appointment_per_day\",\n \"office_appointment_message\", \"office_id\", \"office_name\",\n \"office_number\", \"online_status\", \"quick_list\", \"sb\", \"sb_id\",\n \"telephone\", \"timeslots\", \"timezone\"]\n },\n \"room_id\": {\"type\": \"number\"},\n \"room_name\": {\"type\": \"string\"}\n },\n \"required\": [\"capacity\", \"color\", \"deleted\", \"office\", \"room_id\", \"room_name\"]\n }\n },\n \"errors\": {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"rooms\", \"errors\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Room Schema\", function(){\n pm.expect(tv4.validate(jsonData, roomSchema)).to.be.true;\n});\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Exam-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"exam_schema_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the JSON Schema expected in response\nvar examSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"exam\": {\n \"type\": \"object\",\n \"properties\": {\n \"exam_type\": {\n \"type\": \"object\",\n \"properties\": {\n \"exam_color\": {\"type\": \"string\"},\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_type_name\": {\"type\": \"string\"},\n \"group_exam_ind\": {\"type\": \"number\"},\n \"ita_ind\": {\"type\": \"number\"},\n \"method_type\": {\"type\": \"string\"},\n \"number_of_hours\": {\"type\": \"number\"},\n \"number_of_minutes\": {\"type\": [\"number\", \"null\"]},\n \"pesticide_exam_ind\": {\"type\": \"number\" }\n },\n \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"group_exam_ind\", \"ita_ind\",\n \"method_type\", \"number_of_hours\", \"number_of_minutes\", \"pesticide_exam_ind\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"exam_type_id\": {\"type\": \"number\"},\n \"notes\": {\"type\": \"string\"},\n \"exam_written_ind\": {\"type\": \"number\"},\n \"examinee_email\": {\"type\": [\"null\", \"string\"]},\n \"exam_destroyed_date\": {\"type\": [\"null\", \"string\"]},\n \"receipt\": {\"type\": [\"null\", \"number\", \"string\"]},\n \"session_number\": {\"type\": [\"number\", \"null\"]},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n }\n },\n \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\",\n \"office_number\", \"timezone\"]\n },\n \"exam_id\": {\"type\": \"number\"},\n \"bcmp_job_id\": {\"type\": [\"null\", \"number\"]},\n \"expiry_date\": {\"type\": [\"string\", \"null\"]},\n \"sbc_managed_ind\": {\"type\": \"number\"},\n \"invigilator_id\": {\"type\": [\"null\", \"number\"]},\n \"examinee_phone\": {\"type\": [\"null\", \"string\"]},\n \"upload_received_ind\": {\"type\": \"number\"},\n \"booking_id\": {\"type\": [\"null\", \"number\"]},\n \"booking\": {\"type\": [\"null\", \"object\"]},\n \"invigilator\": {\"type\": [\"null\", \"object\"]},\n \"is_pesticide\": {\"type\": \"number\"},\n \"exam_returned_date\": {\"type\": [\"null\", \"string\"]},\n \"payee_email\": {\"type\": [\"null\", \"string\"]},\n \"candidates_list\": {\"type\": [\"null\", \"array\", \"object\"]},\n \"exam_returned_tracking_number\": {\"type\": [\"null\", \"string\"]},\n \"payee_name\": {\"type\": [\"null\", \"string\"]},\n \"deleted_date\": {\"type\": [\"null\", \"string\"]},\n \"payee_phone\": {\"type\": [\"null\", \"string\"]},\n \"event_id\": {\"type\": \"string\"},\n \"payee_ind\": {\"type\": \"number\"},\n \"exam_received_date\": {\"type\": [\"null\", \"string\"]},\n \"number_of_students\": {\"type\": \"number\"},\n \"exam_method\": {\"type\": \"string\"},\n \"offsite_location\": {\"type\": [\"null\", \"string\"]},\n \"exam_name\": {\"type\": \"string\"},\n \"examinee_name\": {\"type\": \"string\"},\n \"receipt_sent_ind\": {\"type\": \"number\"}\n },\n \"required\": [\"exam_type\", \"office_id\", \"exam_type_id\", \"notes\", \"exam_written_ind\", \"examinee_email\", \"exam_destroyed_date\", \"receipt\",\n \"session_number\", \"office\", \"exam_id\", \"bcmp_job_id\", \"expiry_date\", \"sbc_managed_ind\", \"invigilator_id\", \"examinee_phone\",\n \"upload_received_ind\", \"booking_id\", \"booking\", \"invigilator\", \"is_pesticide\", \"exam_returned_date\", \"payee_email\",\n \"candidates_list\", \"exam_returned_tracking_number\", \"payee_name\", \"deleted_date\", \"payee_phone\", \"event_id\", \"payee_ind\",\n \"exam_received_date\", \"number_of_students\", \"exam_method\", \"offsite_location\", \"exam_name\", \"examinee_name\", \"receipt_sent_ind\"]\n },\n \"errors\": {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"exam\", \"errors\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Exam Schema\", function(){\n pm.expect(tv4.validate(jsonData, examSchema)).to.be.true;\n});\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Exam-Data-Check", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"exam_data_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Make sure that jsonData has an exam property.\npm.test(\"Response should have exam property\", function(){\n pm.expect(jsonData.hasOwnProperty(\"exam\")).to.be.true;\n});\n\n// If jsonData has exam property, check data.\nif (jsonData.hasOwnProperty(\"exam\")) {\n\n //Test to see if Event ID field remains unchanged\n pm.test(\"Validate Event Id has expected value\", function(){\n pm.expect(jsonData.event_id === environment.event_id);\n });\n\n //Test to see if exam method field remains unchanged\n pm.test(\"Validate exam method has expected value\", function(){\n pm.expect(jsonData.exam_method === environment.exam_method);\n });\n\n //Test to see if exam name field remains unchanged\n pm.test(\"Validate exam name has expected value\", function(){\n pm.expect(jsonData.exam_name === environment.exam_name);\n });\n\n //Test to see if exam type field remains unchanged\n pm.test(\"Validate exam type id has expected value\", function(){\n pm.expect(jsonData.exam_type_id === environment.random_exam_type_id);\n });\n\n //Test to see if exam written indicator field remains unchanged\n pm.test(\"Validate exam written indicator has expected value\", function(){\n pm.expect(jsonData.exam_written_ind === environment.exam_written_ind);\n });\n\n //Test to see if examinee name field remains unchanged\n pm.test(\"Validate examinee name has expected value\", function(){\n pm.expect(jsonData.examinee_name === environment.examinee_name);\n });\n\n //Test to see if notes field remains unchanged\n pm.test(\"Validate notes has expected value\", function(){\n pm.expect(jsonData.notes === environment.notes);\n });\n\n //Test to see if number of students field remains unchanged\n pm.test(\"Validate number of students has expected value\", function(){\n pm.expect(jsonData.number_of_students === environment.number_of_students);\n });\n\n //Test to see if office id remains unchanged\n pm.test(\"Validate office id has expected value\", function(){\n pm.expect(jsonData.office_id === environment.current_office_id);\n });\n\n //Test to see if offsite location is expected\n pm.test(\"Validate offsite location has expected value\", function(){\n pm.expect(jsonData.offsite_location === environment.offsite_location);\n });\n}\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Exam-List-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"exam_schema_list_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the JSON Schema expected in response\nvar examSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"exams\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"exam_type\": {\n \"type\": \"object\",\n \"properties\": {\n \"exam_color\": {\"type\": \"string\"},\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_type_name\": {\"type\": \"string\"},\n \"group_exam_ind\": {\"type\": \"number\"},\n \"ita_ind\": {\"type\": \"number\"},\n \"method_type\": {\"type\": \"string\"},\n \"number_of_hours\": {\"type\": \"number\"},\n \"number_of_minutes\": {\"type\": [\"number\", \"null\"]},\n \"pesticide_exam_ind\": {\"type\": \"number\" }\n },\n \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"group_exam_ind\", \"ita_ind\",\n \"method_type\", \"number_of_hours\", \"number_of_minutes\", \"pesticide_exam_ind\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"exam_type_id\": {\"type\": \"number\"},\n \"notes\": {\"type\": [\"null\", \"string\"]},\n \"exam_written_ind\": {\"type\": \"number\"},\n \"examinee_email\": {\"type\": [\"null\", \"string\"]},\n \"exam_destroyed_date\": {\"type\": [\"null\", \"string\"]},\n \"receipt\": {\"type\": [\"null\", \"string\"]},\n \"session_number\": {\"type\": [\"number\", \"null\", \"string\"]},\n \"exam_id\": {\"type\": \"number\"},\n \"expiry_date\": {\"type\": [\"string\", \"null\"]},\n \"sbc_managed_ind\": {\"type\": \"number\"},\n \"invigilator_id\": {\"type\": [\"null\", \"number\"]},\n \"examinee_phone\": {\"type\": [\"null\", \"string\"]},\n \"upload_received_ind\": {\"type\": \"number\"},\n \"booking_id\": {\"type\": [\"null\", \"number\"]},\n \"booking\": {\"type\": [\"null\", \"object\"]},\n \"examinee_name\": {\"type\": [\"null\", \"string\"]},\n \"invigilator\": {\"type\": [\"null\", \"object\"]},\n \"is_pesticide\": {\"type\": \"number\"},\n \"exam_returned_date\": {\"type\": [\"null\", \"string\"]},\n \"payee_email\": {\"type\": [\"null\", \"string\"]},\n \"candidates_list\": {\"type\": [\"null\", \"array\", \"object\"]},\n \"exam_returned_tracking_number\": {\"type\": [\"null\", \"string\"]},\n \"payee_name\": {\"type\": [\"null\", \"string\"]},\n \"deleted_date\": {\"type\": [\"null\", \"string\"]},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n },\n },\n \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"timezone\"]\n },\n \"payee_phone\": {\"type\": [\"null\", \"string\"]},\n \"event_id\": {\"type\": [\"null\", \"string\"]},\n \"payee_ind\": {\"type\": \"number\"},\n \"exam_received_date\": {\"type\": [\"null\", \"string\"]},\n \"number_of_students\": {\"type\": [\"null\", \"number\"]},\n \"exam_method\": {\"type\": \"string\"},\n \"offsite_location\": {\"type\": [\"null\", \"string\"]},\n \"receipt_sent_ind\": {\"type\": \"number\"},\n \"exam_name\": {\"type\": \"string\"},\n \"bcmp_job_id\": {\"type\": [\"null\", \"string\"]}\n },\n \"required\": [\"exam_type\", \"office_id\", \"exam_type_id\", \"notes\", \"exam_written_ind\", \"examinee_email\", \"exam_destroyed_date\",\n \"receipt\", \"session_number\", \"exam_id\", \"expiry_date\", \"sbc_managed_ind\", \"invigilator_id\",\n \"examinee_phone\", \"upload_received_ind\", \"booking_id\", \"booking\", \"examinee_name\", \"invigilator\",\n \"is_pesticide\", \"exam_returned_date\", \"payee_email\", \"candidates_list\", \"exam_returned_tracking_number\",\n \"payee_name\", \"deleted_date\", \"office\", \"payee_phone\", \"event_id\", \"payee_ind\", \"exam_received_date\",\n \"number_of_students\", \"exam_method\", \"offsite_location\", \"receipt_sent_ind\", \"exam_name\", \"bcmp_job_id\"]\n },\n },\n \"errors\": {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"exams\", \"errors\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Exam List Schema\", function(){\n pm.expect(tv4.validate(jsonData, examSchema)).to.be.true;\n});\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Booking-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"booking_schema_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the JSON Schema expected in response\nvar bookingSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"booking\": {\n \"type\": \"object\",\n \"properties\": {\n \"blackout_flag\": {\"type\": \"string\"},\n \"blackout_notes\": {\"type\": [\"string\", \"null\"]},\n \"booking_contact_information\": {\"type\": [\"string\", \"null\"]},\n \"booking_id\": {\"type\": \"number\"},\n \"booking_name\": {\"type\": [\"string\", \"null\"]},\n \"end_time\": {\"type\": \"string\"},\n \"fees\": {\"type\": \"string\"},\n \"invigilators\": {\"type\": \"array\"},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n }\n },\n \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"timezone\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"recurring_uuid\": {\"type\": [\"string\", \"null\"]},\n \"room\": {\n \"type\": \"object\",\n \"properties\": {\n \"capacity\": {\"type\": \"number\"},\n \"color\": {\"type\": \"string\"},\n \"deleted\": {\"type\": [\"string\", \"null\"]},\n \"room_id\": {\"type\": \"number\"},\n \"room_name\": {\"type\": \"string\"}\n },\n \"required\": [\"capacity\", \"color\", \"room_id\", \"room_name\", \"deleted\"]\n },\n \"room_id\": {\"type\": \"number\"},\n \"sbc_staff_invigilated\": {\"type\": \"number\"},\n \"shadow_invigilator_id\": {\"type\": [\"number\", \"null\"]},\n \"start_time\": {\"type\": \"string\"}\n },\n \"required\": [\"blackout_flag\", \"blackout_notes\", \"booking_contact_information\", \"booking_id\",\n \"booking_name\", \"end_time\", \"fees\", \"invigilators\", \"office\", \"office_id\",\n \"recurring_uuid\", \"room\", \"room_id\", \"sbc_staff_invigilated\", \"shadow_invigilator_id\",\n \"start_time\"]\n },\n \"errors\": { \"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"booking\", \"errors\"]\n}\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Booking Schema\", function(){\n pm.expect(tv4.validate(jsonData, bookingSchema)).to.be.true;\n});\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Booking-Data-Check", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"booking_data_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Make sure that jsonData has an booking property.\npm.test(\"Response should have booking property\", function(){\n pm.expect(jsonData.hasOwnProperty(\"booking\")).to.be.true;\n});\n\n// If jsonData has booking property, check data.\nif (jsonData.hasOwnProperty(\"booking\")) {\n\n //Test to see if booking name has expected value\n pm.test(\"Validate Booking Name has expected value\", function(){\n pm.expect(jsonData.booking_name === environment.booking_name);\n });\n\n //Test to see if start time has expected value\n pm.test(\"Validate start time has expected value\", function(){\n pm.expect(jsonData.start_time === environment.start_time);\n });\n\n //Test to see if end time has expected value\n pm.test(\"Validate end time has expected value\", function(){\n pm.expect(jsonData.end_time === environment.end_time);\n });\n\n //Test to see if room id has expected value\n pm.test(\"Validate room id has expected value\", function(){\n pm.expect(jsonData.room_id === environment.room_id_1);\n });\n\n //Test to see if fees field has expected value\n pm.test(\"Validate fees has expected value\", function(){\n pm.expect(jsonData.fees === environment.fees);\n });\n\n //Test to see if office id field has expected value\n pm.test(\"Validate office id has expected value\", function(){\n pm.expect(jsonData.office_id === environment.current_office_id);\n });\n}\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Booking-List-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"booking_list_schema_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "var bookingSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"bookings\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"booking_name\": {\"type\": \"string\"},\n \"blackout_flag\": {\"type\": \"string\"},\n \"sbc_staff_invigilated\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"room_id\": {\"type\": [\"null\", \"number\"]},\n \"blackout_notes\": {\"type\": [\"null\", \"string\"]},\n \"shadow_invigilator_id\": {\"type\": [\"null\", \"number\"]},\n \"room\": {\n \"type\": [\"null\", \"object\"],\n \"properties\": {\n \"capacity\": {\"type\": \"number\"},\n \"color\": {\"type\": \"string\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"room_id\": {\"type\": \"number\"},\n \"room_name\": {\"type\": \"string\"}\n },\n \"required\": [\"capacity\", \"color\", \"deleted\", \"room_id\", \"room_name\"]\n },\n \"booking_id\": {\"type\": \"number\"},\n \"end_time\": {\"type\": \"string\"},\n \"booking_contact_information\": {\"type\": [\"null\", \"string\"]},\n \"recurring_uuid\": {\"type\": [\"null\", \"string\"]},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n }\n },\n \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"timezone\"]\n },\n \"invigilators\": {\"type\": \"array\"},\n \"fees\": {\"type\": [\"null\", \"string\"]},\n \"start_time\": {\"type\": \"string\"},\n },\n \"required\": [\"booking_name\", \"blackout_flag\", \"sbc_staff_invigilated\", \"office_id\", \"room_id\", \"blackout_notes\",\n \"shadow_invigilator_id\", \"room\", \"booking_id\", \"end_time\", \"booking_contact_information\", \"recurring_uuid\",\n \"office\", \"invigilators\", \"fees\", \"start_time\"]\n },\n },\n \"errors\": {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"bookings\", \"errors\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Booking List Schema\", function(){\n pm.expect(tv4.validate(jsonData, bookingSchema)).to.be.true;\n});" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Invigilator-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"invigilator_schema_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the JSON Schema expected in response\nvar invigilatorSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"invigilators\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"contact_email\": {\"type\": \"string\"},\n \"contact_phone\": {\"type\": \"string\"},\n \"contract_expiry_date\": {\"type\": \"string\"},\n \"contract_number\": {\"type\": \"string\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"invigilator_id\": {\"type\": \"number\"},\n \"invigilator_name\": {\"type\": \"string\"},\n \"invigilator_notes\": {\"type\": [\"null\", \"string\"]},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointment_duration\": {\"type\": [\"null\", \"number\"]},\n \"appointments_days_limit\": {\"type\": [\"null\", \"number\"]},\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"back_office_list\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"actual_service_ind\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\",\n \"external_service_name\", \"online_availability\",\n \"online_link\", \"parent\", \"parent_id\", \"prefix\",\n \"service_code\", \"service_desc\", \"service_id\",\n \"service_name\"]\n },\n },\n \"civic_address\": {\"type\": [\"null\", \"string\"]},\n \"counters\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter_id\": {\"type\": \"number\"},\n \"counter_name\": {\"type\": \"string\"}\n },\n \"required\": [\"counter_id\", \"counter_name\"]\n },\n },\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"latitude\": {\"type\": [\"null\", \"number\"]},\n \"longitude\": {\"type\": [\"null\", \"number\"]},\n \"max_person_appointment_per_day\": {\"type\": [\"null\", \"number\"]},\n \"office_appointment_message\": {\"type\": [\"null\", \"string\"]},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"online_status\": {\"type\": \"string\"},\n \"quick_list\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"actual_service_ind\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\",\n \"external_service_name\", \"online_availability\",\n \"online_link\", \"parent\", \"parent_id\", \"prefix\",\n \"service_code\", \"service_desc\", \"service_id\",\n \"service_name\"]\n },\n },\n \"sb\": {\n \"type\": \"object\",\n \"properties\": {\n \"sb_id\": {\"type\": \"number\"},\n \"sb_type\": {\"type\": \"string\"}\n },\n \"required\": [\"sb_id\", \"sb_type\"]\n },\n \"sb_id\": {\"type\": \"number\"},\n \"telephone\": {\"type\": [\"null\", \"string\"]},\n \"timeslots\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"day_of_week\": {\"type\": [\"null\", \"array\"]},\n \"end_time\": {\"type\": \"string\"},\n \"no_of_slots\": {\"type\": \"number\"},\n \"office\": {\"type\": [\"null\", \"number\"]},\n \"start_time\": {\"type\": \"string\"}\n },\n \"required\": [\"day_of_week\", \"end_time\", \"no_of_slots\",\n \"office\", \"start_time\"]\n },\n },\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n }\n },\n \"required\": [\"appointment_duration\", \"appointments_days_limit\",\n \"appointments_enabled_ind\", \"back_office_list\", \"civic_address\",\n \"counters\", \"exams_enabled_ind\", \"latitude\",\n \"longitude\", \"max_person_appointment_per_day\",\n \"office_appointment_message\", \"office_id\", \"office_name\",\n \"office_number\", \"online_status\", \"quick_list\", \"sb\", \"sb_id\",\n \"telephone\", \"timeslots\", \"timezone\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"shadow_count\": {\"type\": \"number\"},\n \"shadow_flag\": {\"type\": \"string\"}\n },\n \"required\": [\"contact_email\", \"contact_phone\", \"contract_expiry_date\", \"contract_number\",\n \"deleted\", \"invigilator_id\", \"invigilator_name\", \"invigilator_notes\",\n \"office\", \"office_id\", \"shadow_count\", \"shadow_flag\"]\n }\n },\n \"errors\": {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"invigilators\", \"errors\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Invigilator Response Schema\", function(){\n pm.expect(tv4.validate(jsonData, invigilatorSchema)).to.be.true;\n});" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Invig-One-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"invig_one_schema_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the JSON Schema expected in response\nvar invigilatorSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"invigilator\": {\n \"type\": \"object\",\n \"properties\": {\n \"contact_email\": {\"type\": \"string\"},\n \"contact_phone\": {\"type\": \"string\"},\n \"contract_expiry_date\": {\"type\": \"string\"},\n \"contract_number\": {\"type\": \"string\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"invigilator_id\": {\"type\": \"number\"},\n \"invigilator_name\": {\"type\": \"string\"},\n \"invigilator_notes\": {\"type\": \"string\"},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointment_duration\": {\"type\": [\"null\", \"number\"]},\n \"appointments_days_limit\": {\"type\": [\"null\", \"number\"]},\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"back_office_list\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"actual_service_ind\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\",\n \"external_service_name\", \"online_availability\",\n \"online_link\", \"parent\", \"parent_id\", \"prefix\",\n \"service_code\", \"service_desc\", \"service_id\",\n \"service_name\"]\n },\n },\n \"civic_address\": {\"type\": [\"null\", \"string\"]},\n \"counters\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"counter_id\": {\"type\": \"number\"},\n \"counter_name\": {\"type\": \"string\"}\n },\n \"required\": [\"counter_id\", \"counter_name\"]\n },\n },\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"latitude\": {\"type\": [\"null\", \"number\"]},\n \"longitude\": {\"type\": [\"null\", \"number\"]},\n \"max_person_appointment_per_day\": {\"type\": [\"null\", \"number\"]},\n \"office_appointment_message\": {\"type\": [\"null\", \"string\"]},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"online_status\": {\"type\": \"string\"},\n \"quick_list\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"actual_service_ind\": {\"type\": \"number\"},\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\",\n \"external_service_name\", \"online_availability\",\n \"online_link\", \"parent\", \"parent_id\", \"prefix\",\n \"service_code\", \"service_desc\", \"service_id\",\n \"service_name\"]\n },\n },\n \"sb\": {\n \"type\": \"object\",\n \"properties\": {\n \"sb_id\": {\"type\": \"number\"},\n \"sb_type\": {\"type\": \"string\"}\n },\n \"required\": [\"sb_id\", \"sb_type\"]\n },\n \"sb_id\": {\"type\": \"number\"},\n \"telephone\": {\"type\": [\"null\", \"string\"]},\n \"timeslots\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"day_of_week\": {\"type\": [\"null\", \"array\"]},\n \"end_time\": {\"type\": \"string\"},\n \"no_of_slots\": {\"type\": \"number\"},\n \"office\": {\"type\": [\"null\", \"number\"]},\n \"start_time\": {\"type\": \"string\"}\n },\n \"required\": [\"day_of_week\", \"end_time\", \"no_of_slots\",\n \"office\", \"start_time\"]\n },\n },\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n }\n },\n \"required\": [\"appointment_duration\", \"appointments_days_limit\",\n \"appointments_enabled_ind\", \"back_office_list\", \"civic_address\",\n \"counters\", \"exams_enabled_ind\", \"latitude\",\n \"longitude\", \"max_person_appointment_per_day\",\n \"office_appointment_message\", \"office_id\", \"office_name\",\n \"office_number\", \"online_status\", \"quick_list\", \"sb\", \"sb_id\",\n \"telephone\", \"timeslots\", \"timezone\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"shadow_count\": {\"type\": \"number\"},\n \"shadow_flag\": {\"type\": \"string\"}\n },\n \"required\": [\"contact_email\", \"contact_phone\", \"contract_expiry_date\", \"contract_number\",\n \"deleted\", \"invigilator_id\", \"invigilator_name\", \"invigilator_notes\",\n \"office\", \"office_id\", \"shadow_count\", \"shadow_flag\"]\n },\n \"errors\": {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"invigilator\", \"errors\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Invigilator Response Schema\", function(){\n pm.expect(tv4.validate(jsonData, invigilatorSchema)).to.be.true;\n});" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Appointment-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"appointment_schema_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the JSON Schema expected in response\nvar appointmentSchema = {\n \"type\": \"object\", \n \"properties\": {\n \"appointment\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointment_id\": {\"type\": \"number\"},\n \"checked_in_time\": {\"type\": [\"string\", \"null\"]},\n \"citizen_name\": {\"type\": \"string\"},\n \"comments\": {\"type\": \"string\"},\n \"contact_information\": {\"type\": [\"string\", \"null\"]},\n \"end_time\": {\"type\": \"string\"},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n },\n },\n \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"timezone\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"service_id\": {\"type\": [\"null\", \"number\"]},\n \"start_time\": {\"type\": \"string\"},\n \"blackout_flag\": {\"type\": \"string\"},\n \"citizen_id\": {\"type\": \"number\"},\n \"online_flag\": {\"type\": \"boolean\"},\n \"recurring_uuid\": {\"type\": [\"null\", \"string\"]},\n \"services\": {\n \"type\": \"object\",\n \"properties\": {\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"timeslot_duration\": {\"type\": [\"null\", \"number\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"service_name\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"actual_service_ind\": {\"type\": \"number\"},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]}\n },\n \"required\": [\"deleted\", \"display_dashboard_ind\", \"timeslot_duration\", \"parent\",\n \"service_name\", \"service_code\", \"actual_service_ind\", \"online_link\",\n \"service_desc\", \"service_id\", \"parent_id\", \"prefix\", \"online_availability\",\n \"external_service_name\"]\n }\n },\n \"required\": [\"appointment_id\", \"checked_in_time\", \"citizen_name\", \"comments\",\n \"contact_information\", \"end_time\", \"office\", \"office_id\", \"service_id\",\n \"start_time\", \"blackout_flag\", \"citizen_id\", \"online_flag\",\n \"recurring_uuid\", \"service\"],\n },\n \"errors\": {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"appointment\", \"errors\"],\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Appointments Schema\", function(){\n pm.expect(tv4.validate(jsonData, appointmentSchema)).to.be.true;\n});\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Appointment-Data-Check", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"appointment_data_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Make sure that jsonData has an appointment property.\npm.test(\"Response should have appointment property\", function(){\n pm.expect(jsonData.hasOwnProperty(\"appointment\")).to.be.true;\n});\n\nvar name = jsonData.appointment.citizen_name;\nvar comments = jsonData.appointment.comments;\nvar contact = jsonData.appointment.contact_information;\nvar name_expect = JSON.parse(pm.globals.get(\"appt_citizen_name\"));\nvar comments_expect = JSON.parse(pm.globals.get(\"appt_comments\"));\nvar contact_expect = JSON.parse(pm.globals.get(\"appt_contact_information\"));\n\n// If jsonData has booking property, check data.\nif (jsonData.hasOwnProperty(\"appointment\")) {\n\n //Test to see if service id has expected value\n pm.test(\"Validate Service ID has expected value\", function(){\n pm.expect(jsonData.service_id === environment.service_id);\n });\n\n //Test to see if office id has expected value\n pm.test(\"Validate office id has expected value\", function(){\n pm.expect(jsonData.office_id === environment.current_office_id);\n });\n\n //Test to see if start time has expected value\n pm.test(\"Validate start time has expected value\", function(){\n pm.expect(jsonData.start_time === environment.start_time);\n });\n\n //Test to see if end time has expected value\n pm.test(\"Validate end time has expected value\", function(){\n pm.expect(jsonData.end_time === environment.end_time);\n });\n\n //Test to see if category has expected value\n pm.test(\"Validate category has expected value\", function(){\n pm.expect(jsonData.category === environment.category);\n });\n\n //Test to see if citizen name field has expected value\n pm.test(\"Name should be '\" + name_expect + \"', it is '\" + name + \"'\", function(){\n pm.expect(name).to.be.eql(name_expect);\n });\n //Test to see if comments field has expected value\n pm.test(\"Comments should be '\" + comments_expect + \"'; it is '\" + comments +\"'\", function(){\n pm.expect(comments).to.be.eql(comments_expect);\n });\n //Test to see if contact info field has expected value\n pm.test(\"Contact should be '\" + contact_expect + \"'; it is '\" + contact +\"'\", function(){\n pm.expect(contact).to.be.eql(contact_expect);\n });\n};\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Appointment-List-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"appointment_list_schema_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the JSON Schema expected in response\nvar appointmentSchema = {\n \"type\": \"object\", \n \"properties\": {\n \"appointments\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointment_id\": {\"type\": \"number\"},\n \"checked_in_time\": {\"type\": [\"string\", \"null\"]},\n \"citizen_name\": {\"type\": \"string\"},\n \"comments\": {\"type\": [\"null\", \"string\"]},\n \"contact_information\": {\"type\": [\"null\", \"string\"]},\n \"end_time\": {\"type\": \"string\"},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n },\n },\n \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"timezone\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"service_id\": {\"type\": [\"null\", \"number\"]},\n \"start_time\": {\"type\": \"string\"},\n \"blackout_flag\": {\"type\": \"string\"},\n \"citizen_id\": {\"type\": \"number\"},\n \"online_flag\": {\"type\": \"boolean\"},\n \"recurring_uuid\": {\"type\": [\"null\", \"string\"]},\n \"services\": {\n \"type\": \"object\",\n \"properties\": {\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"timeslot_duration\": {\"type\": [\"null\", \"number\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"service_name\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"actual_service_ind\": {\"type\": \"number\"},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]}\n },\n \"required\": [\"deleted\", \"display_dashboard_ind\", \"timeslot_duration\", \"parent\",\n \"service_name\", \"service_code\", \"actual_service_ind\", \"online_link\",\n \"service_desc\", \"service_id\", \"parent_id\", \"prefix\", \"online_availability\",\n \"external_service_name\"]\n },\n },\n \"required\": [\"appointment_id\", \"checked_in_time\", \"citizen_name\", \"comments\",\n \"contact_information\", \"end_time\", \"office\", \"office_id\",\n \"service_id\", \"start_time\", \"blackout_flag\", \"citizen_id\",\n \"online_flag\", \"recurring_uuid\", \"service\"]\n }\n },\n \"errors\": {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"appointments\"],\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Appointment List Schema\", function(){\n pm.expect(tv4.validate(jsonData, appointmentSchema)).to.be.true;\n});\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "Who am I TheQ", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Make sure the CSR schema is OK.", + "eval(environment.csr_schema_check)", + "", + "//var jsonData = pm.response.json();", + "//pm.environment.set(\"csr_schema_check\", jsonData.data);", + "", + "if (jsonData.hasOwnProperty(\"csr\")) {", + "\tcurrentOfficeId = jsonData.csr.office_id;", + "\tcurrentOfficeNumber = jsonData.csr.office.office_number;", + "\tcurrentCsrId = jsonData.csr.csr_id;", + " postman.setEnvironmentVariable(\"current_office_id\", currentOfficeId);", + " postman.setEnvironmentVariable(\"current_office_number\", currentOfficeNumber);", + " postman.setEnvironmentVariable(\"current_csr_id\", currentCsrId);", + "};", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}csrs/me/", + "host": [ + "{{url}}csrs" + ], + "path": [ + "me", + "" + ] + } + }, + "response": [] + }, + { + "name": "Get Room IDs", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.room_schema_check);", + "", + "if (jsonData.hasOwnProperty(\"rooms\")) {", + " room_id_1 = jsonData.rooms[0].room_id;", + " room_id_2 = room_id_1;", + " if (jsonData.rooms.length > 1) {", + " room_id_2 = jsonData.rooms[1].room_id;", + " }", + " postman.setEnvironmentVariable(\"room_id_1\", JSON.stringify(room_id_1.toString()));", + " postman.setEnvironmentVariable(\"room_id_2\", JSON.stringify(room_id_2.toString()));", + "}", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}rooms/", + "host": [ + "{{url}}rooms" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Get Service IDs", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data, check the schema.", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.service_schema_check);", + "", + "// Loop to validate schema of each channel.", + "var allElements = jsonData.services;", + "var elementCount = 0;", + "var elementMax = Math.min(10, allElements.length);", + "//allElements.forEach(function(element) {", + "for (var currentElement = 0; currentElement < elementMax; currentElement++) {", + " element = allElements[currentElement];", + " elementCount ++;", + " var testTitle = \"Service (\" + elementCount + \"): \" + element.service_name;", + " ", + " // Test the authenticate response.", + " pm.test(\"--> \" + testTitle + \" dashboard_ind must be 0 or 1\", function() {", + " pm.expect(element.display_dashboard_ind).to.be.within(0,1);", + " });", + " pm.test(\"--> \" + testTitle + \" actual_service_ind must be 1\", function() {", + " pm.expect(element.actual_service_ind).to.be.eql(1);", + " });", + " pm.test(\"--> \" + testTitle + \" parent_id must not be null\", function() {", + " pm.expect(element.parent_id).to.not.be.null;", + " });", + "}", + "", + "// Declare and initialize variables.", + "var mspId = 0;", + "var taxId = 0;", + "var mspText = \"Payment - MSP\";", + "var propTaxText = \"Other - Rural PTAX\";", + "", + "// Look for the MSP and Property Tax IDs.", + "allElements.forEach(function(element) {", + " if (element.service_name === mspText) {", + " mspId = element.service_id;", + " }", + " if (element.service_name === propTaxText) {", + " taxId = element.service_id;", + " }", + "});", + "", + "// Check that you found the service IDs.", + "pm.test(\"The \" + mspText + \" service ID (\" + mspId.toString() + \") should not equal 0\", function() {", + " pm.expect(mspId).to.not.be.eql(0);", + "});", + "", + "pm.test(\"The \" + propTaxText + \" service ID (\" + taxId.toString() + \") should not equal 0\", function() {", + " pm.expect(taxId).to.not.be.eql(0);", + "});", + "", + "// Store these IDs for future use.", + "postman.setEnvironmentVariable(\"service_MSP_id\", JSON.stringify(mspId));", + "postman.setEnvironmentVariable(\"service_PropTax_id\", JSON.stringify(taxId));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + } + ], + "url": { + "raw": "{{url}}services/", + "host": [ + "{{url}}services" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Check app health", + "item": [ + { + "name": "Check healthz driver Booking", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Set health response time variable.", + "max_response_time = 1500;", + "health_tries = 15;", + "counter = 1;", + "postman.setEnvironmentVariable(\"max_response_time\", JSON.stringify(max_response_time));", + "postman.setEnvironmentVariable(\"health_tries\", JSON.stringify(health_tries));", + "postman.setEnvironmentVariable(\"health_counter\", JSON.stringify(counter));", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "// Test the health response.", + "pm.test(\"Response should have 'message' property\", function() {", + " pm.expect(jsonData).to.have.property('message');", + "});", + "", + "pm.test(\"Response message should be 'api is health'\", function() {", + " pm.expect(jsonData.message).to.be.eql('api is healthy');", + "});", + "", + "// If response time is OK, proceed to the next test.", + "if (pm.response.responseTime < max_response_time) {", + " postman.setNextRequest(\"Check the readyz endpoint Booking\");", + "}", + " ", + "// Response time is too long. Try again, give pod a chance to spin up.", + "else {", + " postman.setNextRequest(\"Check the healthz endpoint Booking\");", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}healthz/", + "host": [ + "{{url}}healthz" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Check the healthz endpoint Booking", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Get the maximum response time allowed.", + "max_load_time = JSON.parse(globals.max_load_time);", + "", + "// Get and update variables.", + "health_tries = JSON.parse(postman.getEnvironmentVariable(\"health_tries\"));", + "counter = JSON.parse(postman.getEnvironmentVariable(\"health_counter\")) + 1;", + "postman.setEnvironmentVariable(\"health_counter\", JSON.stringify(counter));", + "", + "// Get the response.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Test the health response.", + "pm.test(\"Health Driver: Try \" + counter.toString() + \": Response should have 'message' property\", function() {", + " pm.expect(jsonData).to.have.property('message');", + "});", + "", + "pm.test(\"Response message should be 'api is health'\", function() {", + " pm.expect(jsonData.message).to.be.eql('api is healthy');", + "});", + "", + "// If response time is OK, proceed to the next test.", + "if (pm.response.responseTime < max_load_time) {", + " postman.setNextRequest(\"Check the readyz endpoint Booking\");", + "}", + " ", + "// Response time is too long.", + "else {", + " ", + " // You haven't reached your maximum tries yet. Try again.", + " if (counter < health_tries) {", + " postman.setNextRequest(\"Check the healthz endpoint Booking\");", + " }", + " ", + " // You have reached the maximum. An error, go to next test.", + " else {", + " pm.test(\"Response should be below \" + max_load_time.toString() + ' in ' + health_tries.toString() + ' tries.', function() {", + " pm.expect(counter).to.be.below(health_tries);", + " });", + " postman.setNextRequest(\"Check the readyz endpoint Booking\");", + " }", + "}", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}healthz/", + "host": [ + "{{url}}healthz" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Check the readyz endpoint Booking", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Perform the standard tests.", + "eval(environment.basic_response_test);", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "// Test the health response.", + "pm.test(\"Response should have 'message' property\", function() {", + " pm.expect(jsonData).to.have.property('message');", + "});", + "", + "pm.test(\"Response message should be 'api is ready'\", function() {", + " pm.expect(jsonData.message).to.be.eql('api is ready');", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}readyz/", + "host": [ + "{{url}}readyz" + ], + "path": [ + "" + ] + } + }, + "response": [] + } + ], + "description": "Checks the application health by calling the healthz and readyz endpoints" + }, + { + "name": "Get Exam Types", + "item": [ + { + "name": "Exam Type List", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Define the JSON Schema expected in response", + "var examTypeSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"exam_types\": {", + " \"type\": \"array\",", + " \"items\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"exam_color\": {\"type\": \"string\"},", + " \"exam_type_id\": {\"type\": \"number\"},", + " \"exam_type_name\": {\"type\": \"string\"},", + " \"group_exam_ind\": {\"type\": \"number\"},", + " \"ita_ind\": {\"type\": \"number\"},", + " \"method_type\": {\"type\": \"string\"},", + " \"number_of_hours\": {\"type\": \"number\"},", + " \"number_of_minutes\": {\"type\": [\"number\", \"null\"]},", + " \"pesticide_exam_ind\": {\"type\": \"number\"}", + " },", + " \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"group_exam_ind\", \"ita_ind\", \"method_type\",", + " \"number_of_hours\", \"number_of_minutes\", \"pesticide_exam_ind\"]", + " }", + " },", + " \"errors\": {\"type\": [\"object\", \"string\"]}", + " },", + " \"required\": [\"exam_types\", \"errors\"]", + "};", + "", + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "pm.test(\"Exam type response has valid schema\", function(){", + " pm.expect(tv4.validate(jsonData, examTypeSchema)).to.be.true;", + "});", + "", + "// Store all exam type IDs for future use in adding exams", + "var allExamIds = [];", + "", + "// Make sure some data returned.", + "pm.test(\"Response has exam_types property\", function(){", + " pm.expect(jsonData.hasOwnProperty(\"exam_types\")).to.be.true;", + "});", + "pm.test(\"Response has at least one exam_type\", function(){", + " pm.expect(jsonData.exam_types.length).to.be.above(0);", + "});", + "", + "// Set up list of valid exam types, create random functions.", + "eval(environment.init_exam_type_data);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}exam_types/", + "host": [ + "{{url}}exam_types" + ], + "path": [ + "" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Exams", + "item": [ + { + "name": "Exam Post End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"current_office_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Get exam type data and functions.", + "exam_array = JSON.parse(postman.getEnvironmentVariable(\"exam_array_data\"));", + "eval(environment.create_random_functions);", + "// Create an event number based on the time.", + "var ms = (new Date().getTime()).toString() + \"00\";", + "eventNumber = Number(ms.substring(ms.length-6, ms.len)) + 1;", + "postman.setEnvironmentVariable(\"event_number\", eventNumber);", + "// Update the next event ID.", + "var eventId = \"pm\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", 0);", + "postman.setEnvironmentVariable(\"event_id\", JSON.stringify(eventId));", + "postman.setEnvironmentVariable(\"event_delete\", eventId);", + "// Calculate a random exam type to use.", + "random_index = get_random_index(exam_array);", + "// Store for use.", + "random_exam_type_id = exam_array[random_index].id;", + "postman.setEnvironmentVariable(\"random_exam_type_id\", JSON.stringify(random_exam_type_id.toString()));", + "// Store other variables for later use.", + "postman.setEnvironmentVariable(\"exam_method\", JSON.stringify(\"paper\"));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"Postman Group Exam Name\"));", + "postman.setEnvironmentVariable(\"exam_written_ind\", JSON.stringify(\"0\"));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"Postman Examinee Name\"));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"Postman Test Notes\"));", + "postman.setEnvironmentVariable(\"number_of_students\", JSON.stringify(\"19\"));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"Postman test location\"));", + "// Calculate an expiry date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+7);", + "// Get year, day, month from the later time.", + "year = later.getFullYear().toString();", + "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", + "day = (\"0\" + (later.getDate()).toString()).slice(-2);", + "// Format expiry date for the exam.", + "expiry_date = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", + "// Store globals.", + "pm.globals.set(\"expiry_date\", JSON.stringify(expiry_date));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Get the max response time allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "", + "// Check Response code for request", + "pm.test(\"Response code for request is 201\", function(){", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.exam_schema_check);", + "eval(environment.exam_data_check);", + "", + "// If jsonData has an exam property, save exam ID.", + "if (jsonData.hasOwnProperty(\"exam\")) {", + "\tcurrentExamId = jsonData.exam.exam_id;", + " postman.setEnvironmentVariable(\"current_exam_id\", currentExamId);", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\n\t\"event_id\" : {{event_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : \"Postman Group Exam Name\",\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : \"Pm examinee name\",\n \"notes\" : \"Pm sample notes\",\n \"number_of_students\" : \"19\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : \"Pm test location\",\n \"expiry_date\": {{expiry_date}}\n}" + }, + "url": { + "raw": "{{url}}exams/", + "host": [ + "{{url}}exams" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Exam Detail End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Get the max response time allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "", + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.exam_schema_check);", + "eval(environment.exam_data_check);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Exam List End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.exam_schema_list_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}exams/", + "host": [ + "{{url}}exams" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Exam Put End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\",\"exam_method\",\"random_exam_type_id\",\"exam_written_ind\",\"current_office_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = eventNumber;", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId.toString()));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"number_of_students\", JSON.stringify(\"21\"));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Get the max response time allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "", + "// Check Response code for request", + "pm.test(\"Response code for request is 201\", function(){", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.exam_schema_check);", + "eval(environment.exam_data_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : {{exam_method}},\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : {{exam_written_ind}},\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}\n" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Exam by ID", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.exam_schema_check);", + "eval(environment.exam_data_check);", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Exam by Event", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "// Define the JSON Schema expected in response", + "var examSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"message\": {\"type\": \"boolean\"}", + " },", + " \"required\": [\"message\"]", + "};", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate Response Exam Schema\", function(){", + " pm.expect(tv4.validate(jsonData, examSchema)).to.be.true;", + "});", + "", + "// Make sure the message is true.", + "pm.test(\"Result is '\" + jsonData.message.toString() + \"', it should be 'true'\", function() {", + " pm.expect(jsonData.message).to.be.eql(true);", + "});", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"event_number\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Put the event ID in the right format.\r", + "var event_number = JSON.parse(postman.getEnvironmentVariable(\"update_id\"))\r" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}exams/event_id/{{event_number}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "event_id", + "{{event_number}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Exam Delete End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Get the max response time allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "", + "// Check Response code for request", + "pm.test(\"Response code for request is 204\", function(){", + " pm.response.to.have.status(204);", + "});", + "", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Exams Export", + "item": [ + { + "name": "Exams Export List", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time less than 20,000ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(20000);", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Calculate a start date four weeks prior to today.", + "var start = new Date();", + "start.setDate(start.getDate()-28);", + "// Get year, day, month from the start time.", + "start_year = start.getFullYear().toString();", + "start_month = (\"0\" + (start.getMonth() + 1).toString()).slice(-2);", + "start_day = (\"0\" + (start.getDate()).toString()).slice(-2);", + "start_date = start_year + \"-\" + start_month + \"-\" + start_day;", + "// Get year, day, month from the current day.", + "var today = new Date();", + "end_year = today.getFullYear().toString();", + "end_month = (\"0\" + (today.getMonth() + 1).toString()).slice(-2);", + "end_day = (\"0\" + (today.getDate()).toString()).slice(-2);", + "end_date = end_year + \"-\" + end_month + \"-\" + end_day;", + "console.log(\"Start: \" + start_date);", + "console.log(\"End: \" + end_date);", + "pm.globals.set(\"start_date\", start_date);", + "pm.globals.set(\"end_date\", end_date);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}exams/export/?start_date={{start_date}}&end_date={{end_date}}", + "host": [ + "{{url}}exams" + ], + "path": [ + "export", + "" + ], + "query": [ + { + "key": "start_date", + "value": "{{start_date}}" + }, + { + "key": "end_date", + "value": "{{end_date}}" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Bookings", + "item": [ + { + "name": "Booking Post End-point", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 201\", function(){", + " pm.response.to.have.status(201);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "", + "var booking_id = jsonData.booking.booking_id;", + "", + "//Dynamic variable used for end-point testing later on", + "postman.setEnvironmentVariable(\"booking_id\", JSON.stringify(booking_id));" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_office_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Calculate a start date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+7);", + "// Get year, day, month from the later time.", + "year = later.getFullYear().toString();", + "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", + "day = (\"0\" + (later.getDate()).toString()).slice(-2);", + "// Format starting and ending time for the booking.", + "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", + "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", + "// Store globals.", + "pm.globals.set(\"start_time\", JSON.stringify(start_time));", + "pm.globals.set(\"end_time\", JSON.stringify(end_time));", + "pm.globals.set(\"fees\", JSON.stringify(\"false\"));", + "pm.globals.set(\"booking_name\", JSON.stringify(\"Super big demo next week\"));", + "pm.globals.set(\"room_id\", pm.environment.get(\"room_id_1\"));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"room_id\": {{room_id}},\n \"fees\": {{fees}},\n \"booking_name\": {{booking_name}},\n \"office_id\" : {{current_office_id}}\n}\n" + }, + "url": { + "raw": "{{url}}bookings/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Booking Detail End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"booking_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}bookings/{{booking_id}}/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "{{booking_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Booking List End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_list_schema_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}bookings/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Booking Put End-point", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"booking_id\",\"current_office_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Calculate a start date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+7);", + "// Get year, day, month from the later time.", + "year = later.getFullYear().toString();", + "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", + "day = (\"0\" + (later.getDate()).toString()).slice(-2);", + "// Format starting and ending time for the booking.", + "start_time = year + \"-\" + month + \"-\" + day + \"T21:00:00Z\";", + "end_time = year + \"-\" + month + \"-\" + day + \"T23:00:00Z\";", + "pm.globals.set(\"start_time\", JSON.stringify(start_time));", + "pm.globals.set(\"end_time\", JSON.stringify(end_time));", + "pm.globals.set(\"fees\", JSON.stringify(\"true\"));", + "pm.globals.set(\"booking_name\", JSON.stringify(\"Time to pay your fees!\"));", + "pm.globals.set(\"room_id\", pm.environment.get(\"room_id_2\"));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"room_id\": {{room_id}},\n \"fees\": {{fees}},\n \"booking_name\": {{booking_name}},\n \"office_id\" : {{current_office_id}}\n}" + }, + "url": { + "raw": "{{url}}bookings/{{booking_id}}/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "{{booking_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Booking Detail End-point Again", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"booking_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}bookings/{{booking_id}}/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "{{booking_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Booking Delete End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"booking_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 204\", function(){", + " pm.response.to.have.status(204);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}bookings/{{booking_id}}/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "{{booking_id}}", + "" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Booking Recurring", + "item": [ + { + "name": "Book first recurring event", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 201\", function(){", + " pm.response.to.have.status(201);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "", + "var booking_id = jsonData.booking.booking_id;", + "", + "//Dynamic variable used for end-point testing later on", + "postman.setEnvironmentVariable(\"booking_id\", JSON.stringify(booking_id));" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_office_id\",\"pm_booking_uuid\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Calculate a start date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+7);", + "// Get year, day, month from the later time.", + "year = later.getFullYear().toString();", + "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", + "day = (\"0\" + (later.getDate()).toString()).slice(-2);", + "// Format starting and ending time for the booking.", + "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", + "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", + "// Store globals.", + "pm.globals.set(\"start_time\", JSON.stringify(start_time));", + "pm.globals.set(\"end_time\", JSON.stringify(end_time));", + "pm.globals.set(\"fees\", JSON.stringify(\"false\"));", + "pm.globals.set(\"booking_name\", JSON.stringify(\"Super big demo next week\"));", + "pm.globals.set(\"booking_contact_information\", JSON.stringify(\"Postman Contact\"));", + "pm.globals.set(\"room_id\", pm.environment.get(\"room_id_1\"));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"room_id\": {{room_id}},\n \"fees\": {{fees}},\n \"booking_name\": {{booking_name}},\n \"booking_contact_information\": {{booking_contact_information}},\n \"office_id\" : {{current_office_id}},\n \"recurring_uuid\": {{pm_booking_uuid}}\n}\n" + }, + "url": { + "raw": "{{url}}bookings/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Book second recurring event", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 201\", function(){", + " pm.response.to.have.status(201);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "", + "var booking_id = jsonData.booking.booking_id;", + "", + "//Dynamic variable used for end-point testing later on", + "postman.setEnvironmentVariable(\"second_event_id\", JSON.stringify(booking_id));" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"room_id\",\"fees\",\"booking_name\",\"booking_contact_information\",\"current_office_id\",\"pm_booking_uuid\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Calculate a start date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+8);", + "// Get year, day, month from the later time.", + "year = later.getFullYear().toString();", + "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", + "day = (\"0\" + (later.getDate()).toString()).slice(-2);", + "// Format starting and ending time for the booking.", + "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", + "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", + "// Store globals.", + "pm.globals.set(\"start_time\", JSON.stringify(start_time));", + "pm.globals.set(\"end_time\", JSON.stringify(end_time));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"room_id\": {{room_id}},\n \"fees\": {{fees}},\n \"booking_name\": {{booking_name}},\n \"booking_contact_information\": {{booking_contact_information}},\n \"office_id\" : {{current_office_id}},\n \"recurring_uuid\": {{pm_booking_uuid}}\n}\n" + }, + "url": { + "raw": "{{url}}bookings/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Book third recurring event", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 201\", function(){", + " pm.response.to.have.status(201);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "", + "var booking_id = jsonData.booking.booking_id;", + "", + "//Dynamic variable used for end-point testing later on", + "postman.setEnvironmentVariable(\"third_event_id\", JSON.stringify(booking_id));" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"room_id\",\"fees\",\"booking_name\",\"booking_contact_information\",\"current_office_id\",\"pm_booking_uuid\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Calculate a start date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+9);", + "// Get year, day, month from the later time.", + "year = later.getFullYear().toString();", + "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", + "day = (\"0\" + (later.getDate()).toString()).slice(-2);", + "// Format starting and ending time for the booking.", + "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", + "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", + "// Store globals.", + "pm.globals.set(\"start_time\", JSON.stringify(start_time));", + "pm.globals.set(\"end_time\", JSON.stringify(end_time));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"room_id\": {{room_id}},\n \"fees\": {{fees}},\n \"booking_name\": {{booking_name}},\n \"booking_contact_information\": {{booking_contact_information}},\n \"office_id\" : {{current_office_id}},\n \"recurring_uuid\": {{pm_booking_uuid}}\n}\n" + }, + "url": { + "raw": "{{url}}bookings/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Check first booking", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"booking_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "", + "// Get booking data.", + "var name = jsonData.booking.booking_name;", + "var contact = jsonData.booking.booking_contact_information;", + "var name_expect = JSON.parse(pm.globals.get(\"booking_name\"));", + "var contact_expect = JSON.parse(pm.globals.get(\"booking_contact_information\"));", + "", + "// Make sure data for the first booking hasn't changed.", + "pm.test(\"Name should be '\" + name_expect + \"'; it is '\" + name + \"'\", function () {", + " pm.expect(name).to.be.eql(name_expect);", + "});", + "pm.test(\"Contact should be '\" + contact_expect + \"'; it is '\" + contact + \"'\", function () {", + " pm.expect(contact).to.be.eql(contact_expect);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}bookings/{{booking_id}}/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "{{booking_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Check second booking", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"second_event_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "", + "// Get booking data.", + "var name = jsonData.booking.booking_name;", + "var contact = jsonData.booking.booking_contact_information;", + "var name_expect = JSON.parse(pm.globals.get(\"booking_name\"));", + "var contact_expect = JSON.parse(pm.globals.get(\"booking_contact_information\"));", + "", + "// Make sure data for the first booking hasn't changed.", + "pm.test(\"Name should be '\" + name_expect + \"'; it is '\" + name + \"'\", function () {", + " pm.expect(name).to.be.eql(name_expect);", + "});", + "pm.test(\"Contact should be '\" + contact_expect + \"'; it is '\" + contact + \"'\", function () {", + " pm.expect(contact).to.be.eql(contact_expect);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}bookings/{{second_event_id}}/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "{{second_event_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Check third booking", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"third_event_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "", + "// Get booking data.", + "var name = jsonData.booking.booking_name;", + "var contact = jsonData.booking.booking_contact_information;", + "var name_expect = JSON.parse(pm.globals.get(\"booking_name\"));", + "var contact_expect = JSON.parse(pm.globals.get(\"booking_contact_information\"));", + "", + "// Make sure data for the first booking hasn't changed.", + "pm.test(\"Name should be '\" + name_expect + \"'; it is '\" + name + \"'\", function () {", + " pm.expect(name).to.be.eql(name_expect);", + "});", + "pm.test(\"Contact should be '\" + contact_expect + \"'; it is '\" + contact + \"'\", function () {", + " pm.expect(contact).to.be.eql(contact_expect);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}bookings/{{third_event_id}}/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "{{third_event_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Update second event", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"second_event_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Calculate a start date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+7);", + "// Get year, day, month from the later time.", + "year = later.getFullYear().toString();", + "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", + "day = (\"0\" + (later.getDate()).toString()).slice(-2);", + "// Format starting and ending time for the booking.", + "start_time = year + \"-\" + month + \"-\" + day + \"T21:00:00Z\";", + "end_time = year + \"-\" + month + \"-\" + day + \"T23:00:00Z\";", + "pm.globals.set(\"start_time\", JSON.stringify(start_time));", + "pm.globals.set(\"end_time\", JSON.stringify(end_time));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\n \"booking_name\": \"Second booking event updated\",\n \"booking_contact_information\": \"My_favourite_postman@gmail.com\"\n}" + }, + "url": { + "raw": "{{url}}bookings/{{second_event_id}}/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "{{second_event_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Check first booking again", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"booking_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "", + "// Get booking data.", + "var name = jsonData.booking.booking_name;", + "var contact = jsonData.booking.booking_contact_information;", + "var name_expect = JSON.parse(pm.globals.get(\"booking_name\"));", + "var contact_expect = JSON.parse(pm.globals.get(\"booking_contact_information\"));", + "", + "// Make sure data for the first booking hasn't changed.", + "pm.test(\"Name should be '\" + name_expect + \"'; it is '\" + name + \"'\", function () {", + " pm.expect(name).to.be.eql(name_expect);", + "});", + "pm.test(\"Contact should be '\" + contact_expect + \"'; it is '\" + contact + \"'\", function () {", + " pm.expect(contact).to.be.eql(contact_expect);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}bookings/{{booking_id}}/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "{{booking_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Check second booking after update", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"second_event_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "", + "// Get booking data.", + "var name = jsonData.booking.booking_name;", + "var contact = jsonData.booking.booking_contact_information;", + "var name_expect = \"Second booking event updated\";", + "var contact_expect = \"My_favourite_postman@gmail.com\";", + "", + "// Make sure data for the first booking hasn't changed.", + "pm.test(\"Name should be '\" + name_expect + \"'; it is '\" + name + \"'\", function () {", + " pm.expect(name).to.be.eql(name_expect);", + "});", + "pm.test(\"Contact should be '\" + contact_expect + \"'; it is '\" + contact + \"'\", function () {", + " pm.expect(contact).to.be.eql(contact_expect);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}bookings/{{second_event_id}}/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "{{second_event_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Check third booking again", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"third_event_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "", + "// Get booking data.", + "var name = jsonData.booking.booking_name;", + "var contact = jsonData.booking.booking_contact_information;", + "var name_expect = JSON.parse(pm.globals.get(\"booking_name\"));", + "var contact_expect = JSON.parse(pm.globals.get(\"booking_contact_information\"));", + "", + "// Make sure data for the first booking hasn't changed.", + "pm.test(\"Name should be '\" + name_expect + \"'; it is '\" + name + \"'\", function () {", + " pm.expect(name).to.be.eql(name_expect);", + "});", + "pm.test(\"Contact should be '\" + contact_expect + \"'; it is '\" + contact + \"'\", function () {", + " pm.expect(contact).to.be.eql(contact_expect);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}bookings/{{third_event_id}}/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "{{third_event_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Update all events", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "// Define the JSON Schema expected in response", + "var examSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"bookings\": {\"type\": \"object\"},", + " \"errors\": {\"type\": [\"object\", \"string\"]}", + " },", + " \"required\": [\"bookings\", \"errors\"]", + "};", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate Update all events schema\", function(){", + " pm.expect(tv4.validate(jsonData, examSchema)).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Calculate a start date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+7);", + "// Print out the recurring booking ID.", + "console.log(\"Recurring booking uuid:\");", + "console.log(pm.globals.get(\"pm_booking_uuid\"));", + "pm_url_uuid = JSON.parse(pm.globals.get(\"pm_booking_uuid\"))", + "console.log(pm_url_uuid);", + "pm.globals.set(\"pm_url_uuid\", pm_url_uuid);", + " ", + "// Get year, day, month from the later time.", + "year = later.getFullYear().toString();", + "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", + "day = (\"0\" + (later.getDate()).toString()).slice(-2);", + "// Format starting and ending time for the booking.", + "start_time = year + \"-\" + month + \"-\" + day + \"T21:00:00Z\";", + "end_time = year + \"-\" + month + \"-\" + day + \"T23:00:00Z\";", + "pm.globals.set(\"start_time\", JSON.stringify(start_time));", + "pm.globals.set(\"end_time\", JSON.stringify(end_time));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\n \"booking_name\": \"All recurring pm events #2\",\n \"booking_contact_information\": \"My_second_favourite_postman@gmail.com\",\n \"invigilator_id\": []\n}" + }, + "url": { + "raw": "{{url}}bookings/recurring/{{pm_url_uuid}}", + "host": [ + "{{url}}bookings" + ], + "path": [ + "recurring", + "{{pm_url_uuid}}" + ] + } + }, + "response": [] + }, + { + "name": "Check first booking update all", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"booking_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "", + "// Get booking data.", + "var name = jsonData.booking.booking_name;", + "var contact = jsonData.booking.booking_contact_information;", + "var name_expect = \"All recurring pm events #2\";", + "var contact_expect = \"My_second_favourite_postman@gmail.com\";", + "", + "// Make sure data for the first booking hasn't changed.", + "pm.test(\"Name should be '\" + name_expect + \"'; it is '\" + name + \"'\", function () {", + " pm.expect(name).to.be.eql(name_expect);", + "});", + "pm.test(\"Contact should be '\" + contact_expect + \"'; it is '\" + contact + \"'\", function () {", + " pm.expect(contact).to.be.eql(contact_expect);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}bookings/{{booking_id}}/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "{{booking_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Check second booking update all", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"second_event_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "", + "// Get booking data.", + "var name = jsonData.booking.booking_name;", + "var contact = jsonData.booking.booking_contact_information;", + "var name_expect = \"All recurring pm events #2\";", + "var contact_expect = \"My_second_favourite_postman@gmail.com\";", + "", + "// Make sure data for the first booking hasn't changed.", + "pm.test(\"Name should be '\" + name_expect + \"'; it is '\" + name + \"'\", function () {", + " pm.expect(name).to.be.eql(name_expect);", + "});", + "pm.test(\"Contact should be '\" + contact_expect + \"'; it is '\" + contact + \"'\", function () {", + " pm.expect(contact).to.be.eql(contact_expect);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}bookings/{{second_event_id}}/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "{{second_event_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Check third booking update all", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"third_event_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "", + "// Get booking data.", + "var name = jsonData.booking.booking_name;", + "var contact = jsonData.booking.booking_contact_information;", + "var name_expect = \"All recurring pm events #2\";", + "var contact_expect = \"My_second_favourite_postman@gmail.com\";", + "", + "// Make sure data for the first booking hasn't changed.", + "pm.test(\"Name should be '\" + name_expect + \"'; it is '\" + name + \"'\", function () {", + " pm.expect(name).to.be.eql(name_expect);", + "});", + "pm.test(\"Contact should be '\" + contact_expect + \"'; it is '\" + contact + \"'\", function () {", + " pm.expect(contact).to.be.eql(contact_expect);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}bookings/{{third_event_id}}/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "{{third_event_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Booking Delete End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"pm_url_uuid\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 204\", function(){", + " pm.response.to.have.status(204);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}bookings/recurring/{{pm_url_uuid}}", + "host": [ + "{{url}}bookings" + ], + "path": [ + "recurring", + "{{pm_url_uuid}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Invigilators checks", + "item": [ + { + "name": "Invigilators", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.invigilator_schema_check);", + "", + "// Make sure there is at least one invigilator.", + "invigilators = jsonData.invigilators;", + "pm.test(\"Number of invigilators is \" + invigilators.length.toString() + \", must not be 0\", function() {", + " pm.expect(invigilators.length).to.not.be.eql(0);", + "})", + "", + "// Get the first invigilator.", + "first = invigilators[0];", + "", + "// Make sure the invigilator shadow count is 2, and the flag is \"Y\"", + "pm.test(\"Invigilator shadow count is \" + first.shadow_count.toString() + \", must be 2\", function() {", + " pm.expect(first.shadow_count).to.be.eql(2);", + "})", + "pm.test(\"Invigilator shadow flag is \" + first.shadow_flag.toString() + \", must be 'Y'\", function() {", + " pm.expect(first.shadow_flag).to.be.eql(\"Y\");", + "})", + "", + "// Save some values of the first invigilator.", + "invId = first.invigilator_id;", + "count = first.shadow_count;", + "flag = first.shadow_flag;", + "postman.setEnvironmentVariable(\"inv_id\", invId);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}invigilators/", + "host": [ + "{{url}}invigilators" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Invigilators offsite", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body, test the schema.", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.invigilator_schema_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}invigilators/offsite/", + "host": [ + "{{url}}invigilators" + ], + "path": [ + "offsite", + "" + ] + } + }, + "response": [] + }, + { + "name": "Invigilator subtract", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"inv_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.invig_one_schema_check);", + "", + "first = jsonData.invigilator;", + "", + "// Save some values.", + "newId = first.invigilator_id;", + "newEmail = first.contact_email;", + "newPhone = first.contact_phone;", + "newNotes = first.invigilator_notes;", + "newCount = first.shadow_count;", + "newFlag = first.shadow_flag;", + "", + "// Temporary debugging.", + "console.log(\"==> New invigilator data:\");", + "console.log(\" --> id: \" + newId);", + "console.log(\" --> email: \" + newEmail);", + "console.log(\" --> phone: \" + newPhone);", + "console.log(\" --> notes: \" + newNotes);", + "console.log(\" --> count: \" + newCount);", + "console.log(\" --> flag: \" + newFlag);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "", + "value": "", + "type": "text", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}invigilator/{{inv_id}}/?subtract=True&add=False", + "host": [ + "{{url}}invigilator" + ], + "path": [ + "{{inv_id}}", + "" + ], + "query": [ + { + "key": "subtract", + "value": "True" + }, + { + "key": "add", + "value": "False" + } + ] + } + }, + "response": [] + }, + { + "name": "Invigilator add", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"inv_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.invig_one_schema_check);", + "", + "first = jsonData.invigilator;", + "", + "// Save some values.", + "newId = first.invigilator_id;", + "newEmail = first.contact_email;", + "newPhone = first.contact_phone;", + "newNotes = first.invigilator_notes;", + "newCount = first.shadow_count;", + "newFlag = first.shadow_flag;", + "", + "// Temporary debugging.", + "console.log(\"==> New invigilator data:\");", + "console.log(\" --> id: \" + newId);", + "console.log(\" --> email: \" + newEmail);", + "console.log(\" --> phone: \" + newPhone);", + "console.log(\" --> notes: \" + newNotes);", + "console.log(\" --> count: \" + newCount);", + "console.log(\" --> flag: \" + newFlag);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "", + "value": "", + "type": "text", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}invigilator/{{inv_id}}/?subtract=False&add=True", + "host": [ + "{{url}}invigilator" + ], + "path": [ + "{{inv_id}}", + "" + ], + "query": [ + { + "key": "subtract", + "value": "False" + }, + { + "key": "add", + "value": "True" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Rooms", + "item": [ + { + "name": "Room List End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.room_schema_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}rooms/", + "host": [ + "{{url}}rooms" + ], + "path": [ + "" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "CSRS", + "item": [ + { + "name": "CSRS Me Get End-point", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.csr_schema_check);", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}csrs/me/", + "host": [ + "{{url}}csrs" + ], + "path": [ + "me", + "" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Offices", + "item": [ + { + "name": "Office List End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "eval(environment.all_office_schema_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}offices/", + "host": [ + "{{url}}offices" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Office Available Timeslots", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_office_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}offices/{{current_office_id}}/slots/", + "host": [ + "{{url}}offices" + ], + "path": [ + "{{current_office_id}}", + "slots", + "" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Appointments", + "item": [ + { + "name": "Appointment Post End-point", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 201\", function(){", + " pm.response.to.have.status(201);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.appointment_schema_check);", + "eval(environment.appointment_data_check);", + "", + "var appointment_id = jsonData.appointment.appointment_id;", + "", + "//Dynamic variable used for end-point testing later on", + "postman.setEnvironmentVariable(\"appointment_id\", JSON.stringify(appointment_id));" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_office_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Calculate a start date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+7);", + "// Get year, day, month from the later time.", + "year = later.getFullYear().toString();", + "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", + "day = (\"0\" + (later.getDate()).toString()).slice(-2);", + "// Format starting and ending time for the booking.", + "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", + "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", + "pm.globals.set(\"start_time\", JSON.stringify(start_time));", + "pm.globals.set(\"end_time\", JSON.stringify(end_time));", + "pm.globals.set(\"category\", JSON.stringify(\"Exam\"));", + "pm.globals.set(\"service_id\", pm.environment.get(\"service_PropTax_id\"));", + "pm.globals.set(\"appt_comments\", JSON.stringify(\"Missed playoffs, needs to talk #1.\"));", + "pm.globals.set(\"appt_citizen_name\", JSON.stringify(\"LeBron James Appointment #1\"));", + "pm.globals.set(\"appt_contact_information\", JSON.stringify(\"My contact info\"));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"service_id\": {{service_id}},\n \"office_id\" : {{current_office_id}},\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"category\": {{category}},\n \"comments\": {{appt_comments}},\n \"citizen_name\": {{appt_citizen_name}},\n \"contact_information\": {{appt_contact_information}}\n}" + }, + "url": { + "raw": "{{url}}appointments/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Appointment Detail End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"appointment_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.appointment_schema_check);", + "eval(environment.appointment_data_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}appointments/{{appointment_id}}/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "{{appointment_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Appointment List End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid\\", + "eval(environment.appointment_list_schema_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}appointments/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Appointment Put End-point", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.appointment_schema_check);", + "eval(environment.appointment_data_check);", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"appointment_id\",\"current_office_id\",\"category\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Calculate a start date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+7);", + "// Get year, day, month from the later time.", + "year = later.getFullYear().toString();", + "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", + "day = (\"0\" + (later.getDate()).toString()).slice(-2);", + "// Format starting and ending time for the booking.", + "start_time = year + \"-\" + month + \"-\" + day + \"T21:00:00Z\";", + "end_time = year + \"-\" + month + \"-\" + day + \"T23:00:00Z\";", + "pm.globals.set(\"start_time\", JSON.stringify(start_time));", + "pm.globals.set(\"end_time\", JSON.stringify(end_time));", + "pm.globals.set(\"appt_comments\", JSON.stringify(\"super EARLY\"));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"office_id\" : {{current_office_id}},\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"category\": {{category}},\n \"comments\": {{appt_comments}}\n}" + }, + "url": { + "raw": "{{url}}appointments/{{appointment_id}}/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "{{appointment_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Appointment Delete End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"appointment_id\",\"current_office_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 204\", function(){", + " pm.response.to.have.status(204);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}appointments/{{appointment_id}}?office_id={{current_office_id}}", + "host": [ + "{{url}}appointments" + ], + "path": [ + "{{appointment_id}}", + "" + ], + "query": [ + { + "key": "office_id", + "value": "{{current_office_id}}" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Appointments Recurring", + "item": [ + { + "name": "Book first appointment", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 201\", function(){", + " pm.response.to.have.status(201);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.appointment_schema_check);", + "eval(environment.appointment_data_check);", + "", + "var appointment_id = jsonData.appointment.appointment_id;", + "", + "//Dynamic variable used for end-point testing later on", + "postman.setEnvironmentVariable(\"appointment_id\", JSON.stringify(appointment_id));", + "pm.test(\"Stored appointment_id for recurring checks\", function(){", + " pm.expect(postman.getEnvironmentVariable(\"appointment_id\")).to.not.be.oneOf([null, undefined, \"\"]);", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_office_id\",\"pm_appt_uuid\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "pm.environment.unset(\"appointment_id\");", + "pm.environment.unset(\"second_appt_id\");", + "pm.environment.unset(\"third_appt_id\");", + "// Calculate a start date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+7);", + "// Get year, day, month from the later time.", + "year = later.getFullYear().toString();", + "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", + "day = (\"0\" + (later.getDate()).toString()).slice(-2);", + "// Format starting and ending time for the booking.", + "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", + "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", + "pm.globals.set(\"start_time\", JSON.stringify(start_time));", + "pm.globals.set(\"end_time\", JSON.stringify(end_time));", + "pm.globals.set(\"category\", JSON.stringify(\"Exam\"));", + "pm.globals.set(\"service_id\", pm.environment.get(\"service_PropTax_id\"));", + "pm.globals.set(\"appt_citizen_name\", JSON.stringify(\"BLACKOUT PERIOD\"));", + "pm.globals.set(\"appt_comments\", JSON.stringify(\"Office needs a break\"));", + "pm.globals.set(\"appt_contact_information\", JSON.stringify(\"Contact info, me@me.com\"));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"blackout_flag\" : \"Y\",\n \"citizen_name\" : {{appt_citizen_name}},\n \"comments\" : {{appt_comments}},\n \"contact_information\" : {{appt_contact_information}},\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"office_id\" : {{current_office_id}},\n \"recurring_uuid\": {{pm_appt_uuid}}\n}" + }, + "url": { + "raw": "{{url}}appointments/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Book second appointment", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 201\", function(){", + " pm.response.to.have.status(201);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.appointment_schema_check);", + "eval(environment.appointment_data_check);", + "", + "var appointment_id = jsonData.appointment.appointment_id;", + "", + "//Dynamic variable used for end-point testing later on", + "postman.setEnvironmentVariable(\"second_appt_id\", JSON.stringify(appointment_id));", + "pm.test(\"Stored second_appt_id for recurring checks\", function(){", + " pm.expect(postman.getEnvironmentVariable(\"second_appt_id\")).to.not.be.oneOf([null, undefined, \"\"]);", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"appt_citizen_name\",\"appt_comments\",\"appt_contact_information\",\"current_office_id\",\"pm_appt_uuid\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "pm.environment.unset(\"second_appt_id\");", + "// Calculate a start date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+8);", + "// Get year, day, month from the later time.", + "year = later.getFullYear().toString();", + "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", + "day = (\"0\" + (later.getDate()).toString()).slice(-2);", + "// Format starting and ending time for the booking.", + "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", + "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", + "pm.globals.set(\"start_time\", JSON.stringify(start_time));", + "pm.globals.set(\"end_time\", JSON.stringify(end_time));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"blackout_flag\" : \"Y\",\n \"citizen_name\" : {{appt_citizen_name}},\n \"comments\" : {{appt_comments}},\n \"contact_information\" : {{appt_contact_information}},\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"office_id\" : {{current_office_id}},\n \"recurring_uuid\": {{pm_appt_uuid}}\n}" + }, + "url": { + "raw": "{{url}}appointments/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Book third appointment", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 201\", function(){", + " pm.response.to.have.status(201);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.appointment_schema_check);", + "eval(environment.appointment_data_check);", + "", + "var appointment_id = jsonData.appointment.appointment_id;", + "", + "//Dynamic variable used for end-point testing later on", + "postman.setEnvironmentVariable(\"third_appt_id\", JSON.stringify(appointment_id));", + "pm.test(\"Stored third_appt_id for recurring checks\", function(){", + " pm.expect(postman.getEnvironmentVariable(\"third_appt_id\")).to.not.be.oneOf([null, undefined, \"\"]);", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"appt_citizen_name\",\"appt_comments\",\"appt_contact_information\",\"current_office_id\",\"pm_appt_uuid\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "pm.environment.unset(\"third_appt_id\");", + "// Calculate a start date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+9);", + "// Get year, day, month from the later time.", + "year = later.getFullYear().toString();", + "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", + "day = (\"0\" + (later.getDate()).toString()).slice(-2);", + "// Format starting and ending time for the booking.", + "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", + "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", + "pm.globals.set(\"start_time\", JSON.stringify(start_time));", + "pm.globals.set(\"end_time\", JSON.stringify(end_time));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"blackout_flag\" : \"Y\",\n \"citizen_name\" : {{appt_citizen_name}},\n \"comments\" : {{appt_comments}},\n \"contact_information\" : {{appt_contact_information}},\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"office_id\" : {{current_office_id}},\n \"recurring_uuid\": {{pm_appt_uuid}}\n}" + }, + "url": { + "raw": "{{url}}appointments/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Check first appointment", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"appointment_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.appointment_schema_check);", + "eval(environment.appointment_data_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}appointments/{{appointment_id}}/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "{{appointment_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Check second appointment", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"second_appt_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.appointment_schema_check);", + "eval(environment.appointment_data_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}appointments/{{second_appt_id}}/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "{{second_appt_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Check third appointment", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"third_appt_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.appointment_schema_check);", + "eval(environment.appointment_data_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}appointments/{{third_appt_id}}/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "{{third_appt_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Update second appointment", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.appointment_schema_check);", + "eval(environment.appointment_data_check);", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"second_appt_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Calculate a start date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+7);", + "// Get year, day, month from the later time.", + "year = later.getFullYear().toString();", + "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", + "day = (\"0\" + (later.getDate()).toString()).slice(-2);", + "// Format starting and ending time for the booking.", + "start_time = year + \"-\" + month + \"-\" + day + \"T21:00:00Z\";", + "end_time = year + \"-\" + month + \"-\" + day + \"T23:00:00Z\";", + "pm.globals.set(\"start_time\", JSON.stringify(start_time));", + "pm.globals.set(\"end_time\", JSON.stringify(end_time));", + "pm.globals.set(\"appt_citizen_name\", JSON.stringify(\"BLACKOUT UPDATE 2nd\"));", + "pm.globals.set(\"appt_comments\", JSON.stringify(\"Update blackout comments\"));", + "pm.globals.set(\"appt_contact_information\", JSON.stringify(\"Update blackout contact\"));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"citizen_name\" : {{appt_citizen_name}},\n \"comments\" : {{appt_comments}},\n \"contact_information\" : {{appt_contact_information}}\n}" + }, + "url": { + "raw": "{{url}}appointments/{{second_appt_id}}/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "{{second_appt_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Check second appointment again", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"second_appt_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.appointment_schema_check);", + "eval(environment.appointment_data_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}appointments/{{second_appt_id}}/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "{{second_appt_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Check first appointment again", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.appointment_schema_check);", + "eval(environment.appointment_data_check);", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"appointment_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Reset variables back to their first and third appt values.\r", + "pm.globals.set(\"appt_citizen_name\", JSON.stringify(\"BLACKOUT PERIOD\"));\r", + "pm.globals.set(\"appt_comments\", JSON.stringify(\"Office needs a break\"));\r", + "pm.globals.set(\"appt_contact_information\", JSON.stringify(\"Contact info, me@me.com\"));\r" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}appointments/{{appointment_id}}/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "{{appointment_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Check third appointment again", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"third_appt_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.appointment_schema_check);", + "eval(environment.appointment_data_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}appointments/{{third_appt_id}}/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "{{third_appt_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Update all appointments", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "// Define the JSON Schema expected in response", + "var apptAllSchema = {", + " \"type\": \"object\", ", + " \"properties\": {", + " \"appointments\": {\"type\": \"object\"},", + " \"errors\": {\"type\": [\"object\", \"string\"]}", + " },", + " \"required\": [\"appointments\", \"errors\"],", + "};", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate Recurring Appointments Schema\", function(){", + " pm.expect(tv4.validate(jsonData, apptAllSchema)).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Calculate a start date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+7);", + "// Print out the appointment ID.", + "pm_url_uuid = JSON.parse(pm.globals.get(\"pm_appt_uuid\"))", + "pm.globals.set(\"pm_url_uuid\", pm_url_uuid);", + "pm.globals.set(\"appt_citizen_name\", JSON.stringify(\"BLACKOUT ALL UPDATE\"));", + "pm.globals.set(\"appt_comments\", JSON.stringify(\"All blackout comments\"));", + "pm.globals.set(\"appt_contact_information\", JSON.stringify(\"All Update blackout contacts\"));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"citizen_name\" : {{appt_citizen_name}},\n \"comments\" : {{appt_comments}},\n \"contact_information\" : {{appt_contact_information}}\n}" + }, + "url": { + "raw": "{{url}}appointments/recurring/{{pm_url_uuid}}", + "host": [ + "{{url}}appointments" + ], + "path": [ + "recurring", + "{{pm_url_uuid}}" + ] + } + }, + "response": [] + }, + { + "name": "Check first appointment all", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"appointment_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.appointment_schema_check);", + "eval(environment.appointment_data_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}appointments/{{appointment_id}}/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "{{appointment_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Check second appointment all", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"second_appt_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.appointment_schema_check);", + "eval(environment.appointment_data_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}appointments/{{second_appt_id}}/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "{{second_appt_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Check third appointment all", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"third_appt_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.appointment_schema_check);", + "eval(environment.appointment_data_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}appointments/{{third_appt_id}}/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "{{third_appt_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Appointment Delete End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"pm_url_uuid\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 204\", function(){", + " pm.response.to.have.status(204);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}appointments/recurring/{{pm_url_uuid}}", + "host": [ + "{{url}}appointments" + ], + "path": [ + "recurring", + "{{pm_url_uuid}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Public User Appointments", + "item": [ + { + "name": "Authenticate public user token", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"auth_url\",\"realm\",\"clientid\",\"public_user_id\",\"public_user_password\",\"client_secret\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Parse response body", + "var jsonData = {};", + "try {", + " jsonData = JSON.parse(responseBody);", + "} catch (parseErr) {", + " console.log(\"Authentication response body was not JSON.\");", + " console.log(responseBody);", + " pm.globals.set(\"auth_failure_reason\", \"Non-JSON auth response\");", + " pm.execution.setNextRequest(null);", + " throw parseErr;", + "}", + "", + "var authFailureReason = jsonData.error_description || jsonData.error || (\"HTTP \" + pm.response.code);", + "if (pm.response.code !== 200 || !jsonData.access_token) {", + " console.log(\"Authentication failed for \" + pm.info.requestName + \".\");", + " console.log(responseBody);", + " pm.globals.set(\"auth_failure_reason\", authFailureReason);", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Authentication failed: \" + authFailureReason);", + "}", + "", + "pm.test(\"Response code for request is 200\", function(){", + " pm.expect(pm.response.code).to.eql(200);", + "});", + "pm.test(\"Access token exists\", function(){", + " pm.expect(jsonData).to.have.property(\"access_token\");", + " pm.expect(jsonData.access_token).to.be.a(\"string\").and.not.empty;", + "});", + "pm.test(\"Refresh token exists\", function(){", + " pm.expect(jsonData).to.have.property(\"refresh_token\");", + " pm.expect(jsonData.refresh_token).to.be.a(\"string\").and.not.empty;", + "});", + "pm.test(\"Expires In is present\", function(){", + " pm.expect(jsonData).to.have.property(\"expires_in\");", + " pm.expect(jsonData.expires_in).to.not.eql(null);", + "});", + "pm.test(\"Refresh Expires In is present\", function(){", + " pm.expect(jsonData).to.have.property(\"refresh_expires_in\");", + " pm.expect(jsonData.refresh_expires_in).to.not.eql(null);", + "});", + "", + "pm.globals.unset(\"auth_failure_reason\");", + "pm.globals.set(\"public_user_token\", jsonData.access_token);", + "pm.globals.set(\"public_user_refresh_token\", jsonData.refresh_token);", + "pm.globals.set(\"token_expires\", Date.now() + (jsonData.expires_in * 1000));", + "pm.globals.set(\"refresh_token_expires\", Date.now() + (jsonData.refresh_expires_in * 1000));", + "pm.globals.set(\"expires_in\", jsonData.expires_in);", + "pm.globals.set(\"refresh_expires_in\", jsonData.refresh_expires_in);", + "pm.environment.unset(\"user_id\");", + "pm.environment.unset(\"user_phone\");", + "pm.environment.unset(\"appointment_id\");" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/x-www-form-urlencoded" + } + ], + "body": { + "mode": "raw", + "raw": "grant_type=password&client_id={{clientid}}&username={{public_user_id}}&password={{public_user_password}}&client_secret={{client_secret}}" + }, + "url": { + "raw": "{{auth_url}}/auth/realms/{{realm}}/protocol/openid-connect/token", + "host": [ + "{{auth_url}}" + ], + "path": [ + "auth", + "realms", + "{{realm}}", + "protocol", + "openid-connect", + "token" + ] + } + }, + "response": [] + }, + { + "name": "Authenticate and create user", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"public_url\",\"clientid\",\"public_user_id\",\"public_user_password\",\"client_secret\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "var allSchema = {", + " \"type\": \"array\",", + " \"items\": {\"type\": \"object\"}", + "};", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate All Users Schema\", function(){", + " pm.expect(tv4.validate(jsonData, allSchema)).to.be.true;", + "});", + "", + "var firstUser = jsonData[0];", + "console.log(firstUser)", + "", + "var userSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"email\": {\"type\": \"string\"},", + " \"last_name\": {\"type\": \"string\"},", + " \"user_id\": {\"type\": \"number\"},", + " \"username\": {\"type\": \"string\"},", + " \"send_email_reminders\": {\"type\": \"boolean\"},", + " \"send_sms_reminders\": {\"type\": \"boolean\"},", + " \"display_name\": {\"type\": \"string\"},", + " \"telephone\": {\"type\": \"string\"}", + " },", + " \"required\": [\"email\", \"last_name\", \"user_id\", \"username\", \"send_email_reminders\", \"send_sms_reminders\",", + " \"display_name\", \"telephone\"]", + "};", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate First User Schema\", function(){", + " pm.expect(tv4.validate(firstUser, userSchema)).to.be.true;", + "});", + "", + "//Dynamic variables used for end-point testing later on", + "var user_id = firstUser.user_id;", + "var user_phone = firstUser.telephone;", + "postman.setEnvironmentVariable(\"user_id\", JSON.stringify(user_id));", + "postman.setEnvironmentVariable(\"user_phone\", JSON.stringify(user_phone));", + "pm.test(\"Stored user_id for later public user requests\", function(){", + " pm.expect(postman.getEnvironmentVariable(\"user_id\")).to.not.be.oneOf([null, undefined, \"\"]);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{public_user_token}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Typea", + "type": "text", + "value": "application/x-www-form-urlencoded" + } + ], + "body": { + "mode": "raw", + "raw": "grant_type=password&client_id={{clientid}}&username={{public_user_id}}&password={{public_user_password}}&client_secret={{client_secret}}" + }, + "url": { + "raw": "{{public_url}}users/", + "host": [ + "{{public_url}}users" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Discover public appointment office", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"public_url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "var jsonData = JSON.parse(responseBody);", + "var offices = jsonData.offices || [];", + "var office = offices.find(function(candidate) {", + " return candidate.office_name === \"100 Mile House\";", + "});", + "", + "pm.test(\"Public appointment office was discovered\", function(){", + " pm.expect(office).to.not.be.oneOf([null, undefined]);", + "});", + "", + "pm.environment.set(\"public_office_id\", String(office.office_id));", + "pm.environment.set(\"public_office_timezone\", office.timezone.timezone_name);" + ] + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{public_url}}offices/", + "host": [ + "{{public_url}}offices" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Discover public appointment service", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"public_url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "var jsonData = JSON.parse(responseBody);", + "var services = jsonData.services || [];", + "var service = services.find(function(candidate) {", + " return candidate.service_name === \"Deferment Application\";", + "});", + "", + "pm.test(\"Public appointment service was discovered\", function(){", + " pm.expect(service).to.not.be.oneOf([null, undefined]);", + "});", + "", + "pm.environment.set(\"public_service_id\", String(service.service_id));" + ] + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{public_url}}services/", + "host": [ + "{{public_url}}services" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Find available public appointment slot", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"public_url\",\"public_office_id\",\"public_service_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "var jsonData = JSON.parse(responseBody);", + "var slotDay = null;", + "var slot = null;", + "", + "Object.keys(jsonData).forEach(function(dayKey) {", + " if (!slotDay && Array.isArray(jsonData[dayKey]) && jsonData[dayKey].length > 0) {", + " slotDay = dayKey;", + " slot = jsonData[dayKey][0];", + " }", + "});", + "", + "pm.test(\"At least one public appointment slot is available\", function(){", + " pm.expect(slotDay).to.not.be.oneOf([null, undefined, \"\"]);", + " pm.expect(slot).to.not.be.oneOf([null, undefined]);", + "});", + "", + "var timezoneName = pm.environment.get(\"public_office_timezone\") || \"America/Creston\";", + "var offset = timezoneName === \"America/Creston\" ? \"-07:00\" : \"-07:00\";", + "var parts = slotDay.split(\"/\");", + "var dayIso = [parts[2], parts[0], parts[1]].join(\"-\");", + "var startIso = dayIso + \"T\" + slot.start_time + \":00\" + offset;", + "var endIso = dayIso + \"T\" + slot.end_time + \":00\" + offset;", + "", + "pm.globals.set(\"public_start_time\", JSON.stringify(startIso));", + "pm.globals.set(\"public_end_time\", JSON.stringify(endIso));", + "pm.globals.set(\"category\", JSON.stringify(\"Exam\"));", + "pm.globals.set(\"service_id\", pm.environment.get(\"public_service_id\"));", + "pm.globals.set(\"appt_comments\", JSON.stringify(\"My self serve appt.\"));", + "pm.globals.set(\"appt_citizen_name\", JSON.stringify(\"cfms-postman-public-user\"));", + "pm.globals.set(\"appt_contact_information\", JSON.stringify(\"test@test.com\"));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{public_user_token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{public_url}}offices/{{public_office_id}}/slots/?service_id={{public_service_id}}", + "host": [ + "{{public_url}}offices" + ], + "path": [ + "{{public_office_id}}", + "slots", + "" + ], + "query": [ + { + "key": "service_id", + "value": "{{public_service_id}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Book an appointment", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 201\", function(){", + " pm.response.to.have.status(201);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.appointment_schema_check);", + "", + "// Update the comments to include phone number, before data test.", + "var comments_old = JSON.parse(pm.globals.get(\"appt_comments\"));", + "var user_phone = JSON.parse(postman.getEnvironmentVariable(\"user_phone\"));", + "var comments_new = comments_old + '. Phone: ' + user_phone;", + "console.log(\"==> Old: \" + comments_old);", + "console.log(\"==> Phone: \" + user_phone);", + "console.log(\"==> New: \" + comments_new);", + "pm.globals.set(\"appt_comments\", JSON.stringify(comments_new));", + "", + "// Now ready for the data check.", + "eval(environment.appointment_data_check);", + "", + "//Dynamic variable used for end-point testing later on", + "var appointment_id = jsonData.appointment.appointment_id;", + "postman.setEnvironmentVariable(\"appointment_id\", JSON.stringify(appointment_id));", + "pm.test(\"Stored appointment_id for public appointment cleanup\", function(){", + " pm.expect(postman.getEnvironmentVariable(\"appointment_id\")).to.not.be.oneOf([null, undefined, \"\"]);", + "});", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"public_url\",\"service_id\",\"public_office_id\",\"public_start_time\",\"public_end_time\",\"category\",\"appt_comments\",\"appt_citizen_name\",\"appt_contact_information\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "var requiredVars = [\"public_start_time\", \"public_end_time\", \"service_id\"];", + "requiredVars.forEach(function(varName) {", + " pm.test(\"Required variable \" + varName + \" is set before public booking\", function(){", + " pm.expect(pm.globals.get(varName)).to.not.be.oneOf([null, undefined, \"\"]);", + " });", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{public_user_token}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"service_id\": {{service_id}},\n \"office_id\" : {{public_office_id}},\n \"start_time\": {{public_start_time}},\n \"end_time\": {{public_end_time}},\n \"category\": {{category}},\n \"comments\": {{appt_comments}},\n \"citizen_name\": {{appt_citizen_name}},\n \"contact_information\": {{appt_contact_information}}\n}" + }, + "url": { + "raw": "{{public_url}}appointments/", + "host": [ + "{{public_url}}appointments" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Edit user profile", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"public_url\",\"user_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "var allSchema = {", + " \"type\": \"array\",", + " \"items\": {\"type\": \"object\"}", + "};", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate All Users Schema\", function(){", + " pm.expect(tv4.validate(jsonData, allSchema)).to.be.true;", + "});", + "", + "var firstUser = jsonData[0];", + "", + "var userSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"email\": {\"type\": \"string\"},", + " \"last_name\": {\"type\": \"string\"},", + " \"user_id\": {\"type\": \"number\"},", + " \"username\": {\"type\": \"string\"},", + " \"send_email_reminders\": {\"type\": \"boolean\"},", + " \"send_sms_reminders\": {\"type\": \"boolean\"},", + " \"display_name\": {\"type\": \"string\"},", + " \"telephone\": {\"type\": \"string\"}", + " },", + " \"required\": [\"email\", \"last_name\", \"user_id\", \"username\", \"send_email_reminders\", \"send_sms_reminders\",", + " \"display_name\", \"telephone\"]", + "};", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate First User Schema\", function(){", + " pm.expect(tv4.validate(firstUser, userSchema)).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{public_user_token}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"email\": \"test@test.com\",\n \"telephone\": \"0000000000\",\n \"send_email_reminders\": true,\n \"send_sms_reminders\": true\n}" + }, + "url": { + "raw": "{{public_url}}users/{{user_id}}/", + "host": [ + "{{public_url}}users" + ], + "path": [ + "{{user_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Get user profile", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"public_url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "var allSchema = {", + " \"type\": \"array\",", + " \"items\": {\"type\": \"object\"}", + "};", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate All Users Schema\", function(){", + " pm.expect(tv4.validate(jsonData, allSchema)).to.be.true;", + "});", + "", + "var firstUser = jsonData[0];", + "", + "var userSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"email\": {\"type\": \"string\"},", + " \"last_name\": {\"type\": \"string\"},", + " \"user_id\": {\"type\": \"number\"},", + " \"username\": {\"type\": \"string\"},", + " \"send_email_reminders\": {\"type\": \"boolean\"},", + " \"send_sms_reminders\": {\"type\": \"boolean\"},", + " \"display_name\": {\"type\": \"string\"},", + " \"telephone\": {\"type\": \"string\"}", + " },", + " \"required\": [\"email\", \"last_name\", \"user_id\", \"username\", \"send_email_reminders\", \"send_sms_reminders\",", + " \"display_name\", \"telephone\"]", + "};", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate First User Schema\", function(){", + " pm.expect(tv4.validate(firstUser, userSchema)).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{public_user_token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [ + { + "key": "", + "type": "text", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{public_url}}users/me/", + "host": [ + "{{public_url}}users" + ], + "path": [ + "me", + "" + ] + } + }, + "response": [] + }, + { + "name": "List all appointments", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"public_url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid\\", + "eval(environment.appointment_list_schema_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{public_user_token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{public_url}}users/appointments/", + "host": [ + "{{public_url}}users" + ], + "path": [ + "appointments", + "" + ] + } + }, + "response": [] + }, + { + "name": "Appointment Delete End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"public_url\",\"appointment_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 204\", function(){", + " pm.response.to.have.status(204);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{public_user_token}}", + "type": "string" + } + ] + }, + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{public_url}}appointments/{{appointment_id}}/", + "host": [ + "{{public_url}}appointments" + ], + "path": [ + "{{appointment_id}}", + "" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + } + ] +} diff --git a/api/postman/API_Test_TheQ_Booking_with_QTxn.json b/api/postman/API_Test_TheQ_Booking_with_QTxn.json index 94b13abf1..f73512536 100644 --- a/api/postman/API_Test_TheQ_Booking_with_QTxn.json +++ b/api/postman/API_Test_TheQ_Booking_with_QTxn.json @@ -1,13270 +1,14992 @@ { - "info": { - "_postman_id": "1c30decd-7b40-4a76-aa2b-e092dc3eb9dc", - "name": "API_Test_TheQ_Booking", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" - }, - "item": [ - { - "name": "Setup TheQ", - "item": [ - { - "name": "Setup-Variables", - "event": [ - { - "listen": "test", - "script": { - "id": "5409b66d-67a4-449b-8633-9aeca632b388", - "exec": [ - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "e9eed831-7955-4218-a400-ae6e1e7e2e10", - "exec": [ - "// See if the use-prefix global has been set. Use default if not.", - "let usePrefix = '';", - "if (pm.globals.get('use-prefix')) {", - " console.log(\"==> use-prefix exists\");", - " usePrefix = pm.globals.get('use-prefix');", - " console.log(\" --> Prefix is: \" + usePrefix);", - " ", - " // Set up all globals, using the correct prefix.", - " pm.globals.set('auth_url', pm.globals.get(usePrefix + 'auth_url'));", - " pm.globals.set('realm', pm.globals.get(usePrefix + 'realm'));", - " pm.globals.set('clientid', pm.globals.get(usePrefix + 'clientid'));", - " pm.globals.set('client_secret', pm.globals.get(usePrefix + 'client_secret'));", - " pm.globals.set('url', pm.globals.get(usePrefix + 'url'));", - "}", - "else {", - " console.log(\"==> use-prefix does not exist\");", - " console.log(\" --> No default globals set.\");", - "}", - "", - "// If no maximum load time defined, set a default.", - "if (!pm.globals.get('max_load_time')) {", - " console.log(\"==> max_load_time not present, default set.\");", - " pm.globals.set(\"max_load_time\", JSON.stringify(1503));", - "}", - "", - "// If no maximum response defined, set a default.", - "if (!pm.globals.get('max_response_time')) {", - " console.log(\"==> max_response_time not present, default set.\");", - " pm.globals.set(\"max_response_time\", JSON.stringify(15005));", - "}", - "", - "// Display the values of all globals.", - "console.log(\"\");", - "console.log(\"==> Globals are:\");", - "console.log(\" --> auth_url: \" + pm.globals.get(\"auth_url\"));", - "console.log(\" --> realm: \" + pm.globals.get(\"realm\"));", - "console.log(\" --> clientid: \" + pm.globals.get(\"clientid\"));", - "console.log(\" --> client_secret: \" + pm.globals.get(\"client_secret\"));", - "console.log(\" --> url: \" + pm.globals.get(\"url\"));", - "console.log(\" --> max_load_time: \" + pm.globals.get(\"max_load_time\"));", - "console.log(\" --> max_response_time: \" + pm.globals.get(\"max_response_time\"));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Dummy data." - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Auth-First", - "event": [ - { - "listen": "test", - "script": { - "id": "5409b66d-67a4-449b-8633-9aeca632b388", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"auth_first\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "auth_url = globals.auth_url;\nrealm = globals.realm;\nclientid = globals.clientid;\nuserid = globals.userid;\npassword = globals.password;\nclient_secret = globals.client_secret;\n\nconst echoPostRequest = {\n url: auth_url + '/auth/realms/' + realm + '/protocol/openid-connect/token',\n method: 'POST',\n header: 'Content-Type:application/x-www-form-urlencoded',\n body: {\n mode: 'raw',\n raw: 'grant_type=password&client_id=' + clientid \n + '&username=' + userid \n + '&password=' + password\n + '&client_secret=' + client_secret\n }\n};\npm.sendRequest(echoPostRequest, function (err, res) {\n var jsonData = res.json();\n if (jsonData.hasOwnProperty('access_token')) {\n \tpm.globals.set(\"token\", jsonData.access_token);\n\t pm.globals.set(\"refresh_token\", jsonData.refresh_token);\n\t if (err) {\n\t console.log(err);\n\t }\n\t // console.log(err ? err : res.json());\n\t} else {\n\t pm.globals.set(\"token\", 0);\n\t pm.globals.set(\"refresh_token\", 0);\n\t pm.globals.set(\"token_expires\", 0);\n\t pm.globals.set(\"refresh_token_expires\", 0);\n\t}\n});" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Auth-Script", - "event": [ - { - "listen": "test", - "script": { - "id": "f386cf22-bb0f-47d9-9c22-cda162ed4375", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"auth_script\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "auth_url = globals.auth_url;\nrealm = globals.realm;\nclientid = globals.clientid;\nuserid = globals.userid;\npassword = globals.password;\nclient_secret = globals.client_secret;\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-AuthToken-Script", - "event": [ - { - "listen": "test", - "script": { - "id": "e1d0ab5c-fe6b-4e6d-8778-417ae879cee1", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"auth_token_script\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "auth_url = globals.auth_url;\nrealm = globals.realm;\nclientid = globals.clientid;\nuserid = globals.userid;\npassword = globals.password;\nclient_secret = globals.client_secret;\n\nconst echoPostRequest = {\n url: authurl + '/auth/realms/' + realm + '/protocol/openid-connect/token',\n method: 'POST',\n header: 'Content-Type:application/x-www-form-urlencoded',\n body: {\n mode: 'raw',\n raw: 'grant_type=password&client_id=' + clientid \n + '&username=' + userid \n + '&password=' + password\n + '&client_secret=' + client_secret\n }\n};\n\npm.sendRequest(echoPostRequest, function (err, res) {\n if (err) { console.log(err); }\n else {\n var jsonData = res.json();\n pm.globals.set(\"token\", jsonData.access_token);\n pm.globals.set(\"refresh_token\", jsonData.refresh_token);\n pm.globals.set(\"token_expires\", Date.now()+(jsonData.expires_in * 1000));\n pm.globals.set(\"refresh_token_expires\", Date.now()+(jsonData.refresh_expires_in * 1000));\n }\n //console.log(err ? err : res.json());\n});" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-AuthRefresh-Script", - "event": [ - { - "listen": "test", - "script": { - "id": "365727f4-696d-4e44-a379-5eba3001641a", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"auth_refresh_script\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "auth_url = globals.auth_url;\nrealm = globals.realm;\nclientid = globals.clientid;\nrefresh_token = environment.refresh_token;\nclient_secret = globals.client_secret;\n\nconst echoPostRequest = {\n url: authurl +'/auth/realms/' +realm + '/protocol/openid-connect/token',\n method: 'POST',\n header: 'Content-Type:application/x-www-form-urlencoded',\n body: {\n mode: 'raw',\n raw: 'grant_type=refresh_token&client_id=' + clientid \n + '&refresh_token=' + refresh_token \n + '&client_secret=' + client_secret\n }\n};\n\npm.sendRequest(echoPostRequest, function (err, res) {\n var jsonData = res.json();\n pm.globals.set(\"token\", jsonData.access_token);\n pm.globals.set(\"refresh_token\", jsonData.refresh_token);\n pm.globals.set(\"token_expires\", Date.now()+(jsonData.expires_in * 1000));\n pm.globals.set(\"refresh_token_expires\", Date.now()+(jsonData.refresh_expires_in * 1000));\n\n console.log(err ? err : res.json());\n});" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Basic-Response-Tests", - "event": [ - { - "listen": "test", - "script": { - "id": "a0d8e240-3b40-4654-a32b-bf2e676fdeb9", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"basic_response_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Get the maximum response time allowed.\r\nmax_response_time = JSON.parse(globals.max_response_time);\r\n\r\n// Check to make sure the response time was within the maximum allowed.\r\npm.test('Response time less than ' + max_response_time.toString() + 'ms', function(){\r\n pm.expect(pm.response.responseTime).to.be.below(max_response_time);\r\n});\r\n\r\n// Other tests.\r\npm.test(\"Response code for request is 200\", function(){\r\n pm.response.to.have.status(200);\r\n});\r\npm.test('Response header should have Content-Type of application/json', function() {\r\n pm.response.to.have.header('content-type', 'application/json');\r\n});\r\npm.test('Response body be in JSON format', function() {\r\n pm.response.to.be.json; \r\n});" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Complex-Response-Tests", - "event": [ - { - "listen": "test", - "script": { - "id": "f006b951-3205-4f21-a315-369f85591929", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"complex_response_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Get the maximum response time allowed.\nmax_response_time = JSON.parse(globals.max_response_time);\n\n// Check to make sure the response time was within the maximum allowed.\npm.test('Response time less than ' + max_response_time.toString() + 'ms', function(){\n pm.expect(pm.response.responseTime).to.be.below(max_response_time);\n});\n\n// Other tests.\npm.test(\"Response code for request is 200\", function(){\n pm.response.to.have.status(200);\n});\npm.test('Response header should have Content-Type of application/json', function() {\n pm.response.to.have.header('content-type', 'application/json');\n});\npm.test('Response body be in JSON format', function() {\n pm.response.to.be.json; \n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Create-Response-Tests", - "event": [ - { - "listen": "test", - "script": { - "id": "382b7b65-d736-4a03-a44a-3891f33b617d", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"create_response_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Get the maximum response time allowed.\nmax_response_time = JSON.parse(globals.max_response_time);\n\n// Check to make sure the response time was within the maximum allowed.\npm.test('Response time less than ' + max_response_time.toString() + 'ms', function(){\n pm.expect(pm.response.responseTime).to.be.below(max_response_time);\n});\n\n// Other tests.\npm.test(\"Response status code should be 201 CREATED\", function(){\n pm.response.to.have.status(201);\n});\npm.test('Response header should have Content-Type of application/json', function() {\n pm.response.to.have.header('content-type', 'application/json');\n});\npm.test('Response body be in JSON format', function() {\n pm.response.to.be.json; \n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Citizen-Response-Tests", - "event": [ - { - "listen": "test", - "script": { - "id": "8cebcf78-f5a2-4694-b108-60e146791a78", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"citizen_response_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "var schema = {\n \"properties\" : {\n \"start_time\" : {\n \"type\" : \"string\"\n },\n \"citizen_name\" : {\n \"type\" : [\"string\", \"null\"]\n },\n \"citizen_id\" : {\n \"type\" : [\"number\", \"object\"]\n },\n \"qt_xn_citizen_ind\" : {\n \"type\" : \"number\"\n },\n \"ticket_number\" : {\n \"type\" : [\"string\", \"null\"]\n },\n \"service_reqs\" : {\n \"type\" : \"array\"\n },\n \"office_id\" : {\n \"type\" : [\"object\", \"number\"]\n },\n \"cs\" : {\n \"type\" : \"object\"\n },\n \"citizen_comments\" : {\n \"type\" : [\"string\", \"null\"]\n },\n \n },\n \"required\" : [\"start_time\", \"citizen_name\", \"citizen_id\",\n \"qt_xn_citizen_ind\", \"ticket_number\", \"service_reqs\",\n \"office_id\", \"cs\", \"citizen_comments\"]\n};\n\n// Declare, initialize variables.\nvar allElements = null;\n\nif (jsonData.hasOwnProperty(\"citizens\")) {\n\tallElements = jsonData.citizens;\n};\n\nif (jsonData.hasOwnProperty(\"citizen\")) {\n\tallElements = [];\n\tallElements.push(jsonData.citizen);\n};\n\nvar elementCount = 0;\n\n// If there are some citizens, proceed with tests.\nif (allElements !== null) {\n\n // Loop to validate schema of each channel, create list of citizen ids.\n allElements.forEach(function(element) {\n elementCount ++;\n var testTitle = \"Citizen (\" + elementCount + \"): \" + element.citizen_id + \" - \";\n tests[testTitle + \"conforms to schema\"] = tv4.validate(element, schema);\n \n // Test the authenticate response.\n pm.test(testTitle + \"qt_xn_citizen_ind must be 0 or 1\", function() {\n pm.expect(element.qt_xn_citizen_ind).to.be.within(0,1);\n });\n });\n};" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Service-Response-Tests", - "event": [ - { - "listen": "test", - "script": { - "id": "0e6c4264-28b3-4a49-b6bb-1199aef2cb13", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"service_response_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "var schema = {\n \"properties\" : {\n \"sr_id\" : {\n \"type\" : [\"object\", \"number\"]\n },\n \"sr_state\" : {\n \"type\" : \"object\"\n },\n \"periods\" : {\n \"type\" : \"array\"\n },\n \"service\" : {\n \"type\" : \"object\"\n },\n \"citizen\" : {\n \"type\" : [\"object\", \"number\"]\n },\n \"quantity\" : {\n \"type\" : \"number\"\n },\n \"service_id\" : {\n \"type\" : [\"object\", \"number\"]\n },\n \"citizen_id\" : {\n \"type\" : [\"object\", \"number\"]\n },\n \"channel\" : {\n \t\"type\" : \"object\"\n },\n \"channel_id\" : {\n \t\"type\" : [\"object\", \"number\"]\n }\n \n },\n \"required\" : [\n \t\"sr_id\", \"sr_state\", \"periods\", \"service\", \"citizen\", \"quantity\",\n \t\"service_id\", \"citizen_id\", \"channel\", \"channel_id\"\n ]\n};\n\n// Declare, initialize variables.\nvar allElements = null;\n\nif (jsonData.hasOwnProperty(\"service_requests\")) {\n\tallElements = jsonData.service_requests;\n};\n\nif (jsonData.hasOwnProperty(\"service_request\")) {\n allElements = [];\n\tallElements.push(jsonData.service_request);\n}\n\nvar elementCount = 0;\n\n// If there are some service requests, proceed with tests.\nif (allElements !== null) {\n\n // Loop to validate schema of each service request.\n allElements.forEach(function(element) {\n elementCount ++;\n var testTitle = \"Service Request (\" + elementCount + \"): \" + element.sr_id + \" - \";\n tests[testTitle + \"conforms to schema\"] = tv4.validate(element, schema);\n });\n};" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Get-Active-Citizens-Tests", - "event": [ - { - "listen": "test", - "script": { - "id": "8856712d-73ca-4172-89ba-590e8b015c6b", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"get_active_citizens_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Declare and initialize variables.\nvar elementCount = 0;\nvar srCount = 0;\nvar isFirstCitizen = true;\n\n\n// Loop to create list of active citizen ids.\nallElements.forEach(function(element) {\n srCount = element.service_reqs.length;\n\n // If citizen active, add to the list.\n if (element.cs.cs_state_name === \"Active\") {\n //console.log(\"Citizen (\" + elementCount + \") \" + element.citizen_id +\n // \" Active: SRCount = \" + srCount);\n citizenIds.push(element.citizen_id);\n\n // Save the first citizen.\n if (isFirstCitizen) {\n currentCitizen = element;\n isFirstCitizen = false;\n }\n }\n \n // Increment count.\n elementCount++;\n});" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - } - ], - "description": "This folder performs basic authentication features." - }, - { - "name": "Check app health", - "item": [ - { - "name": "Check healthz driver TheQ", - "event": [ - { - "listen": "test", - "script": { - "id": "74adc5ce-caa5-452a-bd96-8ac90a4c11d7", - "exec": [ - "// Get the maximum response time allowed.", - "max_load_time = JSON.parse(globals.max_load_time);", - "", - "// Set health response time variable.", - "health_tries = 15;", - "counter = 1;", - "postman.setEnvironmentVariable(\"health_tries\", JSON.stringify(health_tries));", - "postman.setEnvironmentVariable(\"health_counter\", JSON.stringify(counter));", - "", - "// Get the response.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Test the health response.", - "pm.test(\"Health Driver: Try \" + counter.toString() + \": Response should have 'message' property\", function() {", - " pm.expect(jsonData).to.have.property('message');", - "});", - "", - "pm.test(\"Response message should be 'api is healthy'\", function() {", - " pm.expect(jsonData.message).to.be.eql('api is healthy');", - "});", - "", - "// If response time is OK, proceed to the next test.", - "if (pm.response.responseTime < max_load_time) {", - " postman.setNextRequest(\"Check the readyz endpoint TheQ\");", - "}", - " ", - "// Response time is too long. Try again, give pod a chance to spin up.", - "else {", - " postman.setNextRequest(\"Check the healthz endpoint TheQ\");", - "}" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}healthz/", - "host": [ - "{{url}}healthz" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Check the healthz endpoint TheQ", - "event": [ - { - "listen": "test", - "script": { - "id": "74adc5ce-caa5-452a-bd96-8ac90a4c11d7", - "exec": [ - "// Get the maximum load time allowed.", - "max_load_time = JSON.parse(postman.getEnvironmentVariable(\"max_load_time\"));", - "", - "// Get and update variables.", - "health_tries = JSON.parse(postman.getEnvironmentVariable(\"health_tries\"));", - "counter = JSON.parse(postman.getEnvironmentVariable(\"health_counter\")) + 1;", - "postman.setEnvironmentVariable(\"health_counter\", JSON.stringify(counter));", - "", - "// Get the response.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Test the health response.", - "pm.test(\"Health Driver: Try \" + counter.toString() + \": Response should have 'message' property\", function() {", - " pm.expect(jsonData).to.have.property('message');", - "});", - "", - "pm.test(\"Response message should be 'api is healthy'\", function() {", - " pm.expect(jsonData.message).to.be.eql('api is healthy');", - "});", - "", - "// If response time is OK, proceed to the next test.", - "if (pm.response.responseTime < max_load_time) {", - " postman.setNextRequest(\"Check the readyz endpoint TheQ\");", - "}", - " ", - "// Response time is too long.", - "else {", - " ", - " // You haven't reached your maximum tries yet. Try again.", - " if (counter < health_tries) {", - " postman.setNextRequest(\"Check the healthz endpoint\");", - " }", - " ", - " // You have reached the maximum. An error, go to next test.", - " else {", - " pm.test(\"Response should be below \" + max_load_time.toString() + ' in ' + health_tries.toString() + ' tries.', function() {", - " pm.expect(counter).to.be.below(health_tries);", - " });", - " postman.setNextRequest(\"Check the readyz endpoint TheQ\");", - " }", - "}", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}healthz/", - "host": [ - "{{url}}healthz" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Check the readyz endpoint TheQ", - "event": [ - { - "listen": "test", - "script": { - "id": "661c33c4-4a3d-4396-a549-9969edafbfa6", - "exec": [ - "// Perform the standard tests.", - "eval(environment.basic_response_test);", - "", - "var jsonData = JSON.parse(responseBody);", - "", - "// Test the health response.", - "pm.test(\"Response should have 'message' property\", function() {", - " pm.expect(jsonData).to.have.property('message');", - "});", - "", - "pm.test(\"Response message should be 'api is ready'\", function() {", - " pm.expect(jsonData.message).to.be.eql('api is ready');", - "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}readyz/", - "host": [ - "{{url}}readyz" - ], - "path": [ - "" - ] - } - }, - "response": [] - } - ], - "description": "Checks the application health by calling the healthz and readyz endpoints" - }, - { - "name": "Check user login", - "item": [ - { - "name": "Authenticate default QTxn user", - "event": [ - { - "listen": "test", - "script": { - "id": "43df8e47-2b93-48b0-a5ff-bb3396d12537", - "exec": [ - "// Do the basic checks.", - "eval(environment.basic_response_test);", - "", - "// Get the response.", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to make sure that the access token field is not null", - "pm.test(\"Access Token is not null\", function(){", - " var access_token = jsonData.access_token;", - " pm.expect(access_token).not.eql(null);", - "});", - "", - "//Test to make sure that the refresh token response field is not null", - "pm.test(\"Refresh Token is not null\", function(){", - " var refresh_token = jsonData.refresh_token;", - " pm.expect(refresh_token).not.eql(null);", - "});", - "", - "//Test to make sure that expires in response field is not nullf", - "pm.test(\"Expires In is not null\", function(){", - " var expires_in = jsonData.expires_in;", - " pm.expect(expires_in).not.eql(null);", - "});", - "", - "//Test to make sure that refresh expires in response fiels is not null", - "pm.test(\"Refresh Expires In is not null\", function(){", - " var refresh_expires_in = jsonData.refresh_expires_in;", - " pm.expect(refresh_expires_in).not.eql(null);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/x-www-form-urlencoded" - } - ], - "body": { - "mode": "raw", - "raw": "grant_type=password&client_id={{clientid}}&username={{userid}}&password={{password}}&client_secret={{client_secret}}" - }, - "url": { - "raw": "{{auth_url}}/auth/realms/{{realm}}/protocol/openid-connect/token?Content-Type=application/x-www-form-urlencoded", - "host": [ - "{{auth_url}}" - ], - "path": [ - "auth", - "realms", - "{{realm}}", - "protocol", - "openid-connect", - "token" - ], - "query": [ - { - "key": "Content-Type", - "value": "application/x-www-form-urlencoded" - } - ] - }, - "description": "Make sure the operator ID can log in" - }, - "response": [] - }, - { - "name": "Who am I TheQ", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "if (jsonData.hasOwnProperty(\"csr\")) {", - "\tcurrentOfficeId = jsonData.csr.office_id;", - "\tcurrentOfficeNumber = jsonData.csr.office.office_number;", - "\tcurrentCsrId = jsonData.csr.csr_id;", - " postman.setEnvironmentVariable(\"current_office_id\", currentOfficeId);", - " postman.setEnvironmentVariable(\"current_office_number\", currentOfficeNumber);", - " postman.setEnvironmentVariable(\"current_csr_id\", currentCsrId);", - "};", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}csrs/me/", - "host": [ - "{{url}}csrs" - ], - "path": [ - "me", - "" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Check channels", - "item": [ - { - "name": "Get channels", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "2b71673c-4aa2-47b3-8594-15f02b390ee0", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "42742c4c-505d-472d-857b-fdba74cc49ac", - "exec": [ - "// Run basic tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "var schema = {", - " \"properties\" : {", - " \"channel_name\" : {", - " \"type\" : \"string\"", - " },", - " \"channel_id\" : {", - " \"type\" : [\"number\", \"object\"]", - " }", - " },", - " \"required\" : [\"channel_name\", \"channel_id\"]", - "};", - "", - "// Loop to validate schema of each channel.", - "var allChannels = jsonData.channels;", - "var channelCount = 0;", - "var phoneId = 0;", - "var emailId = 0;", - "var phoneText = \"Phone\";", - "var emailText = \"Email/Fax/Mail\";", - "allChannels.forEach(function(channel) {", - " channelCount ++;", - " var testTitle = \"Channel (\" + channelCount + \"): ID \" + channel.channel_id + \" Name \" + channel.channel_name + \" conforms to schema\";", - " tests[testTitle] = tv4.validate(channel, schema);", - " if (channel.channel_name === phoneText) {", - " phoneId = channel.channel_id;", - " }", - " if (channel.channel_name === emailText) {", - " emailId = channel.channel_id;", - " }", - "});", - "", - "// Check that you found the phone ID.", - "pm.test(phoneText + ' id was ' + phoneId.toString() + ' (should not equal 0)', function() {", - " pm.expect(phoneId).to.not.be.eql(0);", - "});", - "", - "// Check that you found the email ID.", - "pm.test(emailText + ' id was ' + emailId.toString() + ' (should not equal 0)', function() {", - " pm.expect(emailId).to.not.be.eql(0);", - "});", - "", - "// Store this ID for future use.", - "postman.setEnvironmentVariable(\"channel_telephone_id\", JSON.stringify(phoneId));", - "postman.setEnvironmentVariable(\"channel_email_id\", JSON.stringify(emailId));" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}channels/", - "host": [ - "{{url}}channels" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Check counters", - "item": [ - { - "name": "Store CSR and Office Info", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "// Define the JSON Schema expected in response", - "var CSRSSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"csr_id\": {\"type\": \"number\"},", - " \"csr_state\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"csr_state_desc\": {\"type\": \"string\"},", - " \"csr_state_id\": {\"type\": \"number\"},", - " \"csr_state_name\": {\"type\": \"string\"}", - " },", - " \"required\": [\"csr_state_desc\", \"csr_state_id\", \"csr_state_name\"]", - " },", - " \"csr_state_id\": {\"type\": \"number\"},", - " \"deleted\": {},", - " \"finance_designate\": {\"type\": \"number\"},", - " \"office_manager\": {\"type\": \"number\"},", - " \"ita2_designate\": {\"type\": \"number\"},", - " \"office\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"appointments_enabled_ind\": {\"type\": \"number\"},", - " \"exams_enabled_ind\": {\"type\": \"number\"},", - " \"office_id\": {\"type\": \"number\"},", - " \"office_name\": {\"type\": \"string\"},", - " \"office_number\": {\"type\": \"number\"},", - " \"sb\":{", - " \"type\": \"object\",", - " \"properties\": {", - " \"sb_id\": {\"type\": \"number\"},", - " \"sb_type\": {\"type\": \"string\"}", - " },", - " \"required\": [\"sb_id\", \"sb_type\"]", - " }", - " },", - " \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"sb\"]", - " },", - " \"office_name\": {\"type\": \"string\"},", - " \"pesticide_designate\": {\"type\": \"number\"},", - " \"qt_xn_csr_ind\": {\"type\": \"number\"},", - " \"receptionist_ind\": {\"type\": \"number\"},", - " \"role\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"role_code\": {\"type\": \"string\"},", - " \"role_desc\": {\"type\": \"string\"},", - " \"role_id\": {\"type\": \"number\"}", - " },", - " \"required\": [\"role_code\", \"role_desc\", \"role_id\"]", - " },", - " \"role_id\": {\"type\": \"number\"},", - " \"username\": {\"type\": \"string\"}", - " },", - " \"attention_needed\": {\"type\": \"boolean\"},", - " \"required\": [\"csr\", \"attention_needed\"]", - "};", - "", - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate Response CSRs Schema\", function(){", - " pm.expect(tv4.validate(jsonData, CSRSSchema)).to.be.true;", - "});", - "", - "// Make sure that jsonData has an csr property.", - "pm.test(\"Response should have csr property\", function(){", - " pm.expect(jsonData.hasOwnProperty(\"csr\")).to.be.true;", - "});", - "", - "var csr = 0;", - "var office = 0;", - "var counters = 0;", - "var counter_text = \"Counter\";", - "var counter_id = 0;", - "var qtxn_text = \"Quick Trans\";", - "var qtxn_id = 0;", - "", - "if (jsonData.hasOwnProperty(\"csr\")) {", - "\tcurrentOfficeId = jsonData.csr.office_id;", - "\tcurrentOfficeNumber = jsonData.csr.office.office_number;", - " postman.setEnvironmentVariable(\"current_office_id\", currentOfficeId);", - " postman.setEnvironmentVariable(\"current_office_number\", currentOfficeNumber);", - " postman.setEnvironmentVariable(\"current_csr_id\", jsonData.csr.csr_id);", - " ", - " csr = jsonData.csr;", - " counter_id = 0;", - " qtxn_id = 0;", - "", - " // Make sure that jsonData has an booking property.", - " pm.test(\"CSR should have office property\", function(){", - " pm.expect(csr.hasOwnProperty(\"office\")).to.be.true;", - " });", - " ", - " // Make sure office has counter property.", - " if (csr.hasOwnProperty(\"office\")) {", - " office = csr.office;", - " ", - " // Make sure that jsonData has an booking property.", - " pm.test(\"Office should have counters property\", function(){", - " pm.expect(office.hasOwnProperty(\"counters\")).to.be.true;", - " });", - "", - " // Make sure office has counter property.", - " if (office.hasOwnProperty(\"counters\")) {", - " counters = office.counters;", - " ", - " // Search for Counter and Quick Trans counters", - " counters.forEach(function(counter) {", - " if (counter.counter_name === counter_text) {", - " counter_id = counter.counter_id;", - " }", - " if (counter.counter_name === qtxn_text) {", - " qtxn_id = counter.counter_id;", - " }", - " });", - " ", - " // Make sure you found the right IDs.", - " pm.test(\"Counter ID (\" + counter_id.toString() + \") should not be 0\", function(){", - " pm.expect(counter_id).to.not.be.eql(0);", - " });", - " pm.test(\"Quick Transaction ID (\" + qtxn_id.toString() + \") should not be 0\", function(){", - " pm.expect(qtxn_id).to.not.be.eql(0);", - " });", - " ", - " // Store the ids for future use.", - " // postman.setEnvironmentVariable(\"counter_id\", counter_id);", - " // postman.setEnvironmentVariable(\"qtxn_id\", qtxn_id);", - " postman.setEnvironmentVariable(\"counter_id\", JSON.stringify(counter_id.toString()));", - " postman.setEnvironmentVariable(\"qtxn_id\", JSON.stringify(qtxn_id.toString()));", - " }", - "", - " ", - " }", - "", - "}", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}csrs/me/", - "host": [ - "{{url}}csrs" - ], - "path": [ - "me", - "" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Check categories", - "item": [ - { - "name": "Get categories", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "e99f23ee-5a03-43d9-9075-75dbf06aadcc", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "1a9c9ff5-8475-4dd2-a6c7-ffb5d4689145", - "exec": [ - "// Run basic tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "var schema = {", - " \"properties\" : {", - " \"display_dashboard_ind\" : {", - " \"type\" : \"number\"", - " },", - " \"deleted\" : {", - " \"type\" : [\"object\", \"null\"]", - " },", - " \"actual_service_ind\" : {", - " \"type\" : \"number\"", - " },", - " \"service_id\" : {", - " \"type\" : [\"number\", \"object\"]", - " },", - " \"service_code\" : {", - " \"type\" : \"string\"", - " },", - " \"prefix\" : {", - " \"type\" : \"string\"", - " },", - " \"service_name\" : {", - " \"type\" : \"string\"", - " },", - " \"parent_id\" : {", - " \"type\" : [\"object\", \"null\" ]", - " },", - " \"service_desc\" : {", - " \"type\" : \"string\"", - " }", - " },", - " \"required\" : [\"display_dashboard_ind\", \"deleted\", \"actual_service_ind\", \"service_id\", \"service_code\",", - " \"prefix\", \"service_name\", \"parent_id\", \"service_desc\"]", - "};", - "", - "// Loop to validate schema of each channel.", - "var allCategories = jsonData.categories;", - "var categoryCount = 0;", - "allCategories.forEach(function(category) {", - " categoryCount ++;", - " var testTitle = \"Category (\" + categoryCount + \"): \" + category.service_name + \" - \";", - " tests[testTitle + \"conforms to schema\"] = tv4.validate(category, schema);", - " var displayInd = category.display_dashboard_ind;", - " var serviceInd = category.actual_service_ind;", - "", - " // Test that returned data is valid.", - " pm.test(\"--> \" + testTitle + \"display_dashboard_ind must be 0 (is \" + displayInd.toString() + \")\", function(){", - " pm.expect(displayInd).to.be.eql(0);", - " });", - "", - " pm.test(\"--> \" + testTitle + \"actual_service_ind must be 0 (is \" + serviceInd.toString() + \")\", function(){", - " pm.expect(serviceInd).to.be.eql(0);", - " });", - " ", - " pm.test(\"--> \" + testTitle + \"parent_id must be null\", function(){", - " pm.expect(category.parent_id).to.be.null;", - " });", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}categories/", - "host": [ - "{{url}}categories" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Check services", - "item": [ - { - "name": "Get services", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "d01c3826-dc28-4cce-957b-ec70d0393e7e", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "3b11031e-4031-4569-91f2-49e23517ffee", - "exec": [ - "// Run basic tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "var schema = {", - " \"properties\" : {", - " \"display_dashboard_ind\" : {", - " \"type\" : \"number\"", - " },", - " \"deleted\" : {", - " \"type\" : [\"object\", \"null\"]", - " },", - " \"actual_service_ind\" : {", - " \"type\" : \"number\"", - " },", - " \"service_id\" : {", - " \"type\" : [\"number\", \"object\"]", - " },", - " \"service_code\" : {", - " \"type\" : \"string\"", - " },", - " \"prefix\" : {", - " \"type\" : \"string\"", - " },", - " \"service_name\" : {", - " \"type\" : \"string\"", - " },", - " \"parent_id\" : {", - " \"type\" : [\"object\", \"number\", \"null\" ]", - " },", - " \"service_desc\" : {", - " \"type\" : \"string\"", - " }", - " },", - " \"required\" : [\"display_dashboard_ind\", \"deleted\", \"actual_service_ind\", \"service_id\", \"service_code\",", - " \"prefix\", \"service_name\", \"parent_id\", \"service_desc\"]", - "};", - "", - "// Loop to validate schema of each channel.", - "var allElements = jsonData.services;", - "var elementCount = 0;", - "var elementMax = Math.min(10, allElements.length);", - "//allElements.forEach(function(element) {", - "for (var currentElement = 0; currentElement < elementMax; currentElement++) {", - " element = allElements[currentElement];", - " elementCount ++;", - " var testTitle = \"Service (\" + elementCount + \"): \" + element.service_name + \" - \";", - " tests[testTitle + \"conforms to schema\"] = tv4.validate(element, schema);", - " displayInd = element.display_dashboard_ind;", - " serviceInd = element.actual_service_ind;", - "", - " // Test that returned data is valid.", - " pm.test(\"--> \" + testTitle + \"display_dashboard_ind must be 0 or 1 (is \" + displayInd.toString() + \")\", function(){", - " pm.expect(displayInd).to.be.within(0, 1);", - " });", - "", - " // Test that returned data is valid.", - " pm.test(\"--> \" + testTitle + \"actual_service_ind must be 1 (is \" + serviceInd.toString() + \")\", function(){", - " pm.expect(serviceInd).to.be.eql(1);", - " });", - " ", - " // Test that returned data is valid.", - " pm.test(\"--> \" + testTitle + \"parent_id must not be null\", function(){", - " pm.expect(element.parent_id).to.not.be.null;", - " });", - "}", - "", - "// Declare and initialize variables.", - "var mspId = 0;", - "var taxId = 0;", - "var mspText = \"Payment - MSP\";", - "var propTaxText = \"Other - PTAX\";", - "", - "// Look for the MSP and Property Tax IDs.", - "allElements.forEach(function(element) {", - " if (element.service_name === mspText) {", - " mspId = element.service_id;", - " }", - " if (element.service_name === propTaxText) {", - " taxId = element.service_id;", - " }", - "});", - "", - "// Check that you found the MSP service.", - "pm.test(mspText + ' id was ' + mspId.toString() + ' (should not equal 0)', function() {", - " pm.expect(mspId).to.not.be.eql(0);", - "});", - "", - "// Check that you found the Property Tax service.", - "pm.test(propTaxText + ' id was ' + taxId.toString() + ' (should not equal 0)', function() {", - " pm.expect(taxId).to.not.be.eql(0);", - "});", - "", - "// Store these IDs for future use.", - "postman.setEnvironmentVariable(\"service_MSP_id\", JSON.stringify(mspId));", - "postman.setEnvironmentVariable(\"service_PropTax_id\", JSON.stringify(taxId));" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}services/", - "host": [ - "{{url}}services" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Clear queue for tests", - "item": [ - { - "name": "Delete citizen queue driver", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "7f6d8d4e-e4fe-451f-a5d9-119fcefcd527", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "27f63d12-7c7c-42e1-9647-85480ee17cb8", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Delete citizens, if there are any.", - " if (citizenIds.length > 0) {", - " ", - " // Set the current_client, to be deleted.", - " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", - " postman.setEnvironmentVariable(\"current_queue\", JSON.stringify(citizenIds));", - " ", - " if (currentCitizen.service_reqs.length === 0) {", - " postman.setNextRequest(\"Next citizen left\");", - " // // Temporary kludge. Citizen left not working, so add SR, then delete.", - " // postman.setNextRequest(\"Temporary add MSP service request\");", - " }", - " else {", - " postman.setNextRequest(\"Next citizen finish service\");", - " }", - " }", - " ", - " // No more citizens. Clear the current, queue variables.", - " else {", - " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(\"\"));", - " postman.setEnvironmentVariable(\"current_queue\", JSON.stringify(\"\"));", - " postman.setNextRequest(\"End clear queue via healthz endpoint\");", - " }", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Next citizen finish service", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e516a2b7-0555-43b5-8058-ccd92b5b6e95", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "var citizenToBeDeleted = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "var citizenData = jsonData.citizen;", - "var testTitle = \"Check citizen finish service\";", - "", - "// Make sure the response is valid.", - "pm.test(testTitle + \": Response should have property 'citizen'\", function(){", - " pm.expect(jsonData.hasOwnProperty(\"citizen\")).to.be.true;", - "});", - "pm.test(testTitle + \": Response should not have property 'message' indicating an error\", function(){", - " pm.expect(jsonData.hasOwnProperty(\"message\")).to.be.false;", - "});", - "pm.test(testTitle + \": Citizen marked as finished should be citizen \" + citizenToBeDeleted.toString(), function(){", - " pm.expect(citizenData.citizen_id).to.be.eql(citizenToBeDeleted);", - "});", - "", - "// Go back to the delete citizen queue driver.", - "postman.setNextRequest(\"Delete citizen queue driver\");", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/finish_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "finish_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Next citizen citizen left", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "6caff547-493f-4f0d-a121-f8e3398f11c3", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get environment variables.", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - " // Perform checks.", - " pm.test(\"Check there are no citizens waiting\", function(){", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test(\"Citizen that left must be \" + currentCitizen.citizen_id.toString() + \" (is \" + currentCitizenId.toString(), function(){", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - "}", - "", - "// Go back to the delete citizen queue driver.", - "postman.setNextRequest(\"Delete citizen queue driver\");", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/citizen_left/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "citizen_left", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Temporary add MSP service request", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "c2ec515b-209f-4d91-81c1-c72a14600685", - "exec": [ - "// Run create tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "var svcReq = jsonData.service_request;", - "", - "// Set schema of the service_request property.", - "var schema = {", - " \"properties\" : {", - " \"periods\" : {", - " \"type\" : \"array\"", - " },", - " \"service_id\" : {", - " \"type\" : [\"number\", \"object\"]", - " },", - " \"service\" : {", - " \"type\" : \"object\"", - " },", - " \"sr_state\" : {", - " \"type\" : \"object\"", - " },", - " \"quantity\" : {", - " \"type\" : \"number\"", - " },", - " \"sr_id\" : {", - " \"type\" : [\"number\", \"object\"]", - " },", - " \"citizen\" : {", - " \"type\" :[\"number\", \"object\"]", - " },", - " \"citizen_id\" : {", - " \"type\" : [\"number\", \"object\"]", - " },", - " \"channel\" : {", - " \"type\" : \"object\"", - " },", - " \"channel_id\" : {", - " \"type\" : [\"number\", \"object\"]", - " }", - " },", - " // \"required\" : [\"periods\", \"service_id\", \"sr_state_id\", \"service\"]", - " \"required\" : [\"periods\", \"service_id\", \"service\", \"sr_state\", \"quantity\", \"sr_id\",", - " \"citizen\", \"citizen_id\", \"channel\", \"channel_id\"]", - "};", - "", - "// Make sure the response is valid.", - "pm.test(\"Response has service_request property\", function(){", - " pm.expect(jsonData.hasOwnProperty(\"service_request\")).to.be.true;", - "});", - "pm.test(\"Response has errors property\", function(){", - " pm.expect(jsonData.hasOwnProperty(\"errors\")).to.be.true;", - "});", - "tests[\"Service_request property has correct schema\"] = tv4.validate(svcReq, schema);", - "", - "// Go back to the clear citizen driver.", - "postman.setNextRequest(\"Next citizen finish service\");", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_MSP_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : 1,\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" - }, - "url": { - "raw": "{{url}}service_requests/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "End clear queue via healthz endpoint", - "event": [ - { - "listen": "test", - "script": { - "id": "74adc5ce-caa5-452a-bd96-8ac90a4c11d7", - "exec": [ - "// Perform the standard tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Test the health response.", - "pm.test(\"Response should have 'message' property\", function() {", - " pm.expect(jsonData).to.have.property('message');", - "});", - "", - "pm.test(\"Response message should be 'api is healthy'\", function() {", - " pm.expect(jsonData.message).to.be.eql('api is healthy');", - "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}healthz/", - "host": [ - "{{url}}healthz" - ], - "path": [ - "" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Check citizen through queue (QT1)", - "item": [ - { - "name": "Check no citizens (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "9f95832a-57ef-4dcf-bdfe-916d2eb5d006", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "2cbca8d4-50d9-4dde-9239-af3c987949b8", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var allOK = true;", - "", - "// If citizen property was present.", - "", - "if (allElements !== null) {", - "", - " // Make sure it had a length of 0.", - " if (allElements.length !== 0) {", - " allOK = false;", - " }", - "}", - "", - "pm.test(\"There should be no citizens in the office\", function() {", - " pm.expect(allOK).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Create citizen (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "7896261d-7d88-4eba-860b-98472655c4a7", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " pm.test(\"Only one citizen should be in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - " pm.test(\"Current citizen comments should be null\", function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.null;", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - " ", - " // Store the ID of the citizen just created.", - " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{}" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Edit specific citizen (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "b72e7756-5de1-4a13-9609-8917ea63dee7", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "73110fdd-6476-403d-b6c9-c108032fbd66", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - "", - " // Perform tests.", - " pm.test(\"Must be one active citizen in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}}\n}" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Add property tax via phone service request (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "fa6f6a3b-e4e7-42b6-a8d3-ecda3840418a", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" - }, - "url": { - "raw": "{{url}}service_requests/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "List specific citizen (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "66ca9683-be00-478b-92c0-6ac698d9088b", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request must have one period', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", - " });", - " pm.test('Service request period channel must be ' + citizenChannel, function() {", - " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", - " });", - " pm.test('Service request period state must be \"Ticket Creation\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Add citizen to queue (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "8a294876-edfa-4d5b-ada4-399f5339cd8f", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Pending\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (now two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Waiting\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/add_to_queue/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "add_to_queue", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Invite specific citizen (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "8e9cd1ef-a5d9-4f81-b061-f818d4fc5603", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 3 (now three periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(3);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Invited\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Invited\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/invite/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "invite", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Begin serving citizen (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "1b1f7f66-04cd-4f10-bfa2-c4f3fffe8715", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 4 (now four periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(4);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Being Served\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/begin_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "begin_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Finish serving citizen (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "818713b9-18a0-4fef-9c16-f71b43dd2ad0", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be no active citizens in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Complete\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 4 (still four periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(4);", - " });", - " pm.test('There must be no open periods', function() {", - " pm.expect(openPeriodCount).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/finish_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "finish_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Check citizen begin-hold-finish (QT2)", - "item": [ - { - "name": "Check no citizens (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "3d9d9302-3b15-49f0-8bb2-3de1f4d134b8", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "2cbca8d4-50d9-4dde-9239-af3c987949b8", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var allOK = true;", - "", - "// If citizen property was present.", - "if (allElements !== null) {", - "", - " // Make sure it had a length of 0.", - " if (allElements.length !== 0) {", - " allOK = false;", - " }", - "}", - "", - "pm.test(\"There should be no citizens in the office\", function() {", - " pm.expect(allOK).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Create citizen (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77d15de-91e2-4528-87bd-5734405b4def", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Perform tests.", - " pm.test(\"Only one citizen should be in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - " pm.test(\"Current citizen comments should be null\", function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.null;", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - " ", - " // Store the ID of the citizen just created.", - " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", - "} ", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{}" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Edit specific citizen (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "ce732be5-38a3-4825-90d1-4d52babf8917", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "", - "// // Get data, create JSON body.", - "// var citizenName = postman.getEnvironmentVariable(\"citizen_name\");", - "// var citizenComments = postman.getEnvironmentVariable(\"citizen_comment\");", - "// var bodyData = {", - "// \"citizen_name\" : citizenName,", - "// \"citizen_comments\" : citizenComments", - "// }", - "", - "// // Store the data in an environment variable.", - "// postman.setEnvironmentVariable(\"putBody\", JSON.stringify(bodyData));" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "13828662-748d-4b3f-9ead-454e795f1f01", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - "", - " // Perform tests.", - " pm.test(\"Must be one active citizen in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}}\n}" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Add property tax via phone service request (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "fa6f6a3b-e4e7-42b6-a8d3-ecda3840418a", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" - }, - "url": { - "raw": "{{url}}service_requests/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "List specific citizen (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "2a57d1b2-9d0c-4e07-ad20-d4dde457f9d1", - "exec": [ - "// Install postmanBDD, json-bigint parse and stringify.", - "eval(globals.postmanBDD);", - "eval(globals.json_bigint_parse);", - "", - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request must have one period', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", - " });", - " pm.test('Service request period channel must be ' + citizenChannel, function() {", - " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", - " });", - " pm.test('Service request period state must be \"Ticket Creation\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Begin serving citizen (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "4550a6b7-560d-48bf-bfc9-41453a8defec", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (now two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Being Served\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/begin_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "begin_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Place citizen on hold (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "dd51a48d-2e1e-47fd-978f-507b77a7901f", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 3 (now three periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(3);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"On hold\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"On hold\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/place_on_hold/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "place_on_hold", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Get service requests (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "f4809d17-b59d-47fc-861e-5edaf421bddc", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.service_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - "var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - "var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get periods for the first service request.", - " var allPeriods = allElements[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " var allPeriodCount = 0;", - "", - " // Find how many periods there are with null end time.", - " // Also, check schema.", - " allPeriods.forEach(function(onePeriod) {", - " ", - " // Find the open period.", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " ", - " });", - "} ", - "", - "// If there are some service requests, proceed with tests.", - "if (allElements !== null) {", - "", - " // Perform tests.", - " pm.test('There must be only one service request', function() {", - " pm.expect(allElements.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(allElements[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(allElements[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(allElements[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request must have three periods', function() {", - " pm.expect(allPeriods.length).to.be.eql(3);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('Service request period state must be \"On hold\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"On hold\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/service_requests/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "service_requests", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Call citizen from hold (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "66563797-2a92-4dbd-946e-7232dcac8260", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 4 (now four periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(4);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Being Served\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/begin_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "begin_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Finish serving citizen (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "ec865f9c-a4b6-421f-956e-783972df2ad3", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - " ", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = allElements[0].service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be no active citizens in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Complete\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 4 (still four periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(4);", - " });", - " pm.test('There must be no open periods', function() {", - " pm.expect(openPeriodCount).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/finish_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "finish_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Check citizen leave after create (QT3)", - "item": [ - { - "name": "Check no citizens (QT3)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "6cb5de42-277f-4c2d-b5ef-64b0f514d5bd", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "2cbca8d4-50d9-4dde-9239-af3c987949b8", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var allOK = true;", - "", - "// If citizen property was present.", - "if (allElements !== null) {", - "", - " // Make sure it had a length of 0.", - " if (allElements.length !== 0) {", - " allOK = false;", - " }", - "}", - "", - "pm.test(\"There should be no citizens in the office\", function() {", - " pm.expect(allOK).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Create citizen (QT3)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "061a479c-37b4-4707-b8c6-c31cacadecec", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Perform tests.", - " pm.test(\"Only one citizen should be in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - " pm.test(\"Current citizen comments should be null\", function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.null;", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "", - " // Store the ID of the citizen just created.", - " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{}" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Citizen left (QT3)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "16eaefc2-0d16-405e-9e70-e85314da841b", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get environment variables.", - " var citizenName = postman.getEnvironmentVariable(\"citizen_name\");", - " var citizenComment = postman.getEnvironmentVariable(\"citizen_comment\");", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = null;", - " if (currentCitizen.service_reqs.length !== 0) {", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " }", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " if (allPeriods !== null) {", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - " }", - "", - " // Perform tests.", - " pm.test(\"Must be no active citizens in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - " pm.test(\"Current citizen comments should be null\", function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.null;", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/citizen_left/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "citizen_left", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Check citizen leave after waiting (QT4)", - "item": [ - { - "name": "Check no citizens (QT4)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "bc24cb66-e882-4b8a-b879-2d287078efab", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "2cbca8d4-50d9-4dde-9239-af3c987949b8", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var allOK = true;", - "", - "// If citizen property was present.", - "if (allElements !== null) {", - "", - " // Make sure it had a length of 0.", - " if (allElements.length !== 0) {", - " allOK = false;", - " }", - "}", - "", - "pm.test(\"There should be no citizens in the office\", function() {", - " pm.expect(allOK).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Create citizen (QT4)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "fcc1415c-0861-4516-8843-bfc3717a76d9", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Perform tests.", - " pm.test(\"Only one citizen should be in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - " pm.test(\"Current citizen comments should be null\", function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.null;", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "", - " // Store the ID of the citizen just created.", - " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{}" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Edit specific citizen (QT4)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "f26eaedb-5d41-4dcc-b856-aec599440601", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "", - "// // Get data, create JSON body.", - "// var citizenName = postman.getEnvironmentVariable(\"citizen_name\");", - "// var citizenComments = postman.getEnvironmentVariable(\"citizen_comment\");", - "// var bodyData = {", - "// \"citizen_name\" : citizenName,", - "// \"citizen_comments\" : citizenComments", - "// }", - "", - "// // Store the data in an environment variable.", - "// postman.setEnvironmentVariable(\"putBody\", JSON.stringify(bodyData));" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e0b48324-0ca2-4b2e-88ef-cbfbe10b5fb7", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - "", - " // Perform tests.", - " pm.test(\"Must be one active citizen in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}}\n}" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Add property tax via phone service request (QT4)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "fa6f6a3b-e4e7-42b6-a8d3-ecda3840418a", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" - }, - "url": { - "raw": "{{url}}service_requests/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "List specific citizen (QT4)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "1176fcca-52ff-4e13-b4a4-775ad324a4c6", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request must have one period', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", - " });", - " pm.test('Service request period channel must be ' + citizenChannel, function() {", - " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", - " });", - " pm.test('Service request period state must be \"Ticket Creation\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Add citizen to queue (QT4)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "f0aacc69-ff0e-4ed3-9ef7-f131bbf3a5bd", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Pending\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (now two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Waiting\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/add_to_queue/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "add_to_queue", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Citizen left (QT4)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "4ee90115-54c2-4b44-b6f1-d739e8a385b1", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test(\"Must be no active citizens in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test(\"Current citizen comments should be null\", function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.null;", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test(\"Citizen should have one service request\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Complete\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (now two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must be no open periods', function() {", - " pm.expect(openPeriodCount).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/citizen_left/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "citizen_left", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Check no citizens (QT4)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "6cb5de42-277f-4c2d-b5ef-64b0f514d5bd", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "2cbca8d4-50d9-4dde-9239-af3c987949b8", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var allOK = true;", - "", - "// If citizen property was present.", - "if (allElements !== null) {", - "", - " // Make sure it had a length of 0.", - " if (allElements.length !== 0) {", - " allOK = false;", - " }", - "}", - "", - "pm.test(\"There should be no citizens in the office\", function() {", - " pm.expect(allOK).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Check update service information (QT5)", - "item": [ - { - "name": "Check no citizens (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "4dd23acf-1f43-42be-b965-0b11121f33f3", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "2cbca8d4-50d9-4dde-9239-af3c987949b8", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var allOK = true;", - "", - "// If citizen property was present.", - "if (allElements !== null) {", - "", - " // Make sure it had a length of 0.", - " if (allElements.length !== 0) {", - " allOK = false;", - " }", - "}", - "", - "pm.test(\"There should be no citizens in the office\", function() {", - " pm.expect(allOK).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Create citizen (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "d3bbd88a-25fd-4fe6-ae7e-359373df02ac", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Perform tests.", - " pm.test(\"Only one citizen should be in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - " pm.test(\"Current citizen comments should be null\", function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.null;", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "", - " // Store the ID of the citizen just created.", - " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{}" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Edit specific citizen (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "2be395b2-e14c-4ff8-8753-42ea1fe2010d", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "", - "// // Get data, create JSON body.", - "// var citizenName = postman.getEnvironmentVariable(\"citizen_name\");", - "// var citizenComments = postman.getEnvironmentVariable(\"citizen_comment\");", - "// var bodyData = {", - "// \"citizen_name\" : citizenName,", - "// \"citizen_comments\" : citizenComments", - "// };", - "", - "// // Store the data in an environment variable.", - "// postman.setEnvironmentVariable(\"putBody\", JSON.stringify(bodyData));" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "2e7878d3-653e-479e-850f-c454b378217e", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - " ", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - "", - " // Perform tests.", - " pm.test(\"Must be one active citizen in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}}\n}" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Add property tax via phone service request (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "fa6f6a3b-e4e7-42b6-a8d3-ecda3840418a", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" - }, - "url": { - "raw": "{{url}}service_requests/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "List specific citizen (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "3d906a10-51fe-4329-bac0-e69e6847e852", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - " ", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request must have one period', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", - " });", - " pm.test('Service request period channel must be ' + citizenChannel, function() {", - " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", - " });", - " pm.test('Service request period state must be \"Ticket Creation\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", - " });", - "", - " // Save the service request ID for later.", - " var mySRId = allElements[0].service_reqs[0].sr_id;", - " postman.setEnvironmentVariable(\"current_sr_id\", JSON.stringify(mySRId));", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Begin serving citizen (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "ff3a25ca-0df2-40f2-b7a1-9e9b4bde2aab", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (now two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Being Served\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/begin_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "begin_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Update quantity from 3 to 5 (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "153a139d-0daa-4031-ba0a-e7204ade2648", - "exec": [ - "// Run complex tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.service_response_test);", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Only check for an updated quantity. Get environment variables.", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", - "", - " // Perform tests.", - " pm.test('Updated service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(allElements[0].quantity).to.be.eql(citizenQuantity);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"quantity\" : {{citizen_quantity_update}}\n}" - }, - "url": { - "raw": "{{url}}service_requests/{{current_sr_id}}/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "{{current_sr_id}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Update service from PropTax to MSP (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "8faaa693-a7a4-45ed-9318-325a498a98af", - "exec": [ - "// Run complex tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.service_response_test);", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Only check for an updated quantity. Get environment variables.", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", - "", - " // Perform tests.", - " pm.test('Updated service request service must be ' + citizenService, function() {", - " pm.expect(allElements[0].service_id).to.be.eql(citizenService);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_id\" : {{service_MSP_id}}\n}" - }, - "url": { - "raw": "{{url}}service_requests/{{current_sr_id}}/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "{{current_sr_id}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Finish serving citizen (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "7a831dcf-ff2c-4907-95c5-bf042cdd967a", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be no active citizens in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Complete\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (should be two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must be no open periods', function() {", - " pm.expect(openPeriodCount).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/finish_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "finish_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Check pick qtxn customer (QT6)", - "item": [ - { - "name": "Check no citizens (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "9f95832a-57ef-4dcf-bdfe-916d2eb5d006", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "0aa4fd7b-529c-4f26-9998-c77d6c28eeb4", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var citizenCount = 0;", - "", - "// If citizen property was present.", - "if (allElements !== null) {", - "", - " // Get number of citizens in the queue.", - " citizenCount = allElements.length;", - "}", - "", - "pm.test(\"There should be no citizens in the office\", function() {", - " pm.expect(citizenCount).to.be.eql(0);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "First citizen - Create (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "cac82cd1-b2c1-4019-bf8f-bf8dfed473ef", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Perform tests.", - " pm.test(\"Only one citizen should have been created\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - " pm.test(\"Current citizen comments should be null\", function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.null;", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "", - " // Store the ID of the citizen just created.", - " postman.setEnvironmentVariable(\"first_client\", JSON.stringify(citizenIds.shift()));", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{}" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "First citizen - Edit (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "f52aea38-cdcb-4d0b-8421-0ee5b7486913", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "a0ded2ba-3a0d-45ff-ac3a-ee25ad2bd578", - "exec": [ - "// Install postmanBDD, json-bigint parse and stringify.", - "eval(globals.postmanBDD);", - "eval(globals.json_bigint_parse);", - "", - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - "", - " // Perform tests.", - " pm.test(\"Must be one active citizen in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}},\n \"counter_id\": {{counter_id}}\n}" - }, - "url": { - "raw": "{{url}}citizens/{{first_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{first_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "First citizen - Prop Tax via phone (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "fa6f6a3b-e4e7-42b6-a8d3-ecda3840418a", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{first_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" - }, - "url": { - "raw": "{{url}}service_requests/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "First citizen - List (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "2eeb855a-cf49-4bab-abc4-739deef83d82", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request must have one period', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", - " });", - " pm.test('Service request period channel must be ' + citizenChannel, function() {", - " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", - " });", - " pm.test('Service request period state must be \"Ticket Creation\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{first_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{first_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "First citizen - Add to queue (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "c6bd4047-5ddb-4b96-9b1b-851455cbc71d", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Pending\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (now two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Waiting\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{first_client}}/add_to_queue/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{first_client}}", - "add_to_queue", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - Create (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "b5a2ef1c-c73c-4bc6-ba18-1370ba84bbe4", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Perform tests.", - " pm.test(\"Only one citizen should have been created\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - " pm.test(\"Current citizen comments should be null\", function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.null;", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "", - " // Store the ID of the citizen just created.", - " postman.setEnvironmentVariable(\"second_client\", JSON.stringify(citizenIds.shift()));", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{}" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - Edit QTxn (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "f58d00cd-ab75-407b-ab4c-a541944510e3", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "", - "// // Get data, create JSON body.", - "// var citizenName = postman.getEnvironmentVariable(\"citizen_name_quick\");", - "// var citizenComments = postman.getEnvironmentVariable(\"citizen_comment_quick\");", - "// var bodyData = {", - "// \"citizen_name\" : citizenName,", - "// \"citizen_comments\" : citizenComments,", - "// \"qt_xn_citizen_ind\" : 1", - "// };", - "", - "// // Store the data in an environment variable.", - "// postman.setEnvironmentVariable(\"putBody\", JSON.stringify(bodyData));" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "12b50df4-9162-4d6d-8ec4-ddebc3cb6cda", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", - "", - " // Perform tests.", - " pm.test(\"Should be updating single citizen\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"citizen_name\" : {{citizen_name_quick}},\n \"citizen_comments\" : {{citizen_comment_quick}},\n \"qt_xn_citizen_ind\" : 1,\n \"counter_id\": {{qtxn_id}}\n}" - }, - "url": { - "raw": "{{url}}citizens/{{second_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{second_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - MSP via email (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "fa6f6a3b-e4e7-42b6-a8d3-ecda3840418a", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_MSP_id}},\n\t\t\"citizen_id\" : {{second_client}},\n\t\t\"quantity\" : {{citizen_quantity_update}},\n\t\t\"channel_id\" : {{channel_email_id}}\n\t}\n}" - }, - "url": { - "raw": "{{url}}service_requests/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - List (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "6abcbbab-941e-43b4-85e8-6c2f14a19c75", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", - "", - " // Perform tests.", - " pm.test('Should be updating one citizen', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request must have one period', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", - " });", - " pm.test('Service request period channel must be ' + citizenChannel, function() {", - " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", - " });", - " pm.test('Service request period state must be \"Ticket Creation\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{second_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{second_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - Add to queue (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "b396fdd7-845d-4702-ad69-1b53a2ced21b", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Should be adding one citizen to the queue', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Pending\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (now two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Waiting\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{second_client}}/add_to_queue/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{second_client}}", - "add_to_queue", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Check 2 citizens in queue (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "070b3e97-88a9-4e82-ae4e-cf476625b4b9", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "09e9a82d-d782-4916-b84d-970d41f0e231", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var citizenCount = 0;", - "", - "// If citizen property was present.", - "if (allElements !== null) {", - "", - " // Get number of citizens in the queue.", - " citizenCount = allElements.length;", - "}", - "", - "pm.test('Must be two active citizens in the office', function() {", - " pm.expect(citizenCount).to.be.eql(2);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Set CSR to QTxn (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "070b3e97-88a9-4e82-ae4e-cf476625b4b9", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "09e9a82d-d782-4916-b84d-970d41f0e231", - "exec": [ - "// Define the JSON Schema expected in response", - "var CSRSSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"csr_id\": {\"type\": \"number\"},", - " \"csr_state\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"csr_state_desc\": {\"type\": \"string\"},", - " \"csr_state_id\": {\"type\": \"number\"},", - " \"csr_state_name\": {\"type\": \"string\"}", - " },", - " \"required\": [\"csr_state_desc\", \"csr_state_id\", \"csr_state_name\"]", - " },", - " \"csr_state_id\": {\"type\": \"number\"},", - " \"deleted\": {},", - " \"finance_designate\": {\"type\": \"number\"},", - " \"office_manager\": {\"type\": \"number\"},", - " \"ita2_designate\": {\"type\": \"number\"},", - " \"office\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"appointments_enabled_ind\": {\"type\": \"number\"},", - " \"exams_enabled_ind\": {\"type\": \"number\"},", - " \"office_id\": {\"type\": \"number\"},", - " \"office_name\": {\"type\": \"string\"},", - " \"office_number\": {\"type\": \"number\"},", - " \"sb\":{", - " \"type\": \"object\",", - " \"properties\": {", - " \"sb_id\": {\"type\": \"number\"},", - " \"sb_type\": {\"type\": \"string\"}", - " },", - " \"required\": [\"sb_id\", \"sb_type\"]", - " }", - " },", - " \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"sb\"]", - " },", - " \"pesticide_designate\": {\"type\": \"number\"},", - " \"qt_xn_csr_ind\": {\"type\": \"number\"},", - " \"receptionist_ind\": {\"type\": \"number\"},", - " \"role\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"role_code\": {\"type\": \"string\"},", - " \"role_desc\": {\"type\": \"string\"},", - " \"role_id\": {\"type\": \"number\"}", - " },", - " \"required\": [\"role_code\", \"role_desc\", \"role_id\"]", - " },", - " \"role_id\": {\"type\": \"number\"},", - " \"username\": {\"type\": \"string\"}", - " },", - " \"required\": [\"csr\"]", - "};", - "", - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate Response CSRs Schema\", function(){", - " pm.expect(tv4.validate(jsonData, CSRSSchema)).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"counter_id\": {{qtxn_id}}\n}" - }, - "url": { - "raw": "{{url}}csrs/{{current_csr_id}}/", - "host": [ - "{{url}}csrs" - ], - "path": [ - "{{current_csr_id}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Invite next citizen - should be second one (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "84ff5966-dfec-47d0-ae77-2c5819005fb9", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Should only be inviting one citizen', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 3 (now three periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(3);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Invited\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Invited\");", - " });", - "}", - "", - "// Store the ID of the citizen just invited.", - "postman.setEnvironmentVariable(\"current_client\", JSON.stringify(currentCitizenId));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/invite/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "invite", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - begin serving (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "caecf715-4ce2-4422-8374-b330c0433f4b", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one citizen being served', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 4 (now four periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(4);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Being Served\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/begin_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "begin_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - finish serving (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "d5890c30-3ce5-4807-9d17-bd58050dab44", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be no active citizen being served', function() {", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Complete\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 4 (still four periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(4);", - " });", - " pm.test('There must be no open periods', function() {", - " pm.expect(openPeriodCount).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/finish_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "finish_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Invite next citizen - should be first one (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "62e7f31d-0bd6-4337-bd70-f6a197063a00", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Should only be inviting one citizen', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 3 (now three periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(3);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Invited\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Invited\");", - " });", - "}", - "", - "// Store the ID of the citizen just invited.", - "postman.setEnvironmentVariable(\"current_client\", JSON.stringify(currentCitizenId));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/invite/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "invite", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "First citizen - citizen left (QT6)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e502775f-6829-45f8-a225-61c54e625c7f", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test(\"Must be no active citizen being served\", function() {", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test(\"Current citizen comments should be null\", function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.null;", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test(\"Citizen should have one service request\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Complete\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 3 (now three periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(3);", - " });", - " pm.test('There must be no open periods', function() {", - " pm.expect(openPeriodCount).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/citizen_left/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "citizen_left", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Check pick non-qtxn customer (QT7)", - "item": [ - { - "name": "Check no citizens (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c9275086-164f-4f82-884f-75b5710f0b65", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "0aa4fd7b-529c-4f26-9998-c77d6c28eeb4", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var citizenCount = 0;", - "", - "// If citizen property was present.", - "if (allElements !== null) {", - "", - " // Get number of citizens in the queue.", - " citizenCount = allElements.length;", - "}", - "", - "pm.test(\"There should be no citizens in the office\", function() {", - " pm.expect(citizenCount).to.be.eql(0);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "First citizen - Create (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "35c3241b-1fe5-423a-91bd-789ed675e61d", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Perform tests.", - " pm.test(\"Only one citizen should have been created\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - " pm.test(\"Current citizen comments should be null\", function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.null;", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "", - " // Store the ID of the citizen just created.", - " postman.setEnvironmentVariable(\"first_client\", JSON.stringify(citizenIds.shift()));", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{}" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "First citizen - Edit QTxn (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "b1833da7-f814-433f-8a11-295e244d9e4f", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "1eac614b-0f6c-4b84-8423-de10ffec680f", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", - "", - " // Perform tests.", - " pm.test(\"Must be editing only one citizen\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"citizen_name\" : {{citizen_name_quick}},\n \"citizen_comments\" : {{citizen_comment_quick}},\n \"qt_xn_citizen_ind\" : 1,\n \"counter_id\": {{qtxn_id}}\n}" - }, - "url": { - "raw": "{{url}}citizens/{{first_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{first_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "First citizen - MSP via email (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "fa6f6a3b-e4e7-42b6-a8d3-ecda3840418a", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_MSP_id}},\n\t\t\"citizen_id\" : {{first_client}},\n\t\t\"quantity\" : {{citizen_quantity_update}},\n\t\t\"channel_id\" : {{channel_email_id}}\n\t}\n}" - }, - "url": { - "raw": "{{url}}service_requests/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "First citizen - List (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "f695dc9f-e14f-4e39-8cc0-06d6bff46d1d", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", - "", - " // Perform tests.", - " pm.test('Must be editing only one citizen', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request must have one period', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", - " });", - " pm.test('Service request period channel must be ' + citizenChannel, function() {", - " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", - " });", - " pm.test('Service request period state must be \"Ticket Creation\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{first_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{first_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "First citizen - Add to queue (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "4ed70849-8f22-4cd0-ab73-582dd012ba60", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be adding only one citizen to the queue', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Pending\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (now two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Waiting\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{first_client}}/add_to_queue/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{first_client}}", - "add_to_queue", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - Create (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "dde23c45-a5d4-4ff0-85a0-bac3873a8574", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Perform tests.", - " pm.test(\"Only one citizen should have been created\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - " pm.test(\"Current citizen comments should be null\", function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.null;", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "", - " // Store the ID of the citizen just created.", - " postman.setEnvironmentVariable(\"second_client\", JSON.stringify(citizenIds.shift()));", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{}" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - Edit (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "03647497-dfc2-437d-bace-b6ab2a08fa7b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "9f22638b-3ebc-404e-a43b-fb8af32a2083", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - "", - " // Perform tests.", - " pm.test(\"Should be updating single citizen\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}},\n \"counter_id\": {{counter_id}}\n}" - }, - "url": { - "raw": "{{url}}citizens/{{second_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{second_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - Prop Tax via phone (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "fa6f6a3b-e4e7-42b6-a8d3-ecda3840418a", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{second_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" - }, - "url": { - "raw": "{{url}}service_requests/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - List (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "dcfc340a-b267-4a1b-8f39-cbedfe02ef76", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", - "", - " // Perform tests.", - " pm.test('Should be updating one citizen', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request must have one period', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", - " });", - " pm.test('Service request period channel must be ' + citizenChannel, function() {", - " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", - " });", - " pm.test('Service request period state must be \"Ticket Creation\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{second_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{second_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - Add to queue (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "b82e3735-add5-4522-a418-a42931ba84ae", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Should be adding one citizen to the queue', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Pending\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (now two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Waiting\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{second_client}}/add_to_queue/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{second_client}}", - "add_to_queue", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Check 2 citizens in queue (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "070b3e97-88a9-4e82-ae4e-cf476625b4b9", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "09e9a82d-d782-4916-b84d-970d41f0e231", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var citizenCount = 0;", - "", - "// If citizen property was present.", - "if (allElements !== null) {", - "", - " // Get number of citizens in the queue.", - " citizenCount = allElements.length;", - "}", - "", - "pm.test('Must be two active citizens in the office', function() {", - " pm.expect(citizenCount).to.be.eql(2);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Set CSR to Counter (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "070b3e97-88a9-4e82-ae4e-cf476625b4b9", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "09e9a82d-d782-4916-b84d-970d41f0e231", - "exec": [ - "// Define the JSON Schema expected in response", - "var CSRSSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"csr_id\": {\"type\": \"number\"},", - " \"csr_state\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"csr_state_desc\": {\"type\": \"string\"},", - " \"csr_state_id\": {\"type\": \"number\"},", - " \"csr_state_name\": {\"type\": \"string\"}", - " },", - " \"required\": [\"csr_state_desc\", \"csr_state_id\", \"csr_state_name\"]", - " },", - " \"csr_state_id\": {\"type\": \"number\"},", - " \"deleted\": {},", - " \"finance_designate\": {\"type\": \"number\"},", - " \"office_manager\": {\"type\": \"number\"},", - " \"ita2_designate\": {\"type\": \"number\"},", - " \"office\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"appointments_enabled_ind\": {\"type\": \"number\"},", - " \"exams_enabled_ind\": {\"type\": \"number\"},", - " \"office_id\": {\"type\": \"number\"},", - " \"office_name\": {\"type\": \"string\"},", - " \"office_number\": {\"type\": \"number\"},", - " \"sb\":{", - " \"type\": \"object\",", - " \"properties\": {", - " \"sb_id\": {\"type\": \"number\"},", - " \"sb_type\": {\"type\": \"string\"}", - " },", - " \"required\": [\"sb_id\", \"sb_type\"]", - " }", - " },", - " \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"sb\"]", - " },", - " \"pesticide_designate\": {\"type\": \"number\"},", - " \"qt_xn_csr_ind\": {\"type\": \"number\"},", - " \"receptionist_ind\": {\"type\": \"number\"},", - " \"role\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"role_code\": {\"type\": \"string\"},", - " \"role_desc\": {\"type\": \"string\"},", - " \"role_id\": {\"type\": \"number\"}", - " },", - " \"required\": [\"role_code\", \"role_desc\", \"role_id\"]", - " },", - " \"role_id\": {\"type\": \"number\"},", - " \"username\": {\"type\": \"string\"}", - " },", - " \"required\": [\"csr\"]", - "};", - "", - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate Response CSRs Schema\", function(){", - " pm.expect(tv4.validate(jsonData, CSRSSchema)).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"counter_id\": {{counter_id}}\n}" - }, - "url": { - "raw": "{{url}}csrs/{{current_csr_id}}/", - "host": [ - "{{url}}csrs" - ], - "path": [ - "{{current_csr_id}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Invite next citizen - should be second one (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "cfcc38e7-765f-48aa-8600-159bbeda4994", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Should only be inviting one citizen', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 3 (now three periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(3);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Invited\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Invited\");", - " });", - "}", - "", - "// Store the ID of the citizen just invited.", - "postman.setEnvironmentVariable(\"current_client\", JSON.stringify(currentCitizenId));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/invite/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "invite", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - begin serving (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "0ceb5800-311b-4b82-9278-80e3296843ba", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one citizen being served', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 4 (now four periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(4);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Being Served\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/begin_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "begin_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Second citizen - finish serving (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "ec44532d-3f42-41f4-8faa-7803c188970f", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be no active citizen being served', function() {", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Complete\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 4 (still four periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(4);", - " });", - " pm.test('There must be no open periods', function() {", - " pm.expect(openPeriodCount).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/finish_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "finish_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Invite next citizen - should be first one (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "a4812ded-5043-426a-b837-91ac5f06ba62", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Should only be inviting one citizen', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 3 (now three periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(3);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Invited\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Invited\");", - " });", - "}", - "", - "// Store the ID of the citizen just invited.", - "postman.setEnvironmentVariable(\"current_client\", JSON.stringify(currentCitizenId));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/invite/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "invite", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "First citizen - citizen left (QT7)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "14a22c20-3902-4ca1-9e56-e97dde7b212b", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test(\"Must be no active citizen being served\", function() {", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test(\"Current citizen comments should be null\", function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.null;", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test(\"Citizen should have one service request\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Complete\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 3 (now three periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(3);", - " });", - " pm.test('There must be no open periods', function() {", - " pm.expect(openPeriodCount).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/citizen_left/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "citizen_left", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Setup Booking", - "item": [ - { - "name": "Setup-Variables", - "event": [ - { - "listen": "test", - "script": { - "id": "5409b66d-67a4-449b-8633-9aeca632b388", - "exec": [ - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "e9eed831-7955-4218-a400-ae6e1e7e2e10", - "exec": [ - "// See if the use-prefix global has been set. Use default if not.", - "let usePrefix = '';", - "if (pm.globals.get('use-prefix')) {", - " console.log(\"==> use-prefix exists\");", - " usePrefix = pm.globals.get('use-prefix');", - " console.log(\" --> Prefix is: \" + usePrefix);", - " ", - " // Set up all globals, using the correct prefix.", - " pm.globals.set('auth_url', pm.globals.get(usePrefix + 'auth_url'));", - " pm.globals.set('realm', pm.globals.get(usePrefix + 'realm'));", - " pm.globals.set('clientid', pm.globals.get(usePrefix + 'clientid'));", - " pm.globals.set('client_secret', pm.globals.get(usePrefix + 'client_secret'));", - " pm.globals.set('url', pm.globals.get(usePrefix + 'url'));", - "}", - "else {", - " console.log(\"==> use-prefix does not exist\");", - " console.log(\" --> No default globals set.\");", - "}", - "", - "// If no maximum load time defined, set a default.", - "if (!pm.globals.get('max_load_time')) {", - " console.log(\"==> max_load_time not present, default set.\");", - " pm.globals.set(\"max_load_time\", JSON.stringify(1503));", - "}", - "", - "// If no maximum response defined, set a default.", - "if (!pm.globals.get('max_response_time')) {", - " console.log(\"==> max_response_time not present, default set.\");", - " pm.globals.set(\"max_response_time\", JSON.stringify(15005));", - "}", - "", - "// Display the values of all globals.", - "console.log(\"\");", - "console.log(\"==> Globals are:\");", - "console.log(\" --> auth_url: \" + pm.globals.get(\"auth_url\"));", - "console.log(\" --> realm: \" + pm.globals.get(\"realm\"));", - "console.log(\" --> clientid: \" + pm.globals.get(\"clientid\"));", - "console.log(\" --> client_secret: \" + pm.globals.get(\"client_secret\"));", - "console.log(\" --> url: \" + pm.globals.get(\"url\"));", - "console.log(\" --> max_load_time: \" + pm.globals.get(\"max_load_time\"));", - "console.log(\" --> max_response_time: \" + pm.globals.get(\"max_response_time\"));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Dummy data." - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "Authentication Token", - "event": [ - { - "listen": "test", - "script": { - "id": "454ea7d6-4c7e-4571-8bc1-be7eed57d03a", - "exec": [ - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to make sure that the access token field is not null", - "pm.test(\"Access Token is not null\", function(){", - " var access_token = jsonData.access_token;", - " if (pm.expect(access_token).not.eql(null)){", - " pm.globals.set(\"token\", access_token);", - " }", - "});", - "//Test to make sure that the refresh token response field is not null", - "pm.test(\"Refresh Token is not null\", function(){", - " var refresh_token = jsonData.refresh_token;", - " if (pm.expect(refresh_token).not.eql(null)){", - " pm.globals.set(\"refresh_token\", refresh_token);", - " }", - "});", - "//Test to make sure that expires in response field is not nullf", - "pm.test(\"Expires In is not null\", function(){", - " var expires_in = jsonData.expires_in;", - " if (pm.expect(expires_in).not.eql(null)){", - " pm.globals.set(\"expires_in\", expires_in);", - " }", - "});", - "//Test to make sure that refresh expires in response fiels is not null", - "pm.test(\"Refresh Expires In is not null\", function(){", - " var refresh_expires_in = jsonData.refresh_expires_in;", - " if (pm.expect(refresh_expires_in).not.eql(null)){", - " pm.globals.set(\"refresh_expires_in\", refresh_expires_in);", - " }", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/x-www-form-urlencoded", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "grant_type=password&client_id={{clientid}}&username={{userid}}&password={{password}}&client_secret={{client_secret}}" - }, - "url": { - "raw": "{{auth_url}}/auth/realms/{{realm}}/protocol/openid-connect/token?Content-Type=application/x-www-form-urlencoded", - "host": [ - "{{auth_url}}" - ], - "path": [ - "auth", - "realms", - "{{realm}}", - "protocol", - "openid-connect", - "token" - ], - "query": [ - { - "key": "Content-Type", - "value": "application/x-www-form-urlencoded" - } - ] - } - }, - "response": [] - }, - { - "name": "CFMS-Install-Auth-First", - "event": [ - { - "listen": "test", - "script": { - "id": "5409b66d-67a4-449b-8633-9aeca632b388", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"auth_first\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "auth_url = globals.auth_url;\nrealm = globals.realm;\nclientid = globals.clientid;\nuserid = globals.userid;\npassword = globals.password;\nclient_secret = globals.client_secret;\n\nconst echoPostRequest = {\n url: auth_url + '/auth/realms/' + realm + '/protocol/openid-connect/token',\n method: 'POST',\n header: 'Content-Type:application/x-www-form-urlencoded',\n body: {\n mode: 'raw',\n raw: 'grant_type=password&client_id=' + clientid \n + '&username=' + userid \n + '&password=' + password\n + '&client_secret=' + client_secret\n }\n};\npm.sendRequest(echoPostRequest, function (err, res) {\n var jsonData = res.json();\n if (jsonData.hasOwnProperty('access_token')) {\n \tpm.globals.set(\"token\", jsonData.access_token);\n\t pm.globals.set(\"refresh_token\", jsonData.refresh_token);\n\t console.log(err ? err : res.json());\n\t} else {\n\t pm.globals.set(\"token\", 0);\n\t pm.globals.set(\"refresh_token\", 0);\n\t pm.globals.set(\"token_expires\", 0);\n\t pm.globals.set(\"refresh_token_expires\", 0);\n\t}\n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Basic-Response-Tests", - "event": [ - { - "listen": "test", - "script": { - "id": "a0d8e240-3b40-4654-a32b-bf2e676fdeb9", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"basic_response_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// If no maximum response defined, set a default.\nresponse_max = 0;\nif (globals.response_max) {\n response_max = JSON.parse(globals.response_max);\n}\nelse {\n response_max = 5009;\n pm.globals.set(\"response_max\", JSON.stringify(response_max));\n};\n\n// Get the max response time allowed.\npm.test('Response time less than ' + response_max.toString() + 'ms', function(){\n pm.expect(pm.response.responseTime).to.be.below(response_max);\n});\n\npm.test(\"Response code for request is 200\", function(){\n pm.response.to.have.status(200);\n});\npm.test('Response header should have Content-Type of application/json', function() {\n pm.response.to.have.header('content-type', 'application/json');\n});\npm.test('Response body be in JSON format', function() {\n pm.response.to.be.json; \n});" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Exam-Type-Data", - "event": [ - { - "listen": "test", - "script": { - "id": "382b7b65-d736-4a03-a44a-3891f33b617d", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"init_exam_type_data\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Finds an exam name in the JSON list allTypes of exam types.\nfunction find_exam(input_exam_name, allTypes) {\n\texam_id_value = -1;\n\n // Loop to look for the input exam name.\n if (allTypes) {\n allTypes.forEach(function(type) {\n if ((type.exam_type_name) == input_exam_name) {\n exam_id_value = type.exam_type_id;\n }\n });\n }\n \n // If the exam wasn't found, set it to be the first exam.\n if (exam_id_value == -1) {\n exam_id_value = allTypes[0].exam_type_id;\n }\n\n // Return the exam_id_type of the input exam name.\n return exam_id_value;\n}\n\n// Get the list of all possible exam types.\nallTypes = null;\nvar jsonData = JSON.parse(responseBody);\nif (jsonData.hasOwnProperty(\"exam_types\")) {\n\tallTypes = jsonData.exam_types;\n}\n\nexam_array = [];\nexam_array.push({name: \"Pesticide\", weight: 40.2, id: find_exam(\"Pesticide\", allTypes)});\nname = \"IPSE - 4HR Single Exam\";\nexam_array.push({name: name, weight: exam_array[0].weight + 14.5, id: find_exam(name, allTypes)});\nname = \"SLE - 3HR Group Exam\";\nexam_array.push({name: name, weight: exam_array[1].weight + 7.4, id: find_exam(name, allTypes)});\nname = \"COFQ - 3HR Group Exam\";\nexam_array.push({name: name, weight: exam_array[2].weight + 5.8, id: find_exam(name, allTypes)});\nname = \"IPSE - 4HR Group Exam\";\nexam_array.push({name: name, weight: exam_array[3].weight + 5.7, id: find_exam(name, allTypes)});\nname = \"COFQ - 3HR Single Exam\";\nexam_array.push({name: name, weight: exam_array[4].weight + 5.5, id: find_exam(name, allTypes)});\nname = \"Monthly Session Exam\";\nexam_array.push({name: name, weight: exam_array[5].weight + 3.8, id: find_exam(name, allTypes)});\nname = \"SLE - 3HR Single Exam\";\nexam_array.push({name: name, weight: exam_array[6].weight + 3.5, id: find_exam(name, allTypes)});\nname = \"Angling Guide Outfitter\";\nexam_array.push({name: name, weight: exam_array[7].weight + 2.4, id: find_exam(name, allTypes)});\nname = \"IPSE - 5HR Single Exam - Time Extension\";\nexam_array.push({name: name, weight: exam_array[8].weight + 2.3, id: find_exam(name, allTypes)});\nname = \"Exam Booking - 3 Hour Miscellaneous\";\nexam_array.push({name: name, weight: exam_array[9].weight + 1.7, id: find_exam(name, allTypes)});\n\n// Store the initialized exam data for later use.\npostman.setEnvironmentVariable(\"exam_array_data\", JSON.stringify(exam_array));" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Exam-Get-Random", - "event": [ - { - "listen": "test", - "script": { - "id": "382b7b65-d736-4a03-a44a-3891f33b617d", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"create_random_functions\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Function returns a weighted randomized exam type index.\nfunction get_random_index(exam_array) {\n\n // Generate a random number up to the maximum weight allowed.\n random_number = Math.floor(Math.random() * exam_array[exam_array.length - 1].weight);\n \n // Get the index of the exam type corresponding to that weight.\n index = get_index(random_number, exam_array);\n\n // Return the index.\n return index;\n}\n\n// Based on a random number, turns it into a weighted randomized exam type index.\nfunction get_index(random_value, exam_array) {\n index = 0;\n var i;\n for (i = 0; i < exam_array.length; i++) {\n if (random_value <= exam_array[i].weight) {\n index = i;\n break;\n }\n }\n \n return index;\n}\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Exam-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "id": "8cebcf78-f5a2-4694-b108-60e146791a78", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"exam_schema_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the JSON Schema expected in response\nvar examSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"exam\": {\n \"type\": \"object\",\n \"properties\": {\n \"booking_id\": {},\n \"deleted_date\": {},\n \"event_id\": {\"type\": \"string\"},\n \"exam_id\": {\"type\": \"number\"},\n \"exam_method\": {\"type\": \"string\"},\n \"exam_name\": {\"type\": \"string\"},\n \"exam_received_date\": {},\n \"exam_returned_tracking_number\": {},\n \"exam_type\": {\n \"type\": \"object\",\n \"properties\": {\n \"exam_color\": {\"type\": \"string\"},\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_type_name\": {\"type\": \"string\"},\n \"group_exam_ind\": {\"type\": \"number\"},\n \"ita_ind\": {\"type\": \"number\"},\n \"method_type\": {\"type\": \"string\"},\n \"number_of_hours\": {\"type\": \"number\"},\n \"number_of_minutes\": {\"type\": [\"number\", \"null\"]},\n \"pesticide_exam_ind\": {\"type\": \"number\" }\n },\n \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"group_exam_ind\", \"ita_ind\", \"method_type\", \"number_of_hours\", \"number_of_minutes\", \"pesticide_exam_ind\"]\n },\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_written_ind\": {\"type\": \"number\"},\n \"examinee_name\": {\"type\": \"string\"},\n \"expiry_date\": {\"type\": [\"string\", \"null\"]},\n \"notes\": {\"type\": \"string\"},\n \"number_of_students\": {\"type\": \"number\"},\n \"office\":{\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\" },\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\" : \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n },\n },\n \"required\": []\n },\n \"office_id\": {\"type\": \"number\"},\n \"offsite_location\": {},\n \"session_number\": {\"type\": [\"number\", \"null\"]},\n \"booking\": {}\n },\n \"required\": [\"booking\", \"booking_id\", \"deleted_date\", \"event_id\", \"exam_id\", \"exam_method\", \"exam_name\", \"exam_received_date\", \"exam_returned_tracking_number\", \"exam_type\", \"exam_type_id\", \"exam_written_ind\", \"examinee_name\", \"expiry_date\", \"notes\", \"number_of_students\", \"office\", \"office_id\", \"offsite_location\", \"session_number\"]\n }\n },\n \"required\": [\"exam\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Exam Schema\", function(){\n pm.expect(tv4.validate(jsonData, examSchema)).to.be.true;\n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Exam-Data-Check", - "event": [ - { - "listen": "test", - "script": { - "id": "8cebcf78-f5a2-4694-b108-60e146791a78", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"exam_data_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Make sure that jsonData has an exam property.\npm.test(\"Response should have exam property\", function(){\n pm.expect(jsonData.hasOwnProperty(\"exam\")).to.be.true;\n});\n\n// If jsonData has exam property, check data.\nif (jsonData.hasOwnProperty(\"exam\")) {\n\n //Test to see if Event ID field remains unchanged\n pm.test(\"Validate Event Id has expected value\", function(){\n pm.expect(jsonData.event_id === environment.event_id);\n });\n\n //Test to see if exam method field remains unchanged\n pm.test(\"Validate exam method has expected value\", function(){\n pm.expect(jsonData.exam_method === environment.exam_method);\n });\n\n //Test to see if exam name field remains unchanged\n pm.test(\"Validate exam name has expected value\", function(){\n pm.expect(jsonData.exam_name === environment.exam_name);\n });\n\n //Test to see if exam type field remains unchanged\n pm.test(\"Validate exam type id has expected value\", function(){\n pm.expect(jsonData.exam_type_id === environment.random_exam_type_id);\n });\n\n //Test to see if exam written indicator field remains unchanged\n pm.test(\"Validate exam written indicator has expected value\", function(){\n pm.expect(jsonData.exam_written_ind === environment.exam_written_ind);\n });\n\n //Test to see if examinee name field remains unchanged\n pm.test(\"Validate examinee name has expected value\", function(){\n pm.expect(jsonData.examinee_name === environment.examinee_name);\n });\n\n //Test to see if notes field remains unchanged\n pm.test(\"Validate notes has expected value\", function(){\n pm.expect(jsonData.notes === environment.notes);\n });\n\n //Test to see if number of students field remains unchanged\n pm.test(\"Validate number of students has expected value\", function(){\n pm.expect(jsonData.number_of_students === environment.number_of_students);\n });\n\n //Test to see if office id remains unchanged\n pm.test(\"Validate office id has expected value\", function(){\n pm.expect(jsonData.office_id === environment.current_office_id);\n });\n\n //Test to see if offsite location is expected\n pm.test(\"Validate offsite location has expected value\", function(){\n pm.expect(jsonData.offsite_location === environment.offsite_location);\n });\n}\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Exam-List-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "id": "8cebcf78-f5a2-4694-b108-60e146791a78", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"exam_schema_list_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the JSON Schema expected in response\nvar examSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"exams\": {\n \"type\": \"array\",\n \"properties\": {\n \"booking_id\": {},\n \"deleted_date\": {},\n \"event_id\": {\"type\": \"string\"},\n \"exam_id\": {\"type\": \"number\"},\n \"exam_method\": {\"type\": \"string\"},\n \"exam_name\": {\"type\": \"string\"},\n \"exam_received_date\": {},\n \"exam_returned_tracking_number\": {},\n \"exam_type\": {\n \"type\": \"object\",\n \"properties\": {\n \"exam_color\": {\"type\": \"string\"},\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_type_name\": {\"type\": \"string\"},\n \"group_exam_ind\": {\"type\": \"number\"},\n \"ita_ind\": {\"type\": \"number\"},\n \"method_type\": {\"type\": \"string\"},\n \"number_of_hours\": {\"type\": \"number\"},\n \"number_of_minutes\": {\"type\": \"number\"},\n \"pesticide_exam_ind\": {\"type\": \"number\" }\n },\n \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"group_exam_ind\", \"ita_ind\", \"method_type\", \"number_of_hours\", \"number_of_minutes\", \"pesticide_exam_ind\"]\n },\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_written_ind\": {\"type\": \"number\"},\n \"examinee_name\": {\"type\": \"string\"},\n \"expiry_date\": {\"type\": [\"string\", \"null\"]},\n \"notes\": {\"type\": \"string\"},\n \"number_of_students\": {\"type\": \"number\"},\n \"office\":{\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\" },\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\" : \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n },\n },\n \"required\": []\n },\n \"office_id\": {\"type\": \"number\"},\n \"offsite_location\": {},\n \"session_number\": {\"type\": [\"number\", \"null\"]},\n \"booking\": {}\n },\n \"required\": [\"booking\", \"booking_id\", \"deleted_date\", \"event_id\", \"exam_id\", \"exam_method\", \"exam_name\", \"exam_received_date\", \"exam_returned_tracking_number\", \"exam_type\", \"exam_type_id\", \"exam_written_ind\", \"examinee_name\", \"expiry_date\", \"notes\", \"number_of_students\", \"office\", \"office_id\", \"offsite_location\", \"session_number\"]\n }\n },\n \"required\": [\"exams\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Exam List Schema\", function(){\n pm.expect(tv4.validate(jsonData, examSchema)).to.be.true;\n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Booking-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "id": "8cebcf78-f5a2-4694-b108-60e146791a78", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"booking_schema_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the JSON Schema expected in response\nvar bookingSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"booking\": {\n \"type\": \"object\",\n \"properties\": {\n \"blackout_flag\": {\"type\": \"string\"},\n \"blackout_notes\": {\"type\": [\"string\", \"null\"]},\n \"booking_contact_information\": {\"type\": [\"string\", \"null\"]},\n \"booking_id\": {\"type\": \"number\"},\n \"booking_name\": {\"type\": [\"string\", \"null\"]},\n \"end_time\": {\"type\": \"string\"},\n \"fees\": {\"type\": \"string\"},\n \"invigilators\": {\"type\": \"array\"},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"timezone\": {}\n },\n \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"timezone\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"recurring_uuid\": {\"type\": [\"string\", \"null\"]},\n \"room\": {\n \"type\": \"object\",\n \"properties\": {\n \"capacity\": {\"type\": \"number\"},\n \"color\": {\"type\": \"string\"},\n \"deleted\": {\"type\": [\"string\", \"null\"]},\n \"room_id\": {\"type\": \"number\"},\n \"room_name\": {\"type\": \"string\"}\n },\n \"required\": [\"capacity\", \"color\", \"room_id\", \"room_name\", \"deleted\"]\n },\n \n \"room_id\": {\"type\": \"number\"},\n \"sbc_staff_invigilated\": {\"type\": \"number\"},\n \"shadow_invigilator_id\": {\"type\": [\"number\", \"null\"]},\n \"start_time\": {\"type\": \"string\"}\n },\n \"required\": [\"blackout_flag\", \"blackout_notes\", \"booking_contact_information\", \"booking_id\",\n \"booking_name\", \"end_time\", \"fees\", \"invigilators\", \"office\", \"office_id\",\n \"recurring_uuid\", \"room\", \"room_id\", \"sbc_staff_invigilated\", \"shadow_invigilator_id\",\n \"start_time\"]\n },\n \"errors\": { \"type\": \"object\" }\n },\n \"required\": [\"booking\", \"errors\"]\n}\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Booking Schema\", function(){\n pm.expect(tv4.validate(jsonData, bookingSchema)).to.be.true;\n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Booking-Data-Check", - "event": [ - { - "listen": "test", - "script": { - "id": "8cebcf78-f5a2-4694-b108-60e146791a78", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"booking_data_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Make sure that jsonData has an booking property.\npm.test(\"Response should have booking property\", function(){\n pm.expect(jsonData.hasOwnProperty(\"booking\")).to.be.true;\n});\n\n// If jsonData has booking property, check data.\nif (jsonData.hasOwnProperty(\"booking\")) {\n\n //Test to see if booking name has expected value\n pm.test(\"Validate Booking Name has expected value\", function(){\n pm.expect(jsonData.booking_name === environment.booking_name);\n });\n\n //Test to see if start time has expected value\n pm.test(\"Validate start time has expected value\", function(){\n pm.expect(jsonData.start_time === environment.start_time);\n });\n\n //Test to see if end time has expected value\n pm.test(\"Validate end time has expected value\", function(){\n pm.expect(jsonData.end_time === environment.end_time);\n });\n\n //Test to see if room id has expected value\n pm.test(\"Validate room id has expected value\", function(){\n pm.expect(jsonData.room_id === environment.room_id_1);\n });\n\n //Test to see if fees field has expected value\n pm.test(\"Validate fees has expected value\", function(){\n pm.expect(jsonData.fees === environment.fees);\n });\n\n //Test to see if office id field has expected value\n pm.test(\"Validate office id has expected value\", function(){\n pm.expect(jsonData.office_id === environment.current_office_id);\n });\n}\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Booking-List-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "id": "8cebcf78-f5a2-4694-b108-60e146791a78", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"booking_list_schema_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "var bookingSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"bookings\": {\n \"type\": \"array\",\n \"properties\": {\n \"booking_contact_information\": {},\n \"booking_id\": {\"type\": \"number\"},\n \"booking_name\": {\"type\": \"string\"},\n \"end_time\": {\"type\": \"string\"},\n \"fees\": {\"type\": \"string\"},\n \"invigilator\": {},\n \"invigilator_id\": {},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"sb_id\": {\"type\": \"number\"},\n \"timezone\": {}\n },\n \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"sb\", \"sb_id\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"room\": {\n \"type\": \"object\",\n \"properties\": {\n \"capacity\": {\"type\": \"number\"},\n \"color\": {\"type\": \"string\"},\n \"room_id\": {\"type\": \"number\"},\n \"room_name\": {\"type\": \"string\"}\n },\n \"required\": [\"capacity\", \"color\", \"room_id\", \"room_name\"]\n },\n \"room_id\": {\"type\": \"number\"},\n \"start_time\": {\"type\": \"string\"},\n },\n \"required\": [\"booking_contact_information\", \"booking_id\", \"booking_name\", \"end_time\", \"fees\", \"room\", \"room_id\", \"start_time\", \"invigilator_id\", \"office\", \"office_id\"]\n },\n \"errors\": {\n \"type\": \"object\",\n \"properties\": {}\n }\n },\n \"required\": [\"bookings\", \"errors\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Booking List Schema\", function(){\n pm.expect(tv4.validate(jsonData, bookingSchema)).to.be.true;\n});" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Appointment-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "id": "8cebcf78-f5a2-4694-b108-60e146791a78", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"appointment_schema_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the JSON Schema expected in response\nvar appointmentSchema = {\n \"type\": \"object\", \n \"properties\": {\n \"appointment\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointment_id\": {\"type\": \"number\"},\n \"checked_in_time\": {\"type\": [\"string\", \"null\"]},\n \"citizen_name\": {\"type\": \"string\"},\n \"comments\": {\"type\": \"string\"},\n \"contact_information\": {},\n \"end_time\": {\"type\": \"string\"},\n \"office\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"service_id\": {\"type\": \"number\"},\n \"start_time\": {\"type\": \"string\"},\n \n },\n \"required\": [\"appointment_id\", \"checked_in_time\", \"citizen_name\", \"comments\", \"contact_information\", \"end_time\", \"office\", \"office_id\", \"service_id\", \"start_time\"],\n \"errors\": {}\n }\n },\n \"required\": [\"appointment\"],\n \"errors\": {}\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Appointments Schema\", function(){\n pm.expect(tv4.validate(jsonData, appointmentSchema)).to.be.true;\n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Appointment-Data-Check", - "event": [ - { - "listen": "test", - "script": { - "id": "8cebcf78-f5a2-4694-b108-60e146791a78", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"appointment_data_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Make sure that jsonData has an appointment property.\npm.test(\"Response should have appointment property\", function(){\n pm.expect(jsonData.hasOwnProperty(\"appointment\")).to.be.true;\n});\n\n// If jsonData has booking property, check data.\nif (jsonData.hasOwnProperty(\"appointment\")) {\n\n //Test to see if service id has expected value\n pm.test(\"Validate Service ID has expected value\", function(){\n pm.expect(jsonData.service_id === environment.service_id);\n });\n\n //Test to see if office id has expected value\n pm.test(\"Validate office id has expected value\", function(){\n pm.expect(jsonData.office_id === environment.current_office_id);\n });\n\n //Test to see if start time has expected value\n pm.test(\"Validate start time has expected value\", function(){\n pm.expect(jsonData.start_time === environment.start_time);\n });\n\n //Test to see if end time has expected value\n pm.test(\"Validate end time has expected value\", function(){\n pm.expect(jsonData.end_time === environment.end_time);\n });\n\n //Test to see if category has expected value\n pm.test(\"Validate category has expected value\", function(){\n pm.expect(jsonData.category === environment.category);\n });\n\n //Test to see if comments field has expected value\n pm.test(\"Validate comments has expected value\", function(){\n pm.expect(jsonData.comments === environment.comments);\n });\n\n //Test to see if citizen name field has expected value\n pm.test(\"Validate citizen name has expected value\", function(){\n pm.expect(jsonData.citizen_name === environment.citizne_name);\n });\n}\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Appointment-List-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "id": "8cebcf78-f5a2-4694-b108-60e146791a78", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"appointment_list_schema_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the JSON Schema expected in response\nvar appointmentSchema = {\n \"type\": \"object\", \n \"properties\": {\n \"appointments\": {\n \"type\": \"array\",\n \"properties\": {\n \"appointment_id\": {\"type\": \"number\"},\n \"checked_in_time\": {\"type\": [\"string\", \"null\"]},\n \"citizen_name\": {\"type\": \"string\"},\n \"comments\": {\"type\": \"string\"},\n \"contact_information\": {},\n \"end_time\": {\"type\": \"string\"},\n \"office\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"service_id\": {\"type\": \"number\"},\n \"start_time\": {\"type\": \"string\"},\n \n },\n \"required\": [\"appointment_id\", \"checked_in_time\", \"citizen_name\", \"comments\", \"contact_information\", \"end_time\", \"office\", \"office_id\", \"service_id\", \"start_time\"],\n \"errors\": {}\n }\n },\n \"required\": [\"appointments\"],\n \"errors\": {}\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Appointment List Schema\", function(){\n pm.expect(tv4.validate(jsonData, appointmentSchema)).to.be.true;\n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "Who am I TheQ", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "if (jsonData.hasOwnProperty(\"csr\")) {", - "\tcurrentOfficeId = jsonData.csr.office_id;", - "\tcurrentOfficeNumber = jsonData.csr.office.office_number;", - "\tcurrentCsrId = jsonData.csr.csr_id;", - " postman.setEnvironmentVariable(\"current_office_id\", currentOfficeId);", - " postman.setEnvironmentVariable(\"current_office_number\", currentOfficeNumber);", - " postman.setEnvironmentVariable(\"current_csr_id\", currentCsrId);", - "};", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}csrs/me/", - "host": [ - "{{url}}csrs" - ], - "path": [ - "me", - "" - ] - } - }, - "response": [] - }, - { - "name": "Get Room IDs", - "event": [ - { - "listen": "test", - "script": { - "id": "859ae114-22c4-4f3e-9f1f-9f0e06fbc29d", - "exec": [ - "// Define the JSON Schema expected in response", - "var roomSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"rooms\": {", - " \"type\": \"array\",", - " \"properties\": {", - " \"capacity\": {\"type\": \"number\"},", - " \"color\": {\"type\": \"string\"},", - " \"office\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"office_id\": {\"type\": \"number\"},", - " \"office_name\": {\"type\": \"string\"},", - " \"office_number\": {\"type\": \"number\"},", - " \"sb\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"sb_id\": {\"type\": \"number\"},", - " \"sb_type\": {\"type\": \"string\"}", - " },", - " \"required\": [\"sb_id\", \"sb_type\"]", - " },", - " \"sb_id\": {\"type\": \"number\"} ", - " },", - " \"required\": [\"office_id\", \"office_name\", \"office_number\", \"sb\", \"sb_id\"]", - " }", - " },", - " \"required\": [\"capacity\", \"color\", \"office\", \"room_id\", \"room_name\"]", - " }", - " }", - "};", - "", - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Get the max response time allowed.", - "var response_max = JSON.parse(globals.response_max);", - "", - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate Response Room Schema\", function(){", - " pm.expect(tv4.validate(jsonData, roomSchema)).to.be.true;", - "});", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "if (jsonData.hasOwnProperty(\"rooms\")) {", - " console.log(\"==> Rooms\");", - " room_id_1 = jsonData.rooms[0].room_id;", - " room_id_2 = room_id_1;", - " if (jsonData.rooms.length > 1) {", - " room_id_2 = jsonData.rooms[1].room_id;", - " }", - " postman.setEnvironmentVariable(\"room_id_1\", JSON.stringify(room_id_1.toString()));", - " postman.setEnvironmentVariable(\"room_id_2\", JSON.stringify(room_id_2.toString()));", - "}", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "462566f5-d6cd-4c14-9b11-0cbf7abc0caf", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}rooms/", - "host": [ - "{{url}}rooms" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Get Service IDs", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "d01c3826-dc28-4cce-957b-ec70d0393e7e", - "exec": [ - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "3b11031e-4031-4569-91f2-49e23517ffee", - "exec": [ - "// Run basic tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "var schema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"services\": {", - " \"type\": \"array\",", - " \"properties\": {", - " \"display_dashboard_ind\" : {", - " \"type\" : \"number\"", - " },", - " \"deleted\" : {", - " \"type\" : [\"object\", \"null\"]", - " },", - " \"actual_service_ind\" : {", - " \"type\" : \"number\"", - " },", - " \"service_id\" : {", - " \"type\" : [\"number\", \"object\"]", - " },", - " \"service_code\" : {", - " \"type\" : \"string\"", - " },", - " \"prefix\" : {", - " \"type\" : \"string\"", - " },", - " \"service_name\" : {", - " \"type\" : \"string\"", - " },", - " \"parent_id\" : {", - " \"type\" : [\"object\", \"number\", \"null\" ]", - " },", - " \"service_desc\" : {", - " \"type\" : \"string\"", - " }", - " },", - " \"required\" : [\"display_dashboard_ind\", \"deleted\", \"actual_service_ind\", \"service_id\", \"service_code\",", - " \"prefix\", \"service_name\", \"parent_id\", \"service_desc\"]", - " }", - " }", - "};", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate Service Schema\", function(){", - " pm.expect(tv4.validate(jsonData, schema)).to.be.true;", - "});", - "", - "// Loop to validate schema of each channel.", - "var allElements = jsonData.services;", - "var elementCount = 0;", - "var elementMax = Math.min(10, allElements.length);", - "//allElements.forEach(function(element) {", - "for (var currentElement = 0; currentElement < elementMax; currentElement++) {", - " element = allElements[currentElement];", - " elementCount ++;", - " var testTitle = \"Service (\" + elementCount + \"): \" + element.service_name;", - " pm.test(\"Validate Schema for \" + testTitle, function(){", - " pm.expect(tv4.validate(element, schema)).to.be.true;", - " });", - " ", - " // Test the authenticate response.", - " pm.test(\"--> \" + testTitle + \" dashboard_ind must be 0 or 1\", function() {", - " pm.expect(element.display_dashboard_ind).to.be.within(0,1);", - " });", - " pm.test(\"--> \" + testTitle + \" actual_service_ind must be 1\", function() {", - " pm.expect(element.actual_service_ind).to.be.eql(1);", - " });", - " pm.test(\"--> \" + testTitle + \" parent_id must not be null\", function() {", - " pm.expect(element.parent_id).to.not.be.null;", - " });", - "}", - "", - "// Declare and initialize variables.", - "var mspId = 0;", - "var taxId = 0;", - "var mspText = \"Payment - MSP\";", - "var propTaxText = \"Other - PTAX\";", - "", - "// Look for the MSP and Property Tax IDs.", - "allElements.forEach(function(element) {", - " if (element.service_name === mspText) {", - " mspId = element.service_id;", - " }", - " if (element.service_name === propTaxText) {", - " taxId = element.service_id;", - " }", - "});", - "", - "// Check that you found the service IDs.", - "pm.test(\"The \" + mspText + \" service ID (\" + mspId.toString() + \") should not equal 0\", function() {", - " pm.expect(mspId).to.not.be.eql(0);", - "});", - "", - "pm.test(\"The \" + propTaxText + \" service ID (\" + taxId.toString() + \") should not equal 0\", function() {", - " pm.expect(taxId).to.not.be.eql(0);", - "});", - "", - "// Store these IDs for future use.", - "postman.setEnvironmentVariable(\"service_MSP_id\", JSON.stringify(mspId));", - "postman.setEnvironmentVariable(\"service_PropTax_id\", JSON.stringify(taxId));" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}services/", - "host": [ - "{{url}}services" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ] - }, - { - "name": "Check app health", - "item": [ - { - "name": "Check healthz driver Booking", - "event": [ - { - "listen": "test", - "script": { - "id": "74adc5ce-caa5-452a-bd96-8ac90a4c11d7", - "exec": [ - "// Set health response time variable.", - "max_response_time = 1500;", - "health_tries = 15;", - "counter = 1;", - "postman.setEnvironmentVariable(\"max_response_time\", JSON.stringify(max_response_time));", - "postman.setEnvironmentVariable(\"health_tries\", JSON.stringify(health_tries));", - "postman.setEnvironmentVariable(\"health_counter\", JSON.stringify(counter));", - "", - "var jsonData = JSON.parse(responseBody);", - "", - "// Test the health response.", - "pm.test(\"Response should have 'message' property\", function() {", - " pm.expect(jsonData).to.have.property('message');", - "});", - "", - "pm.test(\"Response message should be 'api is health'\", function() {", - " pm.expect(jsonData.message).to.be.eql('api is healthy');", - "});", - "", - "// If response time is OK, proceed to the next test.", - "if (pm.response.responseTime < max_response_time) {", - " postman.setNextRequest(\"Check the readyz endpoint Booking\");", - "}", - " ", - "// Response time is too long. Try again, give pod a chance to spin up.", - "else {", - " postman.setNextRequest(\"Check the healthz endpoint Booking\");", - "}" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}healthz/", - "host": [ - "{{url}}healthz" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Check the healthz endpoint Booking", - "event": [ - { - "listen": "test", - "script": { - "id": "74adc5ce-caa5-452a-bd96-8ac90a4c11d7", - "exec": [ - "// Get the maximum response time allowed.", - "max_load_time = JSON.parse(globals.max_load_time);", - "", - "// Get and update variables.", - "health_tries = JSON.parse(postman.getEnvironmentVariable(\"health_tries\"));", - "counter = JSON.parse(postman.getEnvironmentVariable(\"health_counter\")) + 1;", - "postman.setEnvironmentVariable(\"health_counter\", JSON.stringify(counter));", - "", - "// Get the response.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Test the health response.", - "pm.test(\"Health Driver: Try \" + counter.toString() + \": Response should have 'message' property\", function() {", - " pm.expect(jsonData).to.have.property('message');", - "});", - "", - "pm.test(\"Response message should be 'api is health'\", function() {", - " pm.expect(jsonData.message).to.be.eql('api is healthy');", - "});", - "", - "// If response time is OK, proceed to the next test.", - "if (pm.response.responseTime < max_load_time) {", - " postman.setNextRequest(\"Check the readyz endpoint Booking\");", - "}", - " ", - "// Response time is too long.", - "else {", - " ", - " // You haven't reached your maximum tries yet. Try again.", - " if (counter < health_tries) {", - " postman.setNextRequest(\"Check the healthz endpoint Booking\");", - " }", - " ", - " // You have reached the maximum. An error, go to next test.", - " else {", - " pm.test(\"Response should be below \" + max_load_time.toString() + ' in ' + health_tries.toString() + ' tries.', function() {", - " pm.expect(counter).to.be.below(health_tries);", - " });", - " postman.setNextRequest(\"Check the readyz endpoint Booking\");", - " }", - "}", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}healthz/", - "host": [ - "{{url}}healthz" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Check the readyz endpoint Booking", - "event": [ - { - "listen": "test", - "script": { - "id": "661c33c4-4a3d-4396-a549-9969edafbfa6", - "exec": [ - "// Perform the standard tests.", - "eval(environment.basic_response_test);", - "", - "var jsonData = JSON.parse(responseBody);", - "", - "// Test the health response.", - "pm.test(\"Response should have 'message' property\", function() {", - " pm.expect(jsonData).to.have.property('message');", - "});", - "", - "pm.test(\"Response message should be 'api is ready'\", function() {", - " pm.expect(jsonData.message).to.be.eql('api is ready');", - "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}readyz/", - "host": [ - "{{url}}readyz" - ], - "path": [ - "" - ] - } - }, - "response": [] - } - ], - "description": "Checks the application health by calling the healthz and readyz endpoints" - }, - { - "name": "Get Exam Types", - "item": [ - { - "name": "Exam Type List", - "event": [ - { - "listen": "test", - "script": { - "id": "2df2a851-6a71-48e6-b44f-ccf096fe9d83", - "exec": [ - "// Define the JSON Schema expected in response", - "var examTypeSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"exam_color\": {\"type\": \"string\"},", - " \"exam_type_id\": {\"type\": \"number\"},", - " \"exam_type_name\": {\"type\": \"string\"},", - " \"ita_ind\": {\"type\": \"number\"},", - " \"method_type\": {\"type\": \"string\"},", - " \"number_of_hours\": {\"type\": \"number\"},", - " \"group_exam_ind\": {\"type\": \"number\"}", - " },", - " \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"ita_ind\", \"method_type\", \"number_of_hours\", \"group_exam_ind\"]", - " },", - " \"required\": []", - "}; ", - "", - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate Response Exam Type Schema\", function(){", - " pm.expect(tv4.validate(jsonData, examTypeSchema)).to.be.true;", - "});", - "", - "// Store all exam type IDs for future use in adding exams", - "var allExamIds = [];", - "", - "// Make sure some data returned.", - "pm.test(\"Response has exam_types property\", function(){", - " pm.expect(jsonData.hasOwnProperty(\"exam_types\")).to.be.true;", - "});", - "pm.test(\"Response has at least one exam_type\", function(){", - " pm.expect(jsonData.exam_types.length).to.be.above(0);", - "});", - "", - "// Set up list of valid exam types, create random functions.", - "eval(environment.init_exam_type_data);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}exam_types/", - "host": [ - "{{url}}exam_types" - ], - "path": [ - "" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Exams", - "item": [ - { - "name": "Exam Post End-point", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Get exam type data and functions.", - "exam_array = JSON.parse(postman.getEnvironmentVariable(\"exam_array_data\"));", - "eval(environment.create_random_functions);", - "", - "// Create an event number based on the time.", - "var ms = (new Date().getTime()).toString() + \"00\";", - "eventNumber = Number(ms.substring(ms.length-6, ms.len)) + 1;", - "postman.setEnvironmentVariable(\"event_number\", eventNumber);", - "", - "// Update the next event ID.", - "var eventId = \"pm\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", 0);", - "postman.setEnvironmentVariable(\"event_id\", JSON.stringify(eventId));", - "postman.setEnvironmentVariable(\"event_delete\", eventId);", - "", - "// Calculate a random exam type to use.", - "random_index = get_random_index(exam_array);", - "", - "// Store for use.", - "random_exam_type_id = exam_array[random_index].id;", - "postman.setEnvironmentVariable(\"random_exam_type_id\", JSON.stringify(random_exam_type_id.toString()));", - "", - "// Store other variables for later use.", - "postman.setEnvironmentVariable(\"exam_method\", JSON.stringify(\"paper\"));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"Postman Group Exam Name\"));", - "postman.setEnvironmentVariable(\"exam_written_ind\", JSON.stringify(\"0\"));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"Postman Examinee Name\"));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"Postman Test Notes\"));", - "postman.setEnvironmentVariable(\"number_of_students\", JSON.stringify(\"19\"));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"Postman test location\"));", - "", - "// Calculate an expiry date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+7);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format expiry date for the exam.", - "expiry_date = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", - "", - "// Store globals.", - "pm.globals.set(\"expiry_date\", JSON.stringify(expiry_date));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "// Get the max response time allowed.", - "var response_max = JSON.parse(globals.response_max);", - "", - "// Check Response code for request", - "pm.test(\"Response code for request is 201\", function(){", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.exam_schema_check);", - "eval(environment.exam_data_check);", - "", - "// If jsonData has an exam property, save exam ID.", - "if (jsonData.hasOwnProperty(\"exam\")) {", - "\tcurrentExamId = jsonData.exam.exam_id;", - " postman.setEnvironmentVariable(\"current_exam_id\", currentExamId);", - "}", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}", - "type": "text" - }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\n\t\"event_id\" : {{event_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : \"Postman Group Exam Name\",\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : \"Pm examinee name\",\n \"notes\" : \"Pm sample notes\",\n \"number_of_students\" : \"19\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : \"Pm test location\",\n \"expiry_date\": {{expiry_date}}\n}" - }, - "url": { - "raw": "{{url}}exams/", - "host": [ - "{{url}}exams" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Exam Detail End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "5206f620-8220-4ba4-860a-13c1bb452e6d", - "exec": [ - "// Get the max response time allowed.", - "var response_max = JSON.parse(globals.response_max);", - "", - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.exam_schema_check);", - "eval(environment.exam_data_check);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Exam List End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "2a7432b9-ffb0-4e23-a224-c3a48171d6c4", - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.exam_schema_list_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}exams/", - "host": [ - "{{url}}exams" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Exam Put End-point", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"number_of_students\", JSON.stringify(\"21\"));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "// Get the max response time allowed.", - "var response_max = JSON.parse(globals.response_max);", - "", - "// Check Response code for request", - "pm.test(\"Response code for request is 201\", function(){", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.exam_schema_check);", - "eval(environment.exam_data_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : {{exam_method}},\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : {{exam_written_ind}},\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}\n" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Exam Detail End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "3efcb554-1e5a-4e0a-91b8-aa32eb14a5e6", - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.exam_schema_check);", - "eval(environment.exam_data_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Exam Delete End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "88b43898-330f-4cf1-81c3-8cce3c53f54c", - "exec": [ - "// Get the max response time allowed.", - "var response_max = JSON.parse(globals.response_max);", - "", - "// Check Response code for request", - "pm.test(\"Response code for request is 204\", function(){", - " pm.response.to.have.status(204);", - "});", - "", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "DELETE", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Exams Export", - "item": [ - { - "name": "Exams Export List", - "event": [ - { - "listen": "test", - "script": { - "id": "9e02fbaf-627e-43db-b516-226b1a2874e8", - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time less than 20,000ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(20000);", - "});" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "caf977c6-da22-4f6c-b0c9-ca5f0fc3ec29", - "exec": [ - "// Calculate a start date four weeks prior to today.", - "var start = new Date();", - "start.setDate(start.getDate()-28);", - "", - "// Get year, day, month from the start time.", - "start_year = start.getFullYear().toString();", - "start_month = (\"0\" + (start.getMonth() + 1).toString()).slice(-2);", - "start_day = (\"0\" + (start.getDate()).toString()).slice(-2);", - "start_date = start_year + \"-\" + start_month + \"-\" + start_day;", - "", - "// Get year, day, month from the current day.", - "var today = new Date();", - "end_year = today.getFullYear().toString();", - "end_month = (\"0\" + (today.getMonth() + 1).toString()).slice(-2);", - "end_day = (\"0\" + (today.getDate()).toString()).slice(-2);", - "end_date = end_year + \"-\" + end_month + \"-\" + end_day;", - "", - "console.log(\"Start: \" + start_date);", - "console.log(\"End: \" + end_date);", - "pm.globals.set(\"start_date\", start_date);", - "pm.globals.set(\"end_date\", end_date);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}exams/export/?start_date={{start_date}}&end_date={{end_date}}", - "host": [ - "{{url}}exams" - ], - "path": [ - "export", - "" - ], - "query": [ - { - "key": "start_date", - "value": "{{start_date}}" - }, - { - "key": "end_date", - "value": "{{end_date}}" - } - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Bookings", - "item": [ - { - "name": "Booking Post End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "a4099862-1c9a-48f7-adbf-0240e6eb185a", - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 201\", function(){", - " pm.response.to.have.status(201);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "", - "var booking_id = jsonData.booking.booking_id;", - "", - "//Dynamic variable used for end-point testing later on", - "postman.setEnvironmentVariable(\"booking_id\", JSON.stringify(booking_id));" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "4df5dedd-4976-4cdc-b2be-739b2028cdc4", - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+7);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format starting and ending time for the booking.", - "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", - "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", - "", - "// Store globals.", - "pm.globals.set(\"start_time\", JSON.stringify(start_time));", - "pm.globals.set(\"end_time\", JSON.stringify(end_time));", - "pm.globals.set(\"fees\", JSON.stringify(\"false\"));", - "pm.globals.set(\"booking_name\", JSON.stringify(\"Super big demo next week\"));", - "pm.globals.set(\"room_id\", pm.environment.get(\"room_id_1\"));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"room_id\": {{room_id}},\n \"fees\": {{fees}},\n \"booking_name\": {{booking_name}},\n \"office_id\" : {{current_office_id}}\n}\n" - }, - "url": { - "raw": "{{url}}bookings/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Booking Detail End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "232f5232-de75-4f55-b999-2e39e39a12a8", - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}bookings/{{booking_id}}/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "{{booking_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Booking List End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "59fc7e18-6df0-48d9-822c-6518fbece309", - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_list_schema_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}bookings/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Booking Put End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "b127046f-b399-4e66-b76f-b6e79268b8ce", - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "9bde67e2-8eeb-4e50-90bf-caff1fef90a4", - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+7);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format starting and ending time for the booking.", - "start_time = year + \"-\" + month + \"-\" + day + \"T21:00:00Z\";", - "end_time = year + \"-\" + month + \"-\" + day + \"T23:00:00Z\";", - "", - "pm.globals.set(\"start_time\", JSON.stringify(start_time));", - "pm.globals.set(\"end_time\", JSON.stringify(end_time));", - "pm.globals.set(\"fees\", JSON.stringify(\"true\"));", - "pm.globals.set(\"booking_name\", JSON.stringify(\"Time to pay your fees!\"));", - "pm.globals.set(\"room_id\", pm.environment.get(\"room_id_2\"));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"room_id\": {{room_id}},\n \"fees\": {{fees}},\n \"booking_name\": {{booking_name}},\n \"office_id\" : {{current_office_id}}\n}" - }, - "url": { - "raw": "{{url}}bookings/{{booking_id}}/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "{{booking_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Booking Detail End-point Again", - "event": [ - { - "listen": "test", - "script": { - "id": "b5e53be0-ddda-4c99-b563-5a3b449e0f79", - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}bookings/{{booking_id}}/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "{{booking_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Booking Delete End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "1e7c1d71-ea74-4a78-9ef2-ee9a7a47d915", - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 204\", function(){", - " pm.response.to.have.status(204);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "DELETE", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}bookings/{{booking_id}}/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "{{booking_id}}", - "" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Invigilators", - "item": [ - { - "name": "Invigilator List End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "0e68858e-985c-4fb0-bca6-04d33f65c28d", - "exec": [ - "// Define the JSON Schema expected in response", - "var invigilatorSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"invigilators\": {", - " \"type\": \"array\",", - " \"properties\": {", - " \"contact_email\": {\"type\": \"string\"},", - " \"contact_phone\": {\"type\": \"string\"},", - " \"contract_expiry_date\": {\"type\": \"string\"},", - " \"contract_number\": {\"type\": \"string\"},", - " \"invigilator_id\": {\"type\": \"number\"},", - " \"invigilator_name\": {\"type\": \"string\"},", - " \"invigilator_notes\": {\"type\": \"string\"},", - " \"office\":{", - " \"type\": \"object\",", - " \"properties\": {", - " \"office_id\": {\"type\": \"number\"},", - " \"office_name\": {\"type\": \"string\"},", - " \"office_number\": {\"type\": \"number\"},", - " \"sb\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"sb_id\": {\"type\": \"number\"},", - " \"sb_type\": {\"type\": \"string\"}", - " },", - " \"required\": [\"sb_id\", \"sb_type\"]", - " }", - " },", - " \"required\": [\"office_id\", \"office_name\", \"office_number\", \"sb\", \"sb_id\"]", - " }", - " },", - " \"required\": [\"contact_email\", \"contact_phone\", \"contract_expiry_date\", \"contract_number\", \"invigilator_id\", \"invigilator_name\", \"invigilator_notes\", \"office\"]", - " }", - " }", - "};", - "", - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate Response Invigilator Schema\", function(){", - " pm.expect(tv4.validate(jsonData, invigilatorSchema)).to.be.true;", - "});", - "", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}invigilators/", - "host": [ - "{{url}}invigilators" - ], - "path": [ - "" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Rooms", - "item": [ - { - "name": "Room List End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "859ae114-22c4-4f3e-9f1f-9f0e06fbc29d", - "exec": [ - "// Define the JSON Schema expected in response", - "var roomSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"rooms\": {", - " \"type\": \"array\",", - " \"properties\": {", - " \"capacity\": {\"type\": \"number\"},", - " \"color\": {\"type\": \"string\"},", - " \"office\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"office_id\": {\"type\": \"number\"},", - " \"office_name\": {\"type\": \"string\"},", - " \"office_number\": {\"type\": \"number\"},", - " \"sb\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"sb_id\": {\"type\": \"number\"},", - " \"sb_type\": {\"type\": \"string\"}", - " },", - " \"required\": [\"sb_id\", \"sb_type\"]", - " },", - " \"sb_id\": {\"type\": \"number\"} ", - " },", - " \"required\": [\"office_id\", \"office_name\", \"office_number\", \"sb\", \"sb_id\"]", - " }", - " },", - " \"required\": [\"capacity\", \"color\", \"office\", \"room_id\", \"room_name\"]", - " }", - " }", - "};", - "", - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate Response Room Schema\", function(){", - " pm.expect(tv4.validate(jsonData, roomSchema)).to.be.true;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}rooms/", - "host": [ - "{{url}}rooms" - ], - "path": [ - "" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "CSRS", - "item": [ - { - "name": "CSRS Me Get End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "1ed052a0-06cc-45c7-ae49-b19b96e02d51", - "exec": [ - "// Define the JSON Schema expected in response", - "var CSRSSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"csr\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"csr_id\": {\"type\": \"number\"},", - " \"csr_state\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"csr_state_desc\": {\"type\": \"string\"},", - " \"csr_state_id\": {\"type\": \"number\"},", - " \"csr_state_name\": {\"type\": \"string\"}", - " },", - " \"required\": [\"csr_state_desc\", \"csr_state_id\", \"csr_state_name\"]", - " },", - " \"csr_state_id\": {\"type\": \"number\"},", - " \"deleted\": {},", - " \"finance_designate\": {\"type\": \"number\"},", - " \"office_manager\": {\"type\": \"number\"},", - " \"ita2_designate\": {\"type\": \"number\"},", - " \"office\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"appointments_enabled_ind\": {\"type\": \"number\"},", - " \"back_office_list\": {", - " \"type\": \"array\",", - " \"properties\": {", - " \"actual_service_ind\": {\"type\": \"number\"},", - " \"deleted\": {},", - " \"display_dashboard_ind\": {\"type\": \"number\"},", - " \"parent\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"service_name\": {\"type\": \"string\"}", - " },", - " \"required\": [\"service_name\"]", - " },", - " \"parent_id\": {\"type\": \"number\"},", - " \"prefix\": {\"type\": \"string\"},", - " \"service_code\": {\"type\": \"string\"},", - " \"service_desc\": {\"type\": \"string\"},", - " \"service_id\": {\"type\": \"number\"},", - " \"service_name\": {\"type\": \"string\"},", - " },", - " \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\", \"parent\",", - " \"parent_id\", \"prefix\", \"service_code\", \"service_desc\", \"service_id\",", - " \"service_name\"]", - " },", - " \"counters\": {", - " \"type\": \"array\",", - " \"properties\": {", - " \"counter_id\": {\"type\": \"number\"},", - " \"counter_name\": {\"type\": \"string\"}", - " },", - " \"required\": [\"counter_id\", \"counter_name\"]", - " },", - " \"exams_enabled_ind\": {\"type\": \"number\"},", - " \"office_id\": {\"type\": \"number\"},", - " \"office_name\": {\"type\": \"string\"},", - " \"office_number\": {\"type\": \"number\"},", - " \"quick_list\": {", - " \"type\": \"array\",", - " \"properties\": {", - " \"actual_service_ind\": {\"type\": \"number\"},", - " \"deleted\": {},", - " \"display_dashboard_ind\": {\"type\": \"number\"},", - " \"parent\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"service_name\": {\"type\": \"string\"}", - " },", - " \"required\": [\"service_name\"]", - " },", - " \"parent_id\": {\"type\": \"number\"},", - " \"prefix\": {\"type\": \"string\"},", - " \"service_code\": {\"type\": \"string\"},", - " \"service_desc\": {\"type\": \"string\"},", - " \"service_id\": {\"type\": \"number\"},", - " \"service_name\": {\"type\": \"string\"},", - " },", - " \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\", \"parent\",", - " \"parent_id\", \"prefix\", \"service_code\", \"service_desc\", \"service_id\",", - " \"service_name\"]", - " },", - " \"sb\":{", - " \"type\": \"object\",", - " \"properties\": {", - " \"sb_id\": {\"type\": \"number\"},", - " \"sb_type\": {\"type\": \"string\"}", - " },", - " \"required\": [\"sb_id\", \"sb_type\"]", - " },", - " \"sb_id\": {\"type\": \"number\"},", - " \"timezone\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"timezone_id\": {\"type\": \"number\"},", - " \"timezone_name\": {\"type\": \"string\"}", - " },", - " \"required\": [\"timezone_id\", \"timezone_name\"]", - " }", - " },", - " \"required\": [\"appointments_enabled_ind\", \"back_office_list\", \"counters\",", - " \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\",", - " \"quick_list\", \"sb\", \"sb_id\", ]", - " },", - " \"office_id\": {\"type\": \"number\"},", - " \"pesticide_designate\": {\"type\": \"number\"},", - " \"qt_xn_csr_ind\": {\"type\": \"number\"},", - " \"receptionist_ind\": {\"type\": \"number\"},", - " \"role\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"role_code\": {\"type\": \"string\"},", - " \"role_desc\": {\"type\": \"string\"},", - " \"role_id\": {\"type\": \"number\"}", - " },", - " \"required\": [\"role_code\", \"role_desc\", \"role_id\"]", - " },", - " \"role_id\": {\"type\": \"number\"},", - " \"username\": {\"type\": \"string\"}", - " },", - " },", - " \"attention_needed\": {\"type\": \"boolean\"},", - " \"active_citizens\" : {\"type\": \"array\"},", - " \"back_office_display\": {\"type\": \"string\"},", - " \"recurring_feature_flag\": {\"type\": \"string\"}", - " },", - " \"required\": [\"csr\", \"attention_needed\", \"active_citizens\", \"back_office_display\", \"recurring_feature_flag\"]", - "};", - "", - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate Response CSRs Schema\", function(){", - " pm.expect(tv4.validate(jsonData, CSRSSchema)).to.be.true;", - "});" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "1c4020cd-fb05-478c-b908-3197c80d492e", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}csrs/me/", - "host": [ - "{{url}}csrs" - ], - "path": [ - "me", - "" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Offices", - "item": [ - { - "name": "Office List End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "ad6ffb6d-efad-4e11-b4a9-99e49f457bbd", - "exec": [ - "// Define the JSON Schema expected in response", - "var officeSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"offices\": {", - " \"type\": \"array\",", - " \"properties\": {", - " \"exams_enabled\": {\"type\": \"number\"},", - " \"office_id\": {\"type\": \"number\"},", - " \"office_name\": {\"type\": \"string\"},", - " \"office_number\": {\"type\": \"number\"},", - " \"sb\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"sb_id\": {\"type\": \"number\"},", - " \"sb_type\": {\"type\": \"string\"}", - " },", - " \"required\": [\"sb_id\", \"sb_type\"]", - " },", - " \"sb_id\": {\"type\": \"number\"}", - " },", - " \"required\": [\"exams_enabled\", \"office_id\", \"office_name\", \"office_number\", \"sb\", \"sb_id\"]", - " }", - " }", - "};", - "", - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate Response Office Schema\", function(){", - " pm.expect(tv4.validate(jsonData, officeSchema)).to.be.true;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}offices/", - "host": [ - "{{url}}offices" - ], - "path": [ - "" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Appointments", - "item": [ - { - "name": "Appointment Post End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "851b530c-92d7-482c-9e80-2a1f542b280c", - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 201\", function(){", - " pm.response.to.have.status(201);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "eval(environment.appointment_data_check);", - "", - "var appointment_id = jsonData.appointment.appointment_id;", - "", - "//Dynamic variable used for end-point testing later on", - "postman.setEnvironmentVariable(\"appointment_id\", JSON.stringify(appointment_id));" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "e8444129-3a7b-4a2f-82d0-fd9b5d395f0d", - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+7);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format starting and ending time for the booking.", - "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", - "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", - "", - "pm.globals.set(\"start_time\", JSON.stringify(start_time));", - "pm.globals.set(\"end_time\", JSON.stringify(end_time));", - "pm.globals.set(\"category\", JSON.stringify(\"Exam\"));", - "pm.globals.set(\"comments\", JSON.stringify(\"Missed playoffs, needs to talk #1.\"));", - "pm.globals.set(\"citizen_name\", JSON.stringify(\"LeBron James Appointment #1\"));", - "pm.globals.set(\"service_id\", pm.environment.get(\"service_PropTax_id\"));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"service_id\": {{service_id}},\n \"office_id\" : {{current_office_id}},\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"category\": {{category}},\n \"comments\": {{comments}},\n \"citizen_name\": {{citizen_name}}\n}" - }, - "url": { - "raw": "{{url}}appointments/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Appointment Detail End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "5206f620-8220-4ba4-860a-13c1bb452e6d", - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "eval(environment.appointment_data_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}appointments/{{appointment_id}}/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "{{appointment_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Appointment List End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "2a7432b9-ffb0-4e23-a224-c3a48171d6c4", - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid\\", - "eval(environment.appointment_list_schema_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}appointments/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Appointment Put End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "1cf958af-12dd-44f4-a624-d070cc6d90cb", - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "eval(environment.appointment_data_check);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "52ba16f8-f08e-4a75-a64c-39e59c64c1c6", - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+7);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format starting and ending time for the booking.", - "start_time = year + \"-\" + month + \"-\" + day + \"T21:00:00Z\";", - "end_time = year + \"-\" + month + \"-\" + day + \"T23:00:00Z\";", - "", - "pm.globals.set(\"start_time\", JSON.stringify(start_time));", - "pm.globals.set(\"end_time\", JSON.stringify(end_time));", - "pm.globals.set(\"comments\", JSON.stringify(\"super EARLY\"));" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"office_id\" : {{current_office_id}},\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"category\": {{category}},\n \"comments\": {{comments}}\n}" - }, - "url": { - "raw": "{{url}}appointments/{{appointment_id}}/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "{{appointment_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Appointment Delete End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "88b43898-330f-4cf1-81c3-8cce3c53f54c", - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 204\", function(){", - " pm.response.to.have.status(204);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "DELETE", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}appointments/{{appointment_id}}/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "{{appointment_id}}", - "" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Public User Appointments", - "item": [ - { - "name": "Authenticate and create user", - "event": [ - { - "listen": "test", - "script": { - "id": "c8d8da75-f3d8-4d1f-83c7-cc41d2ad4317", - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "", - "var user_id = jsonData[0].user_id;", - "", - "//Dynamic variable used for end-point testing later on", - "postman.setEnvironmentVariable(\"user_id\", JSON.stringify(user_id));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{public_user_token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Typea", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n}" - }, - "url": { - "raw": "{{public_url}}users/", - "host": [ - "{{public_url}}users" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Book an appointment", - "event": [ - { - "listen": "test", - "script": { - "id": "851b530c-92d7-482c-9e80-2a1f542b280c", - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 201\", function(){", - " pm.response.to.have.status(201);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "eval(environment.appointment_data_check);", - "", - "var appointment_id = jsonData.appointment.appointment_id;", - "", - "//Dynamic variable used for end-point testing later on", - "postman.setEnvironmentVariable(\"appointment_id\", JSON.stringify(appointment_id));", - "", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "e8444129-3a7b-4a2f-82d0-fd9b5d395f0d", - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+7);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format starting and ending time for the booking.", - "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", - "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", - "", - "pm.globals.set(\"start_time\", JSON.stringify(start_time));", - "pm.globals.set(\"end_time\", JSON.stringify(end_time));", - "pm.globals.set(\"category\", JSON.stringify(\"Exam\"));", - "pm.globals.set(\"comments\", JSON.stringify(\"Missed playoffs, needs to talk #1.\"));", - "pm.globals.set(\"citizen_name\", JSON.stringify(\"LeBron James Appointment #1\"));", - "pm.globals.set(\"service_id\", pm.environment.get(\"service_PropTax_id\"));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{public_user_token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"service_id\": {{service_id}},\n \"office_id\" : {{current_office_id}},\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"category\": {{category}},\n \"comments\": {{comments}}\n}" - }, - "url": { - "raw": "{{public_url}}appointments/", - "host": [ - "{{public_url}}appointments" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Edit user profile", - "event": [ - { - "listen": "test", - "script": { - "id": "5206f620-8220-4ba4-860a-13c1bb452e6d", - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{public_user_token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"email\": \"test@test.com\",\n \"telephone\": \"7787777777\",\n \"send_reminders\": true\n}" - }, - "url": { - "raw": "{{public_url}}users/{{user_id}}/", - "host": [ - "{{public_url}}users" - ], - "path": [ - "{{user_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "List all appointments", - "event": [ - { - "listen": "test", - "script": { - "id": "2a7432b9-ffb0-4e23-a224-c3a48171d6c4", - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid\\", - "eval(environment.appointment_list_schema_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{public_user_token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{public_url}}users/appointments/", - "host": [ - "{{public_url}}users" - ], - "path": [ - "appointments", - "" - ] - } - }, - "response": [] - }, - { - "name": "Appointment Put End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "1cf958af-12dd-44f4-a624-d070cc6d90cb", - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "eval(environment.appointment_data_check);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "52ba16f8-f08e-4a75-a64c-39e59c64c1c6", - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+7);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format starting and ending time for the booking.", - "start_time = year + \"-\" + month + \"-\" + day + \"T21:00:00Z\";", - "end_time = year + \"-\" + month + \"-\" + day + \"T23:00:00Z\";", - "", - "pm.globals.set(\"start_time\", JSON.stringify(start_time));", - "pm.globals.set(\"end_time\", JSON.stringify(end_time));", - "pm.globals.set(\"comments\", JSON.stringify(\"super EARLY\"));" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{public_user_token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"office_id\" : {{current_office_id}},\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"category\": {{category}},\n \"comments\": {{comments}}\n}" - }, - "url": { - "raw": "{{public_url}}appointments/{{appointment_id}}/", - "host": [ - "{{public_url}}appointments" - ], - "path": [ - "{{appointment_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Appointment Delete End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "88b43898-330f-4cf1-81c3-8cce3c53f54c", - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 204\", function(){", - " pm.response.to.have.status(204);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{public_user_token}}", - "type": "string" - } - ] - }, - "method": "DELETE", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{public_url}}appointments/{{appointment_id}}/", - "host": [ - "{{public_url}}appointments" - ], - "path": [ - "{{appointment_id}}", - "" - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "id": "7f0ff870-49a0-4df2-9496-e6bf98e60a05", - "type": "text/javascript", - "exec": [ - "auth_url = globals.auth_url;", - "realm = globals.realm;", - "clientid = globals.clientid;", - "userid = globals.public_user_id;", - "password = globals.public_user_password;", - "client_secret = globals.client_secret;", - "", - "const echoPostRequest = {", - " url: auth_url + '/auth/realms/' + realm + '/protocol/openid-connect/token',", - " method: 'POST',", - " header: 'Content-Type:application/x-www-form-urlencoded',", - " body: {", - " mode: 'raw',", - " raw: 'grant_type=password&client_id=' + clientid ", - " + '&username=' + userid ", - " + '&password=' + password", - " + '&client_secret=' + client_secret", - " }", - "};", - "pm.sendRequest(echoPostRequest, function (err, res) {", - " var jsonData = res.json();", - " if (jsonData.hasOwnProperty('access_token')) {", - " \tpm.globals.set(\"public_user_token\", jsonData.access_token);", - "\t pm.globals.set(\"public_user_refresh_token\", jsonData.refresh_token);", - "\t if (err) {", - "\t console.log(err);", - "\t }", - "\t // console.log(err ? err : res.json());", - "\t} else {", - "\t pm.globals.set(\"public_user_token\", 0);", - "\t pm.globals.set(\"public_user_refresh_token\", 0);", - "\t}", - "});" - ] - } - }, - { - "listen": "test", - "script": { - "id": "e331a1b0-a6b1-40a6-8a50-de4d357eecb6", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - } - ] -} \ No newline at end of file + "info": { + "_postman_id": "1c30decd-7b40-4a76-aa2b-e092dc3eb9dc", + "name": "API_Test_TheQ_Booking", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "Setup TheQ", + "item": [ + { + "name": "Setup-Variables", + "event": [ + { + "listen": "test", + "script": { + "id": "5409b66d-67a4-449b-8633-9aeca632b388", + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "e9eed831-7955-4218-a400-ae6e1e7e2e10", + "exec": [ + "// See if the use-prefix global has been set. Use default if not.", + "let usePrefix = '';", + "if (pm.globals.get('use-prefix')) {", + " console.log(\"==> use-prefix exists\");", + " usePrefix = pm.globals.get('use-prefix');", + " console.log(\" --> Prefix is: \" + usePrefix);", + " ", + " // Set up all globals, using the correct prefix.", + " pm.globals.set('auth_url', pm.globals.get(usePrefix + 'auth_url'));", + " pm.globals.set('realm', pm.globals.get(usePrefix + 'realm'));", + " pm.globals.set('clientid', pm.globals.get(usePrefix + 'clientid'));", + " pm.globals.set('client_secret', pm.globals.get(usePrefix + 'client_secret'));", + " pm.globals.set('url', pm.globals.get(usePrefix + 'url'));", + "}", + "else {", + " console.log(\"==> use-prefix does not exist\");", + " console.log(\" --> No default globals set.\");", + "}", + "", + "// If no maximum load time defined, set a default.", + "if (!pm.globals.get('max_load_time')) {", + " console.log(\"==> max_load_time not present, default set.\");", + " pm.globals.set(\"max_load_time\", JSON.stringify(1503));", + "}", + "", + "// If no maximum response defined, set a default.", + "if (!pm.globals.get('max_response_time')) {", + " console.log(\"==> max_response_time not present, default set.\");", + " pm.globals.set(\"max_response_time\", JSON.stringify(15005));", + "}", + "", + "// Display the values of all globals.", + "console.log(\"\");", + "console.log(\"==> Globals are:\");", + "console.log(\" --> auth_url: \" + pm.globals.get(\"auth_url\"));", + "console.log(\" --> realm: \" + pm.globals.get(\"realm\"));", + "console.log(\" --> clientid: \" + pm.globals.get(\"clientid\"));", + "console.log(\" --> client_secret: \" + pm.globals.get(\"client_secret\"));", + "console.log(\" --> url: \" + pm.globals.get(\"url\"));", + "console.log(\" --> max_load_time: \" + pm.globals.get(\"max_load_time\"));", + "console.log(\" --> max_response_time: \" + pm.globals.get(\"max_response_time\"));", + "", + "", + "// Clear run-scoped variables so reruns do not inherit stale state.", + "pm.globals.unset(\"auth_failure_reason\");", + "pm.globals.unset(\"operator_token\");", + "pm.globals.unset(\"operator_refresh_token\");", + "pm.globals.unset(\"nonqtxn_token\");", + "pm.globals.unset(\"nonqtxn_refresh_token\");", + "pm.globals.unset(\"public_user_token\");", + "pm.globals.unset(\"public_user_refresh_token\");", + "pm.globals.unset(\"token\");", + "pm.globals.unset(\"refresh_token\");", + "pm.globals.unset(\"token_expires\");", + "pm.globals.unset(\"refresh_token_expires\");", + "pm.globals.unset(\"expires_in\");", + "pm.globals.unset(\"refresh_expires_in\");", + "pm.environment.unset(\"current_client\");", + "pm.environment.unset(\"first_sr_id\");", + "pm.environment.unset(\"second_sr_id\");", + "pm.environment.unset(\"current_csr_id\");", + "pm.environment.unset(\"current_office_id\");", + "pm.environment.unset(\"current_office_number\");", + "pm.environment.unset(\"counter_id\");", + "pm.environment.unset(\"qtxn_id\");", + "pm.environment.unset(\"channel_telephone_id\");", + "pm.environment.unset(\"channel_email_id\");", + "pm.environment.unset(\"service_PropTax_id\");", + "pm.environment.unset(\"service_MSP_id\");", + "pm.environment.unset(\"user_id\");", + "pm.environment.unset(\"user_phone\");", + "pm.environment.unset(\"appointment_id\");", + "pm.environment.unset(\"public_office_id\");", + "pm.environment.unset(\"public_office_timezone\");", + "pm.environment.unset(\"public_service_id\");" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Dummy data." + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Basic-Response-Tests", + "event": [ + { + "listen": "test", + "script": { + "id": "a0d8e240-3b40-4654-a32b-bf2e676fdeb9", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"basic_response_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Get the maximum response time allowed.\nmax_response_time = JSON.parse(globals.max_response_time);\n\npm.test('Response time less than ' + max_response_time.toString() + 'ms', function(){\n pm.expect(pm.response.responseTime).to.be.below(max_response_time);\n});\n\nvar contentType = pm.response.headers.get(\"content-type\") || \"\";\n\npm.test(\"Response code for request is 200\", function(){\n pm.expect(pm.response.code).to.eql(200);\n});\npm.test(\"Response header should include Content-Type application/json\", function() {\n pm.expect(contentType.toLowerCase()).to.include(\"application/json\");\n});\npm.test(\"Response body should be valid JSON\", function() {\n pm.expect(function () { pm.response.json(); }).to.not.throw();\n});\n\nif (pm.response.code !== 200) {\n console.log(\"Unexpected status for \" + pm.info.requestName + \": \" + pm.response.code);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected HTTP 200 but received \" + pm.response.code);\n}\n\nif (contentType.toLowerCase().indexOf(\"application/json\") === -1) {\n console.log(\"Unexpected content-type for \" + pm.info.requestName + \": \" + contentType);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected application/json response\");\n}\n\ntry {\n pm.response.json();\n} catch (parseErr) {\n console.log(\"Response body was not valid JSON for \" + pm.info.requestName + \".\");\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw parseErr;\n}" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Complex-Response-Tests", + "event": [ + { + "listen": "test", + "script": { + "id": "f006b951-3205-4f21-a315-369f85591929", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"complex_response_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Get the maximum response time allowed.\nmax_response_time = JSON.parse(globals.max_response_time);\n\npm.test('Response time less than ' + max_response_time.toString() + 'ms', function(){\n pm.expect(pm.response.responseTime).to.be.below(max_response_time);\n});\n\nvar contentType = pm.response.headers.get(\"content-type\") || \"\";\n\npm.test(\"Response code for request is 200\", function(){\n pm.expect(pm.response.code).to.eql(200);\n});\npm.test(\"Response header should include Content-Type application/json\", function() {\n pm.expect(contentType.toLowerCase()).to.include(\"application/json\");\n});\npm.test(\"Response body should be valid JSON\", function() {\n pm.expect(function () { pm.response.json(); }).to.not.throw();\n});\n\nif (pm.response.code !== 200) {\n console.log(\"Unexpected status for \" + pm.info.requestName + \": \" + pm.response.code);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected HTTP 200 but received \" + pm.response.code);\n}\n\nif (contentType.toLowerCase().indexOf(\"application/json\") === -1) {\n console.log(\"Unexpected content-type for \" + pm.info.requestName + \": \" + contentType);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected application/json response\");\n}\n\ntry {\n pm.response.json();\n} catch (parseErr) {\n console.log(\"Response body was not valid JSON for \" + pm.info.requestName + \".\");\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw parseErr;\n}" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Create-Response-Tests", + "event": [ + { + "listen": "test", + "script": { + "id": "382b7b65-d736-4a03-a44a-3891f33b617d", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"create_response_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Get the maximum response time allowed.\nmax_response_time = JSON.parse(globals.max_response_time);\n\npm.test('Response time less than ' + max_response_time.toString() + 'ms', function(){\n pm.expect(pm.response.responseTime).to.be.below(max_response_time);\n});\n\nvar contentType = pm.response.headers.get(\"content-type\") || \"\";\n\npm.test(\"Response status code should be 201 CREATED\", function(){\n pm.expect(pm.response.code).to.eql(201);\n});\npm.test(\"Response header should include Content-Type application/json\", function() {\n pm.expect(contentType.toLowerCase()).to.include(\"application/json\");\n});\npm.test(\"Response body should be valid JSON\", function() {\n pm.expect(function () { pm.response.json(); }).to.not.throw();\n});\n\nif (pm.response.code !== 201) {\n console.log(\"Unexpected status for \" + pm.info.requestName + \": \" + pm.response.code);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected HTTP 201 but received \" + pm.response.code);\n}\n\nif (contentType.toLowerCase().indexOf(\"application/json\") === -1) {\n console.log(\"Unexpected content-type for \" + pm.info.requestName + \": \" + contentType);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected application/json response\");\n}\n\ntry {\n pm.response.json();\n} catch (parseErr) {\n console.log(\"Response body was not valid JSON for \" + pm.info.requestName + \".\");\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw parseErr;\n}" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Citizen-Response-Tests", + "event": [ + { + "listen": "test", + "script": { + "id": "8cebcf78-f5a2-4694-b108-60e146791a78", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"citizen_response_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "var schema = {\n \"properties\" : {\n \"start_time\" : {\n \"type\" : \"string\"\n },\n \"citizen_name\" : {\n \"type\" : [\"string\", \"null\"]\n },\n \"citizen_id\" : {\n \"type\" : [\"number\", \"object\"]\n },\n \"qt_xn_citizen_ind\" : {\n \"type\" : \"number\"\n },\n \"ticket_number\" : {\n \"type\" : [\"string\", \"null\"]\n },\n \"service_reqs\" : {\n \"type\" : \"array\"\n },\n \"office_id\" : {\n \"type\" : [\"object\", \"number\"]\n },\n \"cs\" : {\n \"type\" : \"object\"\n },\n \"citizen_comments\" : {\n \"type\" : [\"string\", \"null\"]\n },\n \n },\n \"required\" : [\"start_time\", \"citizen_name\", \"citizen_id\",\n \"qt_xn_citizen_ind\", \"ticket_number\", \"service_reqs\",\n \"office_id\", \"cs\", \"citizen_comments\"]\n};\n\n// Declare, initialize variables.\nvar allElements = null;\n\nif (jsonData.hasOwnProperty(\"citizens\")) {\n\tallElements = jsonData.citizens;\n};\n\nif (jsonData.hasOwnProperty(\"citizen\")) {\n\tallElements = [];\n\tallElements.push(jsonData.citizen);\n};\n\nvar elementCount = 0;\n\n// If there are some citizens, proceed with tests.\nif (allElements !== null) {\n\n // Loop to validate schema of each channel, create list of citizen ids.\n allElements.forEach(function(element) {\n elementCount ++;\n var testTitle = \"Citizen (\" + elementCount + \"): \" + element.citizen_id + \" - \";\n tests[testTitle + \"conforms to schema\"] = tv4.validate(element, schema);\n \n // Test the authenticate response.\n pm.test(testTitle + \"qt_xn_citizen_ind must be 0 or 1\", function() {\n pm.expect(element.qt_xn_citizen_ind).to.be.within(0,1);\n });\n });\n};" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Service-Response-Tests", + "event": [ + { + "listen": "test", + "script": { + "id": "0e6c4264-28b3-4a49-b6bb-1199aef2cb13", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"service_response_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "var schema = {\n \"properties\" : {\n \"sr_id\" : {\n \"type\" : [\"object\", \"number\"]\n },\n \"sr_state\" : {\n \"type\" : \"object\"\n },\n \"periods\" : {\n \"type\" : \"array\"\n },\n \"service\" : {\n \"type\" : \"object\"\n },\n \"citizen\" : {\n \"type\" : [\"object\", \"number\"]\n },\n \"quantity\" : {\n \"type\" : \"number\"\n },\n \"service_id\" : {\n \"type\" : [\"object\", \"number\"]\n },\n \"citizen_id\" : {\n \"type\" : [\"object\", \"number\"]\n },\n \"channel\" : {\n \t\"type\" : \"object\"\n },\n \"channel_id\" : {\n \t\"type\" : [\"object\", \"number\"]\n }\n \n },\n \"required\" : [\n \t\"sr_id\", \"sr_state\", \"periods\", \"service\", \"citizen\", \"quantity\",\n \t\"service_id\", \"citizen_id\", \"channel\", \"channel_id\"\n ]\n};\n\n// Declare, initialize variables.\nvar allElements = null;\n\nif (jsonData.hasOwnProperty(\"service_requests\")) {\n\tallElements = jsonData.service_requests;\n};\n\nif (jsonData.hasOwnProperty(\"service_request\")) {\n allElements = [];\n\tallElements.push(jsonData.service_request);\n}\n\nvar elementCount = 0;\n\n// If there are some service requests, proceed with tests.\nif (allElements !== null) {\n\n // Loop to validate schema of each service request.\n allElements.forEach(function(element) {\n elementCount ++;\n var testTitle = \"Service Request (\" + elementCount + \"): \" + element.sr_id + \" - \";\n tests[testTitle + \"conforms to schema\"] = tv4.validate(element, schema);\n });\n};" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Get-Active-Citizens-Tests", + "event": [ + { + "listen": "test", + "script": { + "id": "8856712d-73ca-4172-89ba-590e8b015c6b", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"get_active_citizens_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Declare and initialize variables.\nvar elementCount = 0;\nvar srCount = 0;\nvar isFirstCitizen = true;\n\n\n// Loop to create list of active citizen ids.\nallElements.forEach(function(element) {\n srCount = element.service_reqs.length;\n\n // If citizen active, add to the list.\n if (element.cs.cs_state_name === \"Active\") {\n //console.log(\"Citizen (\" + elementCount + \") \" + element.citizen_id +\n // \" Active: SRCount = \" + srCount);\n citizenIds.push(element.citizen_id);\n\n // Save the first citizen.\n if (isFirstCitizen) {\n currentCitizen = element;\n isFirstCitizen = false;\n }\n }\n \n // Increment count.\n elementCount++;\n});" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + } + ], + "description": "This folder performs basic authentication features." + }, + { + "name": "Check app health", + "item": [ + { + "name": "Check healthz driver TheQ", + "event": [ + { + "listen": "test", + "script": { + "id": "74adc5ce-caa5-452a-bd96-8ac90a4c11d7", + "exec": [ + "// Get the maximum response time allowed.", + "max_load_time = JSON.parse(globals.max_load_time);", + "", + "// Set health response time variable.", + "health_tries = 15;", + "counter = 1;", + "postman.setEnvironmentVariable(\"health_tries\", JSON.stringify(health_tries));", + "postman.setEnvironmentVariable(\"health_counter\", JSON.stringify(counter));", + "", + "// Get the response.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Test the health response.", + "pm.test(\"Health Driver: Try \" + counter.toString() + \": Response should have 'message' property\", function() {", + " pm.expect(jsonData).to.have.property('message');", + "});", + "", + "pm.test(\"Response message should be 'api is healthy'\", function() {", + " pm.expect(jsonData.message).to.be.eql('api is healthy');", + "});", + "", + "// If response time is OK, proceed to the next test.", + "if (pm.response.responseTime < max_load_time) {", + " postman.setNextRequest(\"Check the readyz endpoint TheQ\");", + "}", + " ", + "// Response time is too long. Try again, give pod a chance to spin up.", + "else {", + " postman.setNextRequest(\"Check the healthz endpoint TheQ\");", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}healthz/", + "host": [ + "{{url}}healthz" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Check the healthz endpoint TheQ", + "event": [ + { + "listen": "test", + "script": { + "id": "74adc5ce-caa5-452a-bd96-8ac90a4c11d7", + "exec": [ + "// Get the maximum load time allowed.", + "max_load_time = JSON.parse(postman.getEnvironmentVariable(\"max_load_time\"));", + "", + "// Get and update variables.", + "health_tries = JSON.parse(postman.getEnvironmentVariable(\"health_tries\"));", + "counter = JSON.parse(postman.getEnvironmentVariable(\"health_counter\")) + 1;", + "postman.setEnvironmentVariable(\"health_counter\", JSON.stringify(counter));", + "", + "// Get the response.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Test the health response.", + "pm.test(\"Health Driver: Try \" + counter.toString() + \": Response should have 'message' property\", function() {", + " pm.expect(jsonData).to.have.property('message');", + "});", + "", + "pm.test(\"Response message should be 'api is healthy'\", function() {", + " pm.expect(jsonData.message).to.be.eql('api is healthy');", + "});", + "", + "// If response time is OK, proceed to the next test.", + "if (pm.response.responseTime < max_load_time) {", + " postman.setNextRequest(\"Check the readyz endpoint TheQ\");", + "}", + " ", + "// Response time is too long.", + "else {", + " ", + " // You haven't reached your maximum tries yet. Try again.", + " if (counter < health_tries) {", + " postman.setNextRequest(\"Check the healthz endpoint\");", + " }", + " ", + " // You have reached the maximum. An error, go to next test.", + " else {", + " pm.test(\"Response should be below \" + max_load_time.toString() + ' in ' + health_tries.toString() + ' tries.', function() {", + " pm.expect(counter).to.be.below(health_tries);", + " });", + " postman.setNextRequest(\"Check the readyz endpoint TheQ\");", + " }", + "}", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}healthz/", + "host": [ + "{{url}}healthz" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Check the readyz endpoint TheQ", + "event": [ + { + "listen": "test", + "script": { + "id": "661c33c4-4a3d-4396-a549-9969edafbfa6", + "exec": [ + "// Perform the standard tests.", + "eval(environment.basic_response_test);", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "// Test the health response.", + "pm.test(\"Response should have 'message' property\", function() {", + " pm.expect(jsonData).to.have.property('message');", + "});", + "", + "pm.test(\"Response message should be 'api is ready'\", function() {", + " pm.expect(jsonData.message).to.be.eql('api is ready');", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}readyz/", + "host": [ + "{{url}}readyz" + ], + "path": [ + "" + ] + } + }, + "response": [] + } + ], + "description": "Checks the application health by calling the healthz and readyz endpoints" + }, + { + "name": "Check user login", + "item": [ + { + "name": "Authenticate default QTxn user", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"auth_url\",\"realm\",\"clientid\",\"userid\",\"password\",\"client_secret\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "43df8e47-2b93-48b0-a5ff-bb3396d12537", + "exec": [ + "// Parse response body", + "var jsonData = {};", + "try {", + " jsonData = JSON.parse(responseBody);", + "} catch (parseErr) {", + " console.log(\"Authentication response body was not JSON.\");", + " console.log(responseBody);", + " pm.globals.set(\"auth_failure_reason\", \"Non-JSON auth response\");", + " pm.execution.setNextRequest(null);", + " throw parseErr;", + "}", + "", + "var authFailureReason = jsonData.error_description || jsonData.error || (\"HTTP \" + pm.response.code);", + "if (pm.response.code !== 200 || !jsonData.access_token) {", + " console.log(\"Authentication failed for \" + pm.info.requestName + \".\");", + " console.log(responseBody);", + " pm.globals.set(\"auth_failure_reason\", authFailureReason);", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Authentication failed: \" + authFailureReason);", + "}", + "", + "pm.test(\"Response code for request is 200\", function(){", + " pm.expect(pm.response.code).to.eql(200);", + "});", + "pm.test(\"Access token exists\", function(){", + " pm.expect(jsonData).to.have.property(\"access_token\");", + " pm.expect(jsonData.access_token).to.be.a(\"string\").and.not.empty;", + "});", + "pm.test(\"Refresh token exists\", function(){", + " pm.expect(jsonData).to.have.property(\"refresh_token\");", + " pm.expect(jsonData.refresh_token).to.be.a(\"string\").and.not.empty;", + "});", + "pm.test(\"Expires In is present\", function(){", + " pm.expect(jsonData).to.have.property(\"expires_in\");", + " pm.expect(jsonData.expires_in).to.not.eql(null);", + "});", + "pm.test(\"Refresh Expires In is present\", function(){", + " pm.expect(jsonData).to.have.property(\"refresh_expires_in\");", + " pm.expect(jsonData.refresh_expires_in).to.not.eql(null);", + "});", + "", + "pm.globals.unset(\"auth_failure_reason\");", + "pm.globals.set(\"operator_token\", jsonData.access_token);", + "pm.globals.set(\"operator_refresh_token\", jsonData.refresh_token);", + "pm.globals.set(\"token_expires\", Date.now() + (jsonData.expires_in * 1000));", + "pm.globals.set(\"refresh_token_expires\", Date.now() + (jsonData.refresh_expires_in * 1000));", + "pm.globals.set(\"expires_in\", jsonData.expires_in);", + "pm.globals.set(\"refresh_expires_in\", jsonData.refresh_expires_in);", + "pm.globals.set(\"token\", jsonData.access_token);", + "pm.globals.set(\"refresh_token\", jsonData.refresh_token);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/x-www-form-urlencoded" + } + ], + "body": { + "mode": "raw", + "raw": "grant_type=password&client_id={{clientid}}&username={{userid}}&password={{password}}&client_secret={{client_secret}}" + }, + "url": { + "raw": "{{auth_url}}/auth/realms/{{realm}}/protocol/openid-connect/token?Content-Type=application/x-www-form-urlencoded", + "host": [ + "{{auth_url}}" + ], + "path": [ + "auth", + "realms", + "{{realm}}", + "protocol", + "openid-connect", + "token" + ], + "query": [ + { + "key": "Content-Type", + "value": "application/x-www-form-urlencoded" + } + ] + }, + "description": "Make sure the operator ID can log in" + }, + "response": [] + }, + { + "name": "Who am I TheQ", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "if (jsonData.hasOwnProperty(\"csr\")) {", + "\tcurrentOfficeId = jsonData.csr.office_id;", + "\tcurrentOfficeNumber = jsonData.csr.office.office_number;", + "\tcurrentCsrId = jsonData.csr.csr_id;", + " postman.setEnvironmentVariable(\"current_office_id\", currentOfficeId);", + " postman.setEnvironmentVariable(\"current_office_number\", currentOfficeNumber);", + " postman.setEnvironmentVariable(\"current_csr_id\", currentCsrId);", + "};", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}csrs/me/", + "host": [ + "{{url}}csrs" + ], + "path": [ + "me", + "" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Check channels", + "item": [ + { + "name": "Get channels", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "2b71673c-4aa2-47b3-8594-15f02b390ee0", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "42742c4c-505d-472d-857b-fdba74cc49ac", + "exec": [ + "// Run basic tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "var schema = {", + " \"properties\" : {", + " \"channel_name\" : {", + " \"type\" : \"string\"", + " },", + " \"channel_id\" : {", + " \"type\" : [\"number\", \"object\"]", + " }", + " },", + " \"required\" : [\"channel_name\", \"channel_id\"]", + "};", + "", + "// Loop to validate schema of each channel.", + "var allChannels = jsonData.channels;", + "var channelCount = 0;", + "var phoneId = 0;", + "var emailId = 0;", + "var phoneText = \"Phone\";", + "var emailText = \"Email/Fax/Mail\";", + "allChannels.forEach(function(channel) {", + " channelCount ++;", + " var testTitle = \"Channel (\" + channelCount + \"): ID \" + channel.channel_id + \" Name \" + channel.channel_name + \" conforms to schema\";", + " tests[testTitle] = tv4.validate(channel, schema);", + " if (channel.channel_name === phoneText) {", + " phoneId = channel.channel_id;", + " }", + " if (channel.channel_name === emailText) {", + " emailId = channel.channel_id;", + " }", + "});", + "", + "// Check that you found the phone ID.", + "pm.test(phoneText + ' id was ' + phoneId.toString() + ' (should not equal 0)', function() {", + " pm.expect(phoneId).to.not.be.eql(0);", + "});", + "", + "// Check that you found the email ID.", + "pm.test(emailText + ' id was ' + emailId.toString() + ' (should not equal 0)', function() {", + " pm.expect(emailId).to.not.be.eql(0);", + "});", + "", + "// Store this ID for future use.", + "postman.setEnvironmentVariable(\"channel_telephone_id\", JSON.stringify(phoneId));", + "postman.setEnvironmentVariable(\"channel_email_id\", JSON.stringify(emailId));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}channels/", + "host": [ + "{{url}}channels" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Check counters", + "item": [ + { + "name": "Store CSR and Office Info", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "// Define the JSON Schema expected in response", + "var CSRSSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"csr_id\": {\"type\": \"number\"},", + " \"csr_state\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"csr_state_desc\": {\"type\": \"string\"},", + " \"csr_state_id\": {\"type\": \"number\"},", + " \"csr_state_name\": {\"type\": \"string\"}", + " },", + " \"required\": [\"csr_state_desc\", \"csr_state_id\", \"csr_state_name\"]", + " },", + " \"csr_state_id\": {\"type\": \"number\"},", + " \"deleted\": {},", + " \"finance_designate\": {\"type\": \"number\"},", + " \"office_manager\": {\"type\": \"number\"},", + " \"ita2_designate\": {\"type\": \"number\"},", + " \"office\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"appointments_enabled_ind\": {\"type\": \"number\"},", + " \"exams_enabled_ind\": {\"type\": \"number\"},", + " \"office_id\": {\"type\": \"number\"},", + " \"office_name\": {\"type\": \"string\"},", + " \"office_number\": {\"type\": \"number\"},", + " \"sb\":{", + " \"type\": \"object\",", + " \"properties\": {", + " \"sb_id\": {\"type\": \"number\"},", + " \"sb_type\": {\"type\": \"string\"}", + " },", + " \"required\": [\"sb_id\", \"sb_type\"]", + " }", + " },", + " \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"sb\"]", + " },", + " \"office_name\": {\"type\": \"string\"},", + " \"pesticide_designate\": {\"type\": \"number\"},", + " \"qt_xn_csr_ind\": {\"type\": \"number\"},", + " \"receptionist_ind\": {\"type\": \"number\"},", + " \"role\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"role_code\": {\"type\": \"string\"},", + " \"role_desc\": {\"type\": \"string\"},", + " \"role_id\": {\"type\": \"number\"}", + " },", + " \"required\": [\"role_code\", \"role_desc\", \"role_id\"]", + " },", + " \"role_id\": {\"type\": \"number\"},", + " \"username\": {\"type\": \"string\"}", + " },", + " \"attention_needed\": {\"type\": \"boolean\"},", + " \"required\": [\"csr\", \"attention_needed\"]", + "};", + "", + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate Response CSRs Schema\", function(){", + " pm.expect(tv4.validate(jsonData, CSRSSchema)).to.be.true;", + "});", + "", + "// Make sure that jsonData has an csr property.", + "pm.test(\"Response should have csr property\", function(){", + " pm.expect(jsonData.hasOwnProperty(\"csr\")).to.be.true;", + "});", + "", + "var csr = 0;", + "var office = 0;", + "var counters = 0;", + "var counter_text = \"Counter\";", + "var counter_id = 0;", + "var qtxn_text = \"Quick Trans\";", + "var qtxn_id = 0;", + "", + "if (jsonData.hasOwnProperty(\"csr\")) {", + "\tcurrentOfficeId = jsonData.csr.office_id;", + "\tcurrentOfficeNumber = jsonData.csr.office.office_number;", + " postman.setEnvironmentVariable(\"current_office_id\", currentOfficeId);", + " postman.setEnvironmentVariable(\"current_office_number\", currentOfficeNumber);", + " postman.setEnvironmentVariable(\"current_csr_id\", jsonData.csr.csr_id);", + " ", + " csr = jsonData.csr;", + " counter_id = 0;", + " qtxn_id = 0;", + "", + " // Make sure that jsonData has an booking property.", + " pm.test(\"CSR should have office property\", function(){", + " pm.expect(csr.hasOwnProperty(\"office\")).to.be.true;", + " });", + " ", + " // Make sure office has counter property.", + " if (csr.hasOwnProperty(\"office\")) {", + " office = csr.office;", + " ", + " // Make sure that jsonData has an booking property.", + " pm.test(\"Office should have counters property\", function(){", + " pm.expect(office.hasOwnProperty(\"counters\")).to.be.true;", + " });", + "", + " // Make sure office has counter property.", + " if (office.hasOwnProperty(\"counters\")) {", + " counters = office.counters;", + " ", + " // Search for Counter and Quick Trans counters", + " counters.forEach(function(counter) {", + " if (counter.counter_name === counter_text) {", + " counter_id = counter.counter_id;", + " }", + " if (counter.counter_name === qtxn_text) {", + " qtxn_id = counter.counter_id;", + " }", + " });", + " ", + " // Make sure you found the right IDs.", + " pm.test(\"Counter ID (\" + counter_id.toString() + \") should not be 0\", function(){", + " pm.expect(counter_id).to.not.be.eql(0);", + " });", + " pm.test(\"Quick Transaction ID (\" + qtxn_id.toString() + \") should not be 0\", function(){", + " pm.expect(qtxn_id).to.not.be.eql(0);", + " });", + " ", + " // Store the ids for future use.", + " // postman.setEnvironmentVariable(\"counter_id\", counter_id);", + " // postman.setEnvironmentVariable(\"qtxn_id\", qtxn_id);", + " postman.setEnvironmentVariable(\"counter_id\", JSON.stringify(counter_id.toString()));", + " postman.setEnvironmentVariable(\"qtxn_id\", JSON.stringify(qtxn_id.toString()));", + " }", + "", + " ", + " }", + "", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}csrs/me/", + "host": [ + "{{url}}csrs" + ], + "path": [ + "me", + "" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Check categories", + "item": [ + { + "name": "Get categories", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "e99f23ee-5a03-43d9-9075-75dbf06aadcc", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "1a9c9ff5-8475-4dd2-a6c7-ffb5d4689145", + "exec": [ + "// Run basic tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "var schema = {", + " \"properties\" : {", + " \"display_dashboard_ind\" : {", + " \"type\" : \"number\"", + " },", + " \"deleted\" : {", + " \"type\" : [\"object\", \"null\"]", + " },", + " \"actual_service_ind\" : {", + " \"type\" : \"number\"", + " },", + " \"service_id\" : {", + " \"type\" : [\"number\", \"object\"]", + " },", + " \"service_code\" : {", + " \"type\" : \"string\"", + " },", + " \"prefix\" : {", + " \"type\" : \"string\"", + " },", + " \"service_name\" : {", + " \"type\" : \"string\"", + " },", + " \"parent_id\" : {", + " \"type\" : [\"object\", \"null\" ]", + " },", + " \"service_desc\" : {", + " \"type\" : \"string\"", + " }", + " },", + " \"required\" : [\"display_dashboard_ind\", \"deleted\", \"actual_service_ind\", \"service_id\", \"service_code\",", + " \"prefix\", \"service_name\", \"parent_id\", \"service_desc\"]", + "};", + "", + "// Loop to validate schema of each channel.", + "var allCategories = jsonData.categories;", + "var categoryCount = 0;", + "allCategories.forEach(function(category) {", + " categoryCount ++;", + " var testTitle = \"Category (\" + categoryCount + \"): \" + category.service_name + \" - \";", + " tests[testTitle + \"conforms to schema\"] = tv4.validate(category, schema);", + " var displayInd = category.display_dashboard_ind;", + " var serviceInd = category.actual_service_ind;", + "", + " // Test that returned data is valid.", + " pm.test(\"--> \" + testTitle + \"display_dashboard_ind must be 0 (is \" + displayInd.toString() + \")\", function(){", + " pm.expect(displayInd).to.be.eql(0);", + " });", + "", + " pm.test(\"--> \" + testTitle + \"actual_service_ind must be 0 (is \" + serviceInd.toString() + \")\", function(){", + " pm.expect(serviceInd).to.be.eql(0);", + " });", + " ", + " pm.test(\"--> \" + testTitle + \"parent_id must be null\", function(){", + " pm.expect(category.parent_id).to.be.null;", + " });", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}categories/", + "host": [ + "{{url}}categories" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Check services", + "item": [ + { + "name": "Get services", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "d01c3826-dc28-4cce-957b-ec70d0393e7e", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "3b11031e-4031-4569-91f2-49e23517ffee", + "exec": [ + "// Run basic tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "var schema = {", + " \"properties\" : {", + " \"display_dashboard_ind\" : {", + " \"type\" : \"number\"", + " },", + " \"deleted\" : {", + " \"type\" : [\"object\", \"null\"]", + " },", + " \"actual_service_ind\" : {", + " \"type\" : \"number\"", + " },", + " \"service_id\" : {", + " \"type\" : [\"number\", \"object\"]", + " },", + " \"service_code\" : {", + " \"type\" : \"string\"", + " },", + " \"prefix\" : {", + " \"type\" : \"string\"", + " },", + " \"service_name\" : {", + " \"type\" : \"string\"", + " },", + " \"parent_id\" : {", + " \"type\" : [\"object\", \"number\", \"null\" ]", + " },", + " \"service_desc\" : {", + " \"type\" : \"string\"", + " }", + " },", + " \"required\" : [\"display_dashboard_ind\", \"deleted\", \"actual_service_ind\", \"service_id\", \"service_code\",", + " \"prefix\", \"service_name\", \"parent_id\", \"service_desc\"]", + "};", + "", + "// Loop to validate schema of each channel.", + "var allElements = jsonData.services;", + "var elementCount = 0;", + "var elementMax = Math.min(10, allElements.length);", + "//allElements.forEach(function(element) {", + "for (var currentElement = 0; currentElement < elementMax; currentElement++) {", + " element = allElements[currentElement];", + " elementCount ++;", + " var testTitle = \"Service (\" + elementCount + \"): \" + element.service_name + \" - \";", + " tests[testTitle + \"conforms to schema\"] = tv4.validate(element, schema);", + " displayInd = element.display_dashboard_ind;", + " serviceInd = element.actual_service_ind;", + "", + " // Test that returned data is valid.", + " pm.test(\"--> \" + testTitle + \"display_dashboard_ind must be 0 or 1 (is \" + displayInd.toString() + \")\", function(){", + " pm.expect(displayInd).to.be.within(0, 1);", + " });", + "", + " // Test that returned data is valid.", + " pm.test(\"--> \" + testTitle + \"actual_service_ind must be 1 (is \" + serviceInd.toString() + \")\", function(){", + " pm.expect(serviceInd).to.be.eql(1);", + " });", + " ", + " // Test that returned data is valid.", + " pm.test(\"--> \" + testTitle + \"parent_id must not be null\", function(){", + " pm.expect(element.parent_id).to.not.be.null;", + " });", + "}", + "", + "// Declare and initialize variables.", + "var mspId = 0;", + "var taxId = 0;", + "var mspText = \"Payment - MSP\";", + "var propTaxText = \"Other - PTAX\";", + "", + "// Look for the MSP and Property Tax IDs.", + "allElements.forEach(function(element) {", + " if (element.service_name === mspText) {", + " mspId = element.service_id;", + " }", + " if (element.service_name === propTaxText) {", + " taxId = element.service_id;", + " }", + "});", + "", + "// Check that you found the MSP service.", + "pm.test(mspText + ' id was ' + mspId.toString() + ' (should not equal 0)', function() {", + " pm.expect(mspId).to.not.be.eql(0);", + "});", + "", + "// Check that you found the Property Tax service.", + "pm.test(propTaxText + ' id was ' + taxId.toString() + ' (should not equal 0)', function() {", + " pm.expect(taxId).to.not.be.eql(0);", + "});", + "", + "// Store these IDs for future use.", + "postman.setEnvironmentVariable(\"service_MSP_id\", JSON.stringify(mspId));", + "postman.setEnvironmentVariable(\"service_PropTax_id\", JSON.stringify(taxId));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}services/", + "host": [ + "{{url}}services" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Clear queue for tests", + "item": [ + { + "name": "Delete citizen queue driver", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "7f6d8d4e-e4fe-451f-a5d9-119fcefcd527", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "27f63d12-7c7c-42e1-9647-85480ee17cb8", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Delete citizens, if there are any.", + " if (citizenIds.length > 0) {", + " ", + " // Set the current_client, to be deleted.", + " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", + " postman.setEnvironmentVariable(\"current_queue\", JSON.stringify(citizenIds));", + " ", + " if (currentCitizen.service_reqs.length === 0) {", + " postman.setNextRequest(\"Next citizen left\");", + " // // Temporary kludge. Citizen left not working, so add SR, then delete.", + " // postman.setNextRequest(\"Temporary add MSP service request\");", + " }", + " else {", + " postman.setNextRequest(\"Next citizen finish service\");", + " }", + " }", + " ", + " // No more citizens. Clear the current, queue variables.", + " else {", + " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(\"\"));", + " postman.setEnvironmentVariable(\"current_queue\", JSON.stringify(\"\"));", + " postman.setNextRequest(\"End clear queue via healthz endpoint\");", + " }", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Next citizen finish service", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e516a2b7-0555-43b5-8058-ccd92b5b6e95", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "var citizenToBeDeleted = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "var citizenData = jsonData.citizen;", + "var testTitle = \"Check citizen finish service\";", + "", + "// Make sure the response is valid.", + "pm.test(testTitle + \": Response should have property 'citizen'\", function(){", + " pm.expect(jsonData.hasOwnProperty(\"citizen\")).to.be.true;", + "});", + "pm.test(testTitle + \": Response should not have property 'message' indicating an error\", function(){", + " pm.expect(jsonData.hasOwnProperty(\"message\")).to.be.false;", + "});", + "pm.test(testTitle + \": Citizen marked as finished should be citizen \" + citizenToBeDeleted.toString(), function(){", + " pm.expect(citizenData.citizen_id).to.be.eql(citizenToBeDeleted);", + "});", + "", + "// Go back to the delete citizen queue driver.", + "postman.setNextRequest(\"Delete citizen queue driver\");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/finish_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "finish_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Next citizen citizen left", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "6caff547-493f-4f0d-a121-f8e3398f11c3", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get environment variables.", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + " // Perform checks.", + " pm.test(\"Check there are no citizens waiting\", function(){", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test(\"Citizen that left must be \" + currentCitizen.citizen_id.toString() + \" (is \" + currentCitizenId.toString(), function(){", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + "}", + "", + "// Go back to the delete citizen queue driver.", + "postman.setNextRequest(\"Delete citizen queue driver\");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/citizen_left/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "citizen_left", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Temporary add MSP service request", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"service_MSP_id\",\"current_client\",\"channel_telephone_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "c2ec515b-209f-4d91-81c1-c72a14600685", + "exec": [ + "// Run create tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "var svcReq = jsonData.service_request;", + "", + "// Set schema of the service_request property.", + "var schema = {", + " \"properties\" : {", + " \"periods\" : {", + " \"type\" : \"array\"", + " },", + " \"service_id\" : {", + " \"type\" : [\"number\", \"object\"]", + " },", + " \"service\" : {", + " \"type\" : \"object\"", + " },", + " \"sr_state\" : {", + " \"type\" : \"object\"", + " },", + " \"quantity\" : {", + " \"type\" : \"number\"", + " },", + " \"sr_id\" : {", + " \"type\" : [\"number\", \"object\"]", + " },", + " \"citizen\" : {", + " \"type\" :[\"number\", \"object\"]", + " },", + " \"citizen_id\" : {", + " \"type\" : [\"number\", \"object\"]", + " },", + " \"channel\" : {", + " \"type\" : \"object\"", + " },", + " \"channel_id\" : {", + " \"type\" : [\"number\", \"object\"]", + " }", + " },", + " // \"required\" : [\"periods\", \"service_id\", \"sr_state_id\", \"service\"]", + " \"required\" : [\"periods\", \"service_id\", \"service\", \"sr_state\", \"quantity\", \"sr_id\",", + " \"citizen\", \"citizen_id\", \"channel\", \"channel_id\"]", + "};", + "", + "// Make sure the response is valid.", + "pm.test(\"Response has service_request property\", function(){", + " pm.expect(jsonData.hasOwnProperty(\"service_request\")).to.be.true;", + "});", + "pm.test(\"Response has errors property\", function(){", + " pm.expect(jsonData.hasOwnProperty(\"errors\")).to.be.true;", + "});", + "tests[\"Service_request property has correct schema\"] = tv4.validate(svcReq, schema);", + "", + "// Go back to the clear citizen driver.", + "postman.setNextRequest(\"Next citizen finish service\");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_MSP_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : 1,\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" + }, + "url": { + "raw": "{{url}}service_requests/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "End clear queue via healthz endpoint", + "event": [ + { + "listen": "test", + "script": { + "id": "74adc5ce-caa5-452a-bd96-8ac90a4c11d7", + "exec": [ + "// Perform the standard tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Test the health response.", + "pm.test(\"Response should have 'message' property\", function() {", + " pm.expect(jsonData).to.have.property('message');", + "});", + "", + "pm.test(\"Response message should be 'api is healthy'\", function() {", + " pm.expect(jsonData.message).to.be.eql('api is healthy');", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}healthz/", + "host": [ + "{{url}}healthz" + ], + "path": [ + "" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Check citizen through queue (QT1)", + "item": [ + { + "name": "Check no citizens (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "9f95832a-57ef-4dcf-bdfe-916d2eb5d006", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "2cbca8d4-50d9-4dde-9239-af3c987949b8", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var allOK = true;", + "", + "// If citizen property was present.", + "", + "if (allElements !== null) {", + "", + " // Make sure it had a length of 0.", + " if (allElements.length !== 0) {", + " allOK = false;", + " }", + "}", + "", + "pm.test(\"There should be no citizens in the office\", function() {", + " pm.expect(allOK).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Create citizen (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "7896261d-7d88-4eba-860b-98472655c4a7", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " pm.test(\"Only one citizen should be in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Current citizen comments should be null\", function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + " ", + " // Store the ID of the citizen just created.", + " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{}" + }, + "url": { + "raw": "{{url}}citizens/0/add_citizen/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "0", + "add_citizen", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Edit specific citizen (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "b72e7756-5de1-4a13-9609-8917ea63dee7", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\",\"citizen_name\",\"citizen_comment\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "73110fdd-6476-403d-b6c9-c108032fbd66", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + "", + " // Perform tests.", + " pm.test(\"Must be one active citizen in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}}\n}" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Add property tax via phone service request (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"service_PropTax_id\",\"current_client\",\"citizen_quantity\",\"channel_telephone_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "fa6f6a3b-e4e7-42b6-a8d3-ecda3840418a", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" + }, + "url": { + "raw": "{{url}}service_requests/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "List specific citizen (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "66ca9683-be00-478b-92c0-6ac698d9088b", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request must have one period', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", + " });", + " pm.test('Service request period channel must be ' + citizenChannel, function() {", + " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", + " });", + " pm.test('Service request period state must be \"Ticket Creation\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Add citizen to queue (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "8a294876-edfa-4d5b-ada4-399f5339cd8f", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Pending\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (now two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Waiting\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/add_to_queue/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "add_to_queue", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Invite specific citizen (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "8e9cd1ef-a5d9-4f81-b061-f818d4fc5603", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 3 (now three periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(3);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Invited\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Invited\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/invite/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "invite", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Begin serving citizen (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "1b1f7f66-04cd-4f10-bfa2-c4f3fffe8715", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 4 (now four periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(4);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Being Served\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/begin_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "begin_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Finish serving citizen (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "818713b9-18a0-4fef-9c16-f71b43dd2ad0", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be no active citizens in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Complete\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 4 (still four periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(4);", + " });", + " pm.test('There must be no open periods', function() {", + " pm.expect(openPeriodCount).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/finish_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "finish_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Check citizen begin-hold-finish (QT2)", + "item": [ + { + "name": "Check no citizens (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "3d9d9302-3b15-49f0-8bb2-3de1f4d134b8", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "2cbca8d4-50d9-4dde-9239-af3c987949b8", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var allOK = true;", + "", + "// If citizen property was present.", + "if (allElements !== null) {", + "", + " // Make sure it had a length of 0.", + " if (allElements.length !== 0) {", + " allOK = false;", + " }", + "}", + "", + "pm.test(\"There should be no citizens in the office\", function() {", + " pm.expect(allOK).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Create citizen (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77d15de-91e2-4528-87bd-5734405b4def", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Perform tests.", + " pm.test(\"Only one citizen should be in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Current citizen comments should be null\", function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + " ", + " // Store the ID of the citizen just created.", + " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", + "} ", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{}" + }, + "url": { + "raw": "{{url}}citizens/0/add_citizen/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "0", + "add_citizen", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Edit specific citizen (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "ce732be5-38a3-4825-90d1-4d52babf8917", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\",\"citizen_name\",\"citizen_comment\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// // Get data, create JSON body.", + "// var citizenName = postman.getEnvironmentVariable(\"citizen_name\");", + "// var citizenComments = postman.getEnvironmentVariable(\"citizen_comment\");", + "// var bodyData = {", + "// \"citizen_name\" : citizenName,", + "// \"citizen_comments\" : citizenComments", + "// }", + "// // Store the data in an environment variable.", + "// postman.setEnvironmentVariable(\"putBody\", JSON.stringify(bodyData));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "13828662-748d-4b3f-9ead-454e795f1f01", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + "", + " // Perform tests.", + " pm.test(\"Must be one active citizen in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}}\n}" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Add property tax via phone service request (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"service_PropTax_id\",\"current_client\",\"citizen_quantity\",\"channel_telephone_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "fa6f6a3b-e4e7-42b6-a8d3-ecda3840418a", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" + }, + "url": { + "raw": "{{url}}service_requests/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "List specific citizen (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "2a57d1b2-9d0c-4e07-ad20-d4dde457f9d1", + "exec": [ + "// Install postmanBDD, json-bigint parse and stringify.", + "eval(globals.postmanBDD);", + "eval(globals.json_bigint_parse);", + "", + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request must have one period', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", + " });", + " pm.test('Service request period channel must be ' + citizenChannel, function() {", + " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", + " });", + " pm.test('Service request period state must be \"Ticket Creation\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Begin serving citizen (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "4550a6b7-560d-48bf-bfc9-41453a8defec", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (now two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Being Served\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/begin_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "begin_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Place citizen on hold (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "dd51a48d-2e1e-47fd-978f-507b77a7901f", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 3 (now three periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(3);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"On hold\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"On hold\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/place_on_hold/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "place_on_hold", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Get service requests (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "f4809d17-b59d-47fc-861e-5edaf421bddc", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.service_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + "var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + "var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get periods for the first service request.", + " var allPeriods = allElements[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " var allPeriodCount = 0;", + "", + " // Find how many periods there are with null end time.", + " // Also, check schema.", + " allPeriods.forEach(function(onePeriod) {", + " ", + " // Find the open period.", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " ", + " });", + "} ", + "", + "// If there are some service requests, proceed with tests.", + "if (allElements !== null) {", + "", + " // Perform tests.", + " pm.test('There must be only one service request', function() {", + " pm.expect(allElements.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(allElements[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(allElements[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(allElements[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request must have three periods', function() {", + " pm.expect(allPeriods.length).to.be.eql(3);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('Service request period state must be \"On hold\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"On hold\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/service_requests/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "service_requests", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Call citizen from hold (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "66563797-2a92-4dbd-946e-7232dcac8260", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 4 (now four periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(4);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Being Served\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/begin_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "begin_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Finish serving citizen (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "ec865f9c-a4b6-421f-956e-783972df2ad3", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + " ", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = allElements[0].service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be no active citizens in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Complete\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 4 (still four periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(4);", + " });", + " pm.test('There must be no open periods', function() {", + " pm.expect(openPeriodCount).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/finish_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "finish_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Check citizen leave after create (QT3)", + "item": [ + { + "name": "Check no citizens (QT3)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "6cb5de42-277f-4c2d-b5ef-64b0f514d5bd", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "2cbca8d4-50d9-4dde-9239-af3c987949b8", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var allOK = true;", + "", + "// If citizen property was present.", + "if (allElements !== null) {", + "", + " // Make sure it had a length of 0.", + " if (allElements.length !== 0) {", + " allOK = false;", + " }", + "}", + "", + "pm.test(\"There should be no citizens in the office\", function() {", + " pm.expect(allOK).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Create citizen (QT3)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "061a479c-37b4-4707-b8c6-c31cacadecec", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Perform tests.", + " pm.test(\"Only one citizen should be in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Current citizen comments should be null\", function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "", + " // Store the ID of the citizen just created.", + " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{}" + }, + "url": { + "raw": "{{url}}citizens/0/add_citizen/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "0", + "add_citizen", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Citizen left (QT3)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "16eaefc2-0d16-405e-9e70-e85314da841b", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get environment variables.", + " var citizenName = postman.getEnvironmentVariable(\"citizen_name\");", + " var citizenComment = postman.getEnvironmentVariable(\"citizen_comment\");", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = null;", + " if (currentCitizen.service_reqs.length !== 0) {", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " }", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " if (allPeriods !== null) {", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + " }", + "", + " // Perform tests.", + " pm.test(\"Must be no active citizens in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Current citizen comments should be null\", function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/citizen_left/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "citizen_left", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Check citizen leave after waiting (QT4)", + "item": [ + { + "name": "Check no citizens (QT4)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "bc24cb66-e882-4b8a-b879-2d287078efab", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "2cbca8d4-50d9-4dde-9239-af3c987949b8", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var allOK = true;", + "", + "// If citizen property was present.", + "if (allElements !== null) {", + "", + " // Make sure it had a length of 0.", + " if (allElements.length !== 0) {", + " allOK = false;", + " }", + "}", + "", + "pm.test(\"There should be no citizens in the office\", function() {", + " pm.expect(allOK).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Create citizen (QT4)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "fcc1415c-0861-4516-8843-bfc3717a76d9", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Perform tests.", + " pm.test(\"Only one citizen should be in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Current citizen comments should be null\", function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "", + " // Store the ID of the citizen just created.", + " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{}" + }, + "url": { + "raw": "{{url}}citizens/0/add_citizen/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "0", + "add_citizen", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Edit specific citizen (QT4)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "f26eaedb-5d41-4dcc-b856-aec599440601", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\",\"citizen_name\",\"citizen_comment\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// // Get data, create JSON body.", + "// var citizenName = postman.getEnvironmentVariable(\"citizen_name\");", + "// var citizenComments = postman.getEnvironmentVariable(\"citizen_comment\");", + "// var bodyData = {", + "// \"citizen_name\" : citizenName,", + "// \"citizen_comments\" : citizenComments", + "// }", + "// // Store the data in an environment variable.", + "// postman.setEnvironmentVariable(\"putBody\", JSON.stringify(bodyData));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e0b48324-0ca2-4b2e-88ef-cbfbe10b5fb7", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + "", + " // Perform tests.", + " pm.test(\"Must be one active citizen in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}}\n}" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Add property tax via phone service request (QT4)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"service_PropTax_id\",\"current_client\",\"citizen_quantity\",\"channel_telephone_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "fa6f6a3b-e4e7-42b6-a8d3-ecda3840418a", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" + }, + "url": { + "raw": "{{url}}service_requests/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "List specific citizen (QT4)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "1176fcca-52ff-4e13-b4a4-775ad324a4c6", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request must have one period', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", + " });", + " pm.test('Service request period channel must be ' + citizenChannel, function() {", + " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", + " });", + " pm.test('Service request period state must be \"Ticket Creation\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Add citizen to queue (QT4)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "f0aacc69-ff0e-4ed3-9ef7-f131bbf3a5bd", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Pending\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (now two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Waiting\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/add_to_queue/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "add_to_queue", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Citizen left (QT4)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "4ee90115-54c2-4b44-b6f1-d739e8a385b1", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test(\"Must be no active citizens in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test(\"Current citizen comments should be null\", function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.null;", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test(\"Citizen should have one service request\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Complete\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (now two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must be no open periods', function() {", + " pm.expect(openPeriodCount).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/citizen_left/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "citizen_left", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Check no citizens (QT4)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "6cb5de42-277f-4c2d-b5ef-64b0f514d5bd", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "2cbca8d4-50d9-4dde-9239-af3c987949b8", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var allOK = true;", + "", + "// If citizen property was present.", + "if (allElements !== null) {", + "", + " // Make sure it had a length of 0.", + " if (allElements.length !== 0) {", + " allOK = false;", + " }", + "}", + "", + "pm.test(\"There should be no citizens in the office\", function() {", + " pm.expect(allOK).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Check update service information (QT5)", + "item": [ + { + "name": "Check no citizens (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "4dd23acf-1f43-42be-b965-0b11121f33f3", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "2cbca8d4-50d9-4dde-9239-af3c987949b8", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var allOK = true;", + "", + "// If citizen property was present.", + "if (allElements !== null) {", + "", + " // Make sure it had a length of 0.", + " if (allElements.length !== 0) {", + " allOK = false;", + " }", + "}", + "", + "pm.test(\"There should be no citizens in the office\", function() {", + " pm.expect(allOK).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Create citizen (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "d3bbd88a-25fd-4fe6-ae7e-359373df02ac", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Perform tests.", + " pm.test(\"Only one citizen should be in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Current citizen comments should be null\", function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "", + " // Store the ID of the citizen just created.", + " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{}" + }, + "url": { + "raw": "{{url}}citizens/0/add_citizen/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "0", + "add_citizen", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Edit specific citizen (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "2be395b2-e14c-4ff8-8753-42ea1fe2010d", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\",\"citizen_name\",\"citizen_comment\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// // Get data, create JSON body.", + "// var citizenName = postman.getEnvironmentVariable(\"citizen_name\");", + "// var citizenComments = postman.getEnvironmentVariable(\"citizen_comment\");", + "// var bodyData = {", + "// \"citizen_name\" : citizenName,", + "// \"citizen_comments\" : citizenComments", + "// };", + "// // Store the data in an environment variable.", + "// postman.setEnvironmentVariable(\"putBody\", JSON.stringify(bodyData));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "2e7878d3-653e-479e-850f-c454b378217e", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + " ", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + "", + " // Perform tests.", + " pm.test(\"Must be one active citizen in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}}\n}" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Add property tax via phone service request (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"service_PropTax_id\",\"current_client\",\"citizen_quantity\",\"channel_telephone_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "fa6f6a3b-e4e7-42b6-a8d3-ecda3840418a", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" + }, + "url": { + "raw": "{{url}}service_requests/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "List specific citizen (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "3d906a10-51fe-4329-bac0-e69e6847e852", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + " ", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request must have one period', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", + " });", + " pm.test('Service request period channel must be ' + citizenChannel, function() {", + " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", + " });", + " pm.test('Service request period state must be \"Ticket Creation\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", + " });", + "", + " // Save the service request ID for later.", + " var mySRId = allElements[0].service_reqs[0].sr_id;", + " postman.setEnvironmentVariable(\"current_sr_id\", JSON.stringify(mySRId));", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Begin serving citizen (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "ff3a25ca-0df2-40f2-b7a1-9e9b4bde2aab", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (now two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Being Served\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/begin_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "begin_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Update quantity from 3 to 5 (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_sr_id\",\"operator_token\",\"citizen_quantity_update\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "153a139d-0daa-4031-ba0a-e7204ade2648", + "exec": [ + "// Run complex tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.service_response_test);", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Only check for an updated quantity. Get environment variables.", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", + "", + " // Perform tests.", + " pm.test('Updated service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(allElements[0].quantity).to.be.eql(citizenQuantity);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"quantity\" : {{citizen_quantity_update}}\n}" + }, + "url": { + "raw": "{{url}}service_requests/{{current_sr_id}}/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "{{current_sr_id}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Update service from PropTax to MSP (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_sr_id\",\"operator_token\",\"service_MSP_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "8faaa693-a7a4-45ed-9318-325a498a98af", + "exec": [ + "// Run complex tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.service_response_test);", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Only check for an updated quantity. Get environment variables.", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", + "", + " // Perform tests.", + " pm.test('Updated service request service must be ' + citizenService, function() {", + " pm.expect(allElements[0].service_id).to.be.eql(citizenService);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_id\" : {{service_MSP_id}}\n}" + }, + "url": { + "raw": "{{url}}service_requests/{{current_sr_id}}/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "{{current_sr_id}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Finish serving citizen (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "7a831dcf-ff2c-4907-95c5-bf042cdd967a", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be no active citizens in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Complete\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (should be two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must be no open periods', function() {", + " pm.expect(openPeriodCount).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/finish_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "finish_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Check pick qtxn customer (QT6)", + "item": [ + { + "name": "Check no citizens (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "9f95832a-57ef-4dcf-bdfe-916d2eb5d006", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "0aa4fd7b-529c-4f26-9998-c77d6c28eeb4", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var citizenCount = 0;", + "", + "// If citizen property was present.", + "if (allElements !== null) {", + "", + " // Get number of citizens in the queue.", + " citizenCount = allElements.length;", + "}", + "", + "pm.test(\"There should be no citizens in the office\", function() {", + " pm.expect(citizenCount).to.be.eql(0);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "First citizen - Create (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "cac82cd1-b2c1-4019-bf8f-bf8dfed473ef", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Perform tests.", + " pm.test(\"Only one citizen should have been created\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Current citizen comments should be null\", function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "", + " // Store the ID of the citizen just created.", + " postman.setEnvironmentVariable(\"first_client\", JSON.stringify(citizenIds.shift()));", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{}" + }, + "url": { + "raw": "{{url}}citizens/0/add_citizen/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "0", + "add_citizen", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "First citizen - Edit (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "f52aea38-cdcb-4d0b-8421-0ee5b7486913", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"first_client\",\"operator_token\",\"citizen_name\",\"citizen_comment\",\"counter_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "a0ded2ba-3a0d-45ff-ac3a-ee25ad2bd578", + "exec": [ + "// Install postmanBDD, json-bigint parse and stringify.", + "eval(globals.postmanBDD);", + "eval(globals.json_bigint_parse);", + "", + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + "", + " // Perform tests.", + " pm.test(\"Must be one active citizen in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}},\n \"counter_id\": {{counter_id}}\n}" + }, + "url": { + "raw": "{{url}}citizens/{{first_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{first_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "First citizen - Prop Tax via phone (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"service_PropTax_id\",\"first_client\",\"citizen_quantity\",\"channel_telephone_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "fa6f6a3b-e4e7-42b6-a8d3-ecda3840418a", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{first_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" + }, + "url": { + "raw": "{{url}}service_requests/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "First citizen - List (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"first_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "2eeb855a-cf49-4bab-abc4-739deef83d82", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request must have one period', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", + " });", + " pm.test('Service request period channel must be ' + citizenChannel, function() {", + " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", + " });", + " pm.test('Service request period state must be \"Ticket Creation\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{first_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{first_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "First citizen - Add to queue (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"first_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "c6bd4047-5ddb-4b96-9b1b-851455cbc71d", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Pending\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (now two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Waiting\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{first_client}}/add_to_queue/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{first_client}}", + "add_to_queue", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - Create (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "b5a2ef1c-c73c-4bc6-ba18-1370ba84bbe4", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Perform tests.", + " pm.test(\"Only one citizen should have been created\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Current citizen comments should be null\", function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "", + " // Store the ID of the citizen just created.", + " postman.setEnvironmentVariable(\"second_client\", JSON.stringify(citizenIds.shift()));", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{}" + }, + "url": { + "raw": "{{url}}citizens/1/add_citizen/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "1", + "add_citizen", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - Edit QTxn (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "f58d00cd-ab75-407b-ab4c-a541944510e3", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"second_client\",\"operator_token\",\"citizen_name_quick\",\"citizen_comment_quick\",\"qtxn_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// // Get data, create JSON body.", + "// var citizenName = postman.getEnvironmentVariable(\"citizen_name_quick\");", + "// var citizenComments = postman.getEnvironmentVariable(\"citizen_comment_quick\");", + "// var bodyData = {", + "// \"citizen_name\" : citizenName,", + "// \"citizen_comments\" : citizenComments,", + "// \"qt_xn_citizen_ind\" : 1", + "// };", + "// // Store the data in an environment variable.", + "// postman.setEnvironmentVariable(\"putBody\", JSON.stringify(bodyData));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "12b50df4-9162-4d6d-8ec4-ddebc3cb6cda", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", + "", + " // Perform tests.", + " pm.test(\"Should be updating single citizen\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"citizen_name\" : {{citizen_name_quick}},\n \"citizen_comments\" : {{citizen_comment_quick}},\n \"qt_xn_citizen_ind\" : 1,\n \"counter_id\": {{qtxn_id}}\n}" + }, + "url": { + "raw": "{{url}}citizens/{{second_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{second_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - MSP via email (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"service_MSP_id\",\"second_client\",\"citizen_quantity_update\",\"channel_email_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "fa6f6a3b-e4e7-42b6-a8d3-ecda3840418a", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_MSP_id}},\n\t\t\"citizen_id\" : {{second_client}},\n\t\t\"quantity\" : {{citizen_quantity_update}},\n\t\t\"channel_id\" : {{channel_email_id}}\n\t}\n}" + }, + "url": { + "raw": "{{url}}service_requests/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - List (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"second_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "6abcbbab-941e-43b4-85e8-6c2f14a19c75", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", + "", + " // Perform tests.", + " pm.test('Should be updating one citizen', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request must have one period', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", + " });", + " pm.test('Service request period channel must be ' + citizenChannel, function() {", + " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", + " });", + " pm.test('Service request period state must be \"Ticket Creation\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{second_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{second_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - Add to queue (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"second_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "b396fdd7-845d-4702-ad69-1b53a2ced21b", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Should be adding one citizen to the queue', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Pending\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (now two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Waiting\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{second_client}}/add_to_queue/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{second_client}}", + "add_to_queue", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Check 2 citizens in queue (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "070b3e97-88a9-4e82-ae4e-cf476625b4b9", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "09e9a82d-d782-4916-b84d-970d41f0e231", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var citizenCount = 0;", + "", + "// If citizen property was present.", + "if (allElements !== null) {", + "", + " // Get number of citizens in the queue.", + " citizenCount = allElements.length;", + "}", + "", + "pm.test('Must be two active citizens in the office', function() {", + " pm.expect(citizenCount).to.be.eql(2);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Set CSR to QTxn (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "070b3e97-88a9-4e82-ae4e-cf476625b4b9", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_csr_id\",\"operator_token\",\"qtxn_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "09e9a82d-d782-4916-b84d-970d41f0e231", + "exec": [ + "// Define the JSON Schema expected in response", + "var CSRSSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"csr_id\": {\"type\": \"number\"},", + " \"csr_state\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"csr_state_desc\": {\"type\": \"string\"},", + " \"csr_state_id\": {\"type\": \"number\"},", + " \"csr_state_name\": {\"type\": \"string\"}", + " },", + " \"required\": [\"csr_state_desc\", \"csr_state_id\", \"csr_state_name\"]", + " },", + " \"csr_state_id\": {\"type\": \"number\"},", + " \"deleted\": {},", + " \"finance_designate\": {\"type\": \"number\"},", + " \"office_manager\": {\"type\": \"number\"},", + " \"ita2_designate\": {\"type\": \"number\"},", + " \"office\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"appointments_enabled_ind\": {\"type\": \"number\"},", + " \"exams_enabled_ind\": {\"type\": \"number\"},", + " \"office_id\": {\"type\": \"number\"},", + " \"office_name\": {\"type\": \"string\"},", + " \"office_number\": {\"type\": \"number\"},", + " \"sb\":{", + " \"type\": \"object\",", + " \"properties\": {", + " \"sb_id\": {\"type\": \"number\"},", + " \"sb_type\": {\"type\": \"string\"}", + " },", + " \"required\": [\"sb_id\", \"sb_type\"]", + " }", + " },", + " \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"sb\"]", + " },", + " \"pesticide_designate\": {\"type\": \"number\"},", + " \"qt_xn_csr_ind\": {\"type\": \"number\"},", + " \"receptionist_ind\": {\"type\": \"number\"},", + " \"role\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"role_code\": {\"type\": \"string\"},", + " \"role_desc\": {\"type\": \"string\"},", + " \"role_id\": {\"type\": \"number\"}", + " },", + " \"required\": [\"role_code\", \"role_desc\", \"role_id\"]", + " },", + " \"role_id\": {\"type\": \"number\"},", + " \"username\": {\"type\": \"string\"}", + " },", + " \"required\": [\"csr\"]", + "};", + "", + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate Response CSRs Schema\", function(){", + " pm.expect(tv4.validate(jsonData, CSRSSchema)).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"counter_id\": {{qtxn_id}}\n}" + }, + "url": { + "raw": "{{url}}csrs/{{current_csr_id}}/", + "host": [ + "{{url}}csrs" + ], + "path": [ + "{{current_csr_id}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Invite next citizen - should be second one (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "84ff5966-dfec-47d0-ae77-2c5819005fb9", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Should only be inviting one citizen', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 3 (now three periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(3);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Invited\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Invited\");", + " });", + "}", + "", + "// Store the ID of the citizen just invited.", + "postman.setEnvironmentVariable(\"current_client\", JSON.stringify(currentCitizenId));", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/invite/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "invite", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - begin serving (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "caecf715-4ce2-4422-8374-b330c0433f4b", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one citizen being served', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 4 (now four periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(4);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Being Served\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/begin_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "begin_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - finish serving (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "d5890c30-3ce5-4807-9d17-bd58050dab44", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be no active citizen being served', function() {", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Complete\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 4 (still four periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(4);", + " });", + " pm.test('There must be no open periods', function() {", + " pm.expect(openPeriodCount).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/finish_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "finish_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Invite next citizen - should be first one (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "62e7f31d-0bd6-4337-bd70-f6a197063a00", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Should only be inviting one citizen', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 3 (now three periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(3);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Invited\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Invited\");", + " });", + "}", + "", + "// Store the ID of the citizen just invited.", + "postman.setEnvironmentVariable(\"current_client\", JSON.stringify(currentCitizenId));", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/invite/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "invite", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "First citizen - citizen left (QT6)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e502775f-6829-45f8-a225-61c54e625c7f", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test(\"Must be no active citizen being served\", function() {", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test(\"Current citizen comments should be null\", function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.null;", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test(\"Citizen should have one service request\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Complete\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 3 (now three periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(3);", + " });", + " pm.test('There must be no open periods', function() {", + " pm.expect(openPeriodCount).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/citizen_left/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "citizen_left", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Check pick non-qtxn customer (QT7)", + "item": [ + { + "name": "Check no citizens (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c9275086-164f-4f82-884f-75b5710f0b65", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "0aa4fd7b-529c-4f26-9998-c77d6c28eeb4", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var citizenCount = 0;", + "", + "// If citizen property was present.", + "if (allElements !== null) {", + "", + " // Get number of citizens in the queue.", + " citizenCount = allElements.length;", + "}", + "", + "pm.test(\"There should be no citizens in the office\", function() {", + " pm.expect(citizenCount).to.be.eql(0);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "First citizen - Create (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "35c3241b-1fe5-423a-91bd-789ed675e61d", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Perform tests.", + " pm.test(\"Only one citizen should have been created\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Current citizen comments should be null\", function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "", + " // Store the ID of the citizen just created.", + " postman.setEnvironmentVariable(\"first_client\", JSON.stringify(citizenIds.shift()));", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{}" + }, + "url": { + "raw": "{{url}}citizens/0/add_citizen/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "0", + "add_citizen", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "First citizen - Edit QTxn (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "b1833da7-f814-433f-8a11-295e244d9e4f", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"first_client\",\"operator_token\",\"citizen_name_quick\",\"citizen_comment_quick\",\"qtxn_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "1eac614b-0f6c-4b84-8423-de10ffec680f", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", + "", + " // Perform tests.", + " pm.test(\"Must be editing only one citizen\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"citizen_name\" : {{citizen_name_quick}},\n \"citizen_comments\" : {{citizen_comment_quick}},\n \"qt_xn_citizen_ind\" : 1,\n \"counter_id\": {{qtxn_id}}\n}" + }, + "url": { + "raw": "{{url}}citizens/{{first_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{first_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "First citizen - MSP via email (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"service_MSP_id\",\"first_client\",\"citizen_quantity_update\",\"channel_email_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "fa6f6a3b-e4e7-42b6-a8d3-ecda3840418a", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_MSP_id}},\n\t\t\"citizen_id\" : {{first_client}},\n\t\t\"quantity\" : {{citizen_quantity_update}},\n\t\t\"channel_id\" : {{channel_email_id}}\n\t}\n}" + }, + "url": { + "raw": "{{url}}service_requests/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "First citizen - List (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"first_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "f695dc9f-e14f-4e39-8cc0-06d6bff46d1d", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", + "", + " // Perform tests.", + " pm.test('Must be editing only one citizen', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request must have one period', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", + " });", + " pm.test('Service request period channel must be ' + citizenChannel, function() {", + " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", + " });", + " pm.test('Service request period state must be \"Ticket Creation\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{first_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{first_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "First citizen - Add to queue (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"first_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "4ed70849-8f22-4cd0-ab73-582dd012ba60", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be adding only one citizen to the queue', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Pending\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (now two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Waiting\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{first_client}}/add_to_queue/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{first_client}}", + "add_to_queue", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - Create (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "dde23c45-a5d4-4ff0-85a0-bac3873a8574", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Perform tests.", + " pm.test(\"Only one citizen should have been created\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Current citizen comments should be null\", function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "", + " // Store the ID of the citizen just created.", + " postman.setEnvironmentVariable(\"second_client\", JSON.stringify(citizenIds.shift()));", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{}" + }, + "url": { + "raw": "{{url}}citizens/1/add_citizen/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "1", + "add_citizen", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - Edit (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "03647497-dfc2-437d-bace-b6ab2a08fa7b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"second_client\",\"operator_token\",\"citizen_name\",\"citizen_comment\",\"counter_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "9f22638b-3ebc-404e-a43b-fb8af32a2083", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + "", + " // Perform tests.", + " pm.test(\"Should be updating single citizen\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}},\n \"counter_id\": {{counter_id}}\n}" + }, + "url": { + "raw": "{{url}}citizens/{{second_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{second_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - Prop Tax via phone (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"service_PropTax_id\",\"second_client\",\"citizen_quantity\",\"channel_telephone_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "fa6f6a3b-e4e7-42b6-a8d3-ecda3840418a", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{second_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" + }, + "url": { + "raw": "{{url}}service_requests/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - List (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"second_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "dcfc340a-b267-4a1b-8f39-cbedfe02ef76", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", + "", + " // Perform tests.", + " pm.test('Should be updating one citizen', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request must have one period', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", + " });", + " pm.test('Service request period channel must be ' + citizenChannel, function() {", + " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", + " });", + " pm.test('Service request period state must be \"Ticket Creation\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{second_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{second_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - Add to queue (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"second_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "b82e3735-add5-4522-a418-a42931ba84ae", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Should be adding one citizen to the queue', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Pending\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (now two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Waiting\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{second_client}}/add_to_queue/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{second_client}}", + "add_to_queue", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Check 2 citizens in queue (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "070b3e97-88a9-4e82-ae4e-cf476625b4b9", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "09e9a82d-d782-4916-b84d-970d41f0e231", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var citizenCount = 0;", + "", + "// If citizen property was present.", + "if (allElements !== null) {", + "", + " // Get number of citizens in the queue.", + " citizenCount = allElements.length;", + "}", + "", + "pm.test('Must be two active citizens in the office', function() {", + " pm.expect(citizenCount).to.be.eql(2);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Set CSR to Counter (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "070b3e97-88a9-4e82-ae4e-cf476625b4b9", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_csr_id\",\"operator_token\",\"counter_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "09e9a82d-d782-4916-b84d-970d41f0e231", + "exec": [ + "// Define the JSON Schema expected in response", + "var CSRSSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"csr_id\": {\"type\": \"number\"},", + " \"csr_state\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"csr_state_desc\": {\"type\": \"string\"},", + " \"csr_state_id\": {\"type\": \"number\"},", + " \"csr_state_name\": {\"type\": \"string\"}", + " },", + " \"required\": [\"csr_state_desc\", \"csr_state_id\", \"csr_state_name\"]", + " },", + " \"csr_state_id\": {\"type\": \"number\"},", + " \"deleted\": {},", + " \"finance_designate\": {\"type\": \"number\"},", + " \"office_manager\": {\"type\": \"number\"},", + " \"ita2_designate\": {\"type\": \"number\"},", + " \"office\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"appointments_enabled_ind\": {\"type\": \"number\"},", + " \"exams_enabled_ind\": {\"type\": \"number\"},", + " \"office_id\": {\"type\": \"number\"},", + " \"office_name\": {\"type\": \"string\"},", + " \"office_number\": {\"type\": \"number\"},", + " \"sb\":{", + " \"type\": \"object\",", + " \"properties\": {", + " \"sb_id\": {\"type\": \"number\"},", + " \"sb_type\": {\"type\": \"string\"}", + " },", + " \"required\": [\"sb_id\", \"sb_type\"]", + " }", + " },", + " \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"sb\"]", + " },", + " \"pesticide_designate\": {\"type\": \"number\"},", + " \"qt_xn_csr_ind\": {\"type\": \"number\"},", + " \"receptionist_ind\": {\"type\": \"number\"},", + " \"role\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"role_code\": {\"type\": \"string\"},", + " \"role_desc\": {\"type\": \"string\"},", + " \"role_id\": {\"type\": \"number\"}", + " },", + " \"required\": [\"role_code\", \"role_desc\", \"role_id\"]", + " },", + " \"role_id\": {\"type\": \"number\"},", + " \"username\": {\"type\": \"string\"}", + " },", + " \"required\": [\"csr\"]", + "};", + "", + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate Response CSRs Schema\", function(){", + " pm.expect(tv4.validate(jsonData, CSRSSchema)).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"counter_id\": {{counter_id}}\n}" + }, + "url": { + "raw": "{{url}}csrs/{{current_csr_id}}/", + "host": [ + "{{url}}csrs" + ], + "path": [ + "{{current_csr_id}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Invite next citizen - should be second one (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "cfcc38e7-765f-48aa-8600-159bbeda4994", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Should only be inviting one citizen', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 3 (now three periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(3);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Invited\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Invited\");", + " });", + "}", + "", + "// Store the ID of the citizen just invited.", + "postman.setEnvironmentVariable(\"current_client\", JSON.stringify(currentCitizenId));", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/invite/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "invite", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - begin serving (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "0ceb5800-311b-4b82-9278-80e3296843ba", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one citizen being served', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 4 (now four periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(4);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Being Served\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/begin_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "begin_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Second citizen - finish serving (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "ec44532d-3f42-41f4-8faa-7803c188970f", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"second_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be no active citizen being served', function() {", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Complete\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 4 (still four periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(4);", + " });", + " pm.test('There must be no open periods', function() {", + " pm.expect(openPeriodCount).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/finish_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "finish_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Invite next citizen - should be first one (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "a4812ded-5043-426a-b837-91ac5f06ba62", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Should only be inviting one citizen', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 3 (now three periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(3);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Invited\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Invited\");", + " });", + "}", + "", + "// Store the ID of the citizen just invited.", + "postman.setEnvironmentVariable(\"current_client\", JSON.stringify(currentCitizenId));", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/invite/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "invite", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "First citizen - citizen left (QT7)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "14a22c20-3902-4ca1-9e56-e97dde7b212b", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name_quick\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment_quick\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_email_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"first_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test(\"Must be no active citizen being served\", function() {", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test(\"Current citizen comments should be null\", function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.null;", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test(\"Citizen should have one service request\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Complete\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 3 (now three periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(3);", + " });", + " pm.test('There must be no open periods', function() {", + " pm.expect(openPeriodCount).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/citizen_left/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "citizen_left", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Setup Booking", + "item": [ + { + "name": "Setup-Variables", + "event": [ + { + "listen": "test", + "script": { + "id": "5409b66d-67a4-449b-8633-9aeca632b388", + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "e9eed831-7955-4218-a400-ae6e1e7e2e10", + "exec": [ + "// See if the use-prefix global has been set. Use default if not.", + "let usePrefix = '';", + "if (pm.globals.get('use-prefix')) {", + " console.log(\"==> use-prefix exists\");", + " usePrefix = pm.globals.get('use-prefix');", + " console.log(\" --> Prefix is: \" + usePrefix);", + " ", + " // Set up all globals, using the correct prefix.", + " pm.globals.set('auth_url', pm.globals.get(usePrefix + 'auth_url'));", + " pm.globals.set('realm', pm.globals.get(usePrefix + 'realm'));", + " pm.globals.set('clientid', pm.globals.get(usePrefix + 'clientid'));", + " pm.globals.set('client_secret', pm.globals.get(usePrefix + 'client_secret'));", + " pm.globals.set('url', pm.globals.get(usePrefix + 'url'));", + "}", + "else {", + " console.log(\"==> use-prefix does not exist\");", + " console.log(\" --> No default globals set.\");", + "}", + "", + "// If no maximum load time defined, set a default.", + "if (!pm.globals.get('max_load_time')) {", + " console.log(\"==> max_load_time not present, default set.\");", + " pm.globals.set(\"max_load_time\", JSON.stringify(1503));", + "}", + "", + "// If no maximum response defined, set a default.", + "if (!pm.globals.get('max_response_time')) {", + " console.log(\"==> max_response_time not present, default set.\");", + " pm.globals.set(\"max_response_time\", JSON.stringify(15005));", + "}", + "", + "// Display the values of all globals.", + "console.log(\"\");", + "console.log(\"==> Globals are:\");", + "console.log(\" --> auth_url: \" + pm.globals.get(\"auth_url\"));", + "console.log(\" --> realm: \" + pm.globals.get(\"realm\"));", + "console.log(\" --> clientid: \" + pm.globals.get(\"clientid\"));", + "console.log(\" --> client_secret: \" + pm.globals.get(\"client_secret\"));", + "console.log(\" --> url: \" + pm.globals.get(\"url\"));", + "console.log(\" --> max_load_time: \" + pm.globals.get(\"max_load_time\"));", + "console.log(\" --> max_response_time: \" + pm.globals.get(\"max_response_time\"));", + "", + "", + "// Clear run-scoped variables so reruns do not inherit stale state.", + "pm.globals.unset(\"auth_failure_reason\");", + "pm.globals.unset(\"operator_token\");", + "pm.globals.unset(\"operator_refresh_token\");", + "pm.globals.unset(\"nonqtxn_token\");", + "pm.globals.unset(\"nonqtxn_refresh_token\");", + "pm.globals.unset(\"public_user_token\");", + "pm.globals.unset(\"public_user_refresh_token\");", + "pm.globals.unset(\"token\");", + "pm.globals.unset(\"refresh_token\");", + "pm.globals.unset(\"token_expires\");", + "pm.globals.unset(\"refresh_token_expires\");", + "pm.globals.unset(\"expires_in\");", + "pm.globals.unset(\"refresh_expires_in\");", + "pm.environment.unset(\"current_client\");", + "pm.environment.unset(\"first_sr_id\");", + "pm.environment.unset(\"second_sr_id\");", + "pm.environment.unset(\"current_csr_id\");", + "pm.environment.unset(\"current_office_id\");", + "pm.environment.unset(\"current_office_number\");", + "pm.environment.unset(\"counter_id\");", + "pm.environment.unset(\"qtxn_id\");", + "pm.environment.unset(\"channel_telephone_id\");", + "pm.environment.unset(\"channel_email_id\");", + "pm.environment.unset(\"service_PropTax_id\");", + "pm.environment.unset(\"service_MSP_id\");", + "pm.environment.unset(\"user_id\");", + "pm.environment.unset(\"user_phone\");", + "pm.environment.unset(\"appointment_id\");", + "pm.environment.unset(\"public_office_id\");", + "pm.environment.unset(\"public_office_timezone\");", + "pm.environment.unset(\"public_service_id\");" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Dummy data." + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "Authentication Token", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"auth_url\",\"realm\",\"clientid\",\"userid\",\"password\",\"client_secret\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "454ea7d6-4c7e-4571-8bc1-be7eed57d03a", + "exec": [ + "// Parse response body", + "var jsonData = {};", + "try {", + " jsonData = JSON.parse(responseBody);", + "} catch (parseErr) {", + " console.log(\"Authentication response body was not JSON.\");", + " console.log(responseBody);", + " pm.globals.set(\"auth_failure_reason\", \"Non-JSON auth response\");", + " pm.execution.setNextRequest(null);", + " throw parseErr;", + "}", + "", + "var authFailureReason = jsonData.error_description || jsonData.error || (\"HTTP \" + pm.response.code);", + "if (pm.response.code !== 200 || !jsonData.access_token) {", + " console.log(\"Authentication failed for \" + pm.info.requestName + \".\");", + " console.log(responseBody);", + " pm.globals.set(\"auth_failure_reason\", authFailureReason);", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Authentication failed: \" + authFailureReason);", + "}", + "", + "pm.test(\"Response code for request is 200\", function(){", + " pm.expect(pm.response.code).to.eql(200);", + "});", + "pm.test(\"Access token exists\", function(){", + " pm.expect(jsonData).to.have.property(\"access_token\");", + " pm.expect(jsonData.access_token).to.be.a(\"string\").and.not.empty;", + "});", + "pm.test(\"Refresh token exists\", function(){", + " pm.expect(jsonData).to.have.property(\"refresh_token\");", + " pm.expect(jsonData.refresh_token).to.be.a(\"string\").and.not.empty;", + "});", + "pm.test(\"Expires In is present\", function(){", + " pm.expect(jsonData).to.have.property(\"expires_in\");", + " pm.expect(jsonData.expires_in).to.not.eql(null);", + "});", + "pm.test(\"Refresh Expires In is present\", function(){", + " pm.expect(jsonData).to.have.property(\"refresh_expires_in\");", + " pm.expect(jsonData.refresh_expires_in).to.not.eql(null);", + "});", + "", + "pm.globals.unset(\"auth_failure_reason\");", + "pm.globals.set(\"operator_token\", jsonData.access_token);", + "pm.globals.set(\"operator_refresh_token\", jsonData.refresh_token);", + "pm.globals.set(\"token_expires\", Date.now() + (jsonData.expires_in * 1000));", + "pm.globals.set(\"refresh_token_expires\", Date.now() + (jsonData.refresh_expires_in * 1000));", + "pm.globals.set(\"expires_in\", jsonData.expires_in);", + "pm.globals.set(\"refresh_expires_in\", jsonData.refresh_expires_in);", + "pm.globals.set(\"token\", jsonData.access_token);", + "pm.globals.set(\"refresh_token\", jsonData.refresh_token);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/x-www-form-urlencoded", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "grant_type=password&client_id={{clientid}}&username={{userid}}&password={{password}}&client_secret={{client_secret}}" + }, + "url": { + "raw": "{{auth_url}}/auth/realms/{{realm}}/protocol/openid-connect/token?Content-Type=application/x-www-form-urlencoded", + "host": [ + "{{auth_url}}" + ], + "path": [ + "auth", + "realms", + "{{realm}}", + "protocol", + "openid-connect", + "token" + ], + "query": [ + { + "key": "Content-Type", + "value": "application/x-www-form-urlencoded" + } + ] + } + }, + "response": [] + }, + { + "name": "CFMS-Install-Basic-Response-Tests", + "event": [ + { + "listen": "test", + "script": { + "id": "a0d8e240-3b40-4654-a32b-bf2e676fdeb9", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"basic_response_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Get the maximum response time allowed.\nmax_response_time = JSON.parse(globals.max_response_time);\n\npm.test('Response time less than ' + max_response_time.toString() + 'ms', function(){\n pm.expect(pm.response.responseTime).to.be.below(max_response_time);\n});\n\nvar contentType = pm.response.headers.get(\"content-type\") || \"\";\n\npm.test(\"Response code for request is 200\", function(){\n pm.expect(pm.response.code).to.eql(200);\n});\npm.test(\"Response header should include Content-Type application/json\", function() {\n pm.expect(contentType.toLowerCase()).to.include(\"application/json\");\n});\npm.test(\"Response body should be valid JSON\", function() {\n pm.expect(function () { pm.response.json(); }).to.not.throw();\n});\n\nif (pm.response.code !== 200) {\n console.log(\"Unexpected status for \" + pm.info.requestName + \": \" + pm.response.code);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected HTTP 200 but received \" + pm.response.code);\n}\n\nif (contentType.toLowerCase().indexOf(\"application/json\") === -1) {\n console.log(\"Unexpected content-type for \" + pm.info.requestName + \": \" + contentType);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected application/json response\");\n}\n\ntry {\n pm.response.json();\n} catch (parseErr) {\n console.log(\"Response body was not valid JSON for \" + pm.info.requestName + \".\");\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw parseErr;\n}" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Exam-Type-Data", + "event": [ + { + "listen": "test", + "script": { + "id": "382b7b65-d736-4a03-a44a-3891f33b617d", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"init_exam_type_data\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Finds an exam name in the JSON list allTypes of exam types.\nfunction find_exam(input_exam_name, allTypes) {\n\texam_id_value = -1;\n\n // Loop to look for the input exam name.\n if (allTypes) {\n allTypes.forEach(function(type) {\n if ((type.exam_type_name) == input_exam_name) {\n exam_id_value = type.exam_type_id;\n }\n });\n }\n \n // If the exam wasn't found, set it to be the first exam.\n if (exam_id_value == -1) {\n exam_id_value = allTypes[0].exam_type_id;\n }\n\n // Return the exam_id_type of the input exam name.\n return exam_id_value;\n}\n\n// Get the list of all possible exam types.\nallTypes = null;\nvar jsonData = JSON.parse(responseBody);\nif (jsonData.hasOwnProperty(\"exam_types\")) {\n\tallTypes = jsonData.exam_types;\n}\n\nexam_array = [];\nexam_array.push({name: \"Pesticide\", weight: 40.2, id: find_exam(\"Pesticide\", allTypes)});\nname = \"IPSE - 4HR Single Exam\";\nexam_array.push({name: name, weight: exam_array[0].weight + 14.5, id: find_exam(name, allTypes)});\nname = \"SLE - 3HR Group Exam\";\nexam_array.push({name: name, weight: exam_array[1].weight + 7.4, id: find_exam(name, allTypes)});\nname = \"COFQ - 3HR Group Exam\";\nexam_array.push({name: name, weight: exam_array[2].weight + 5.8, id: find_exam(name, allTypes)});\nname = \"IPSE - 4HR Group Exam\";\nexam_array.push({name: name, weight: exam_array[3].weight + 5.7, id: find_exam(name, allTypes)});\nname = \"COFQ - 3HR Single Exam\";\nexam_array.push({name: name, weight: exam_array[4].weight + 5.5, id: find_exam(name, allTypes)});\nname = \"Monthly Session Exam\";\nexam_array.push({name: name, weight: exam_array[5].weight + 3.8, id: find_exam(name, allTypes)});\nname = \"SLE - 3HR Single Exam\";\nexam_array.push({name: name, weight: exam_array[6].weight + 3.5, id: find_exam(name, allTypes)});\nname = \"Angling Guide Outfitter\";\nexam_array.push({name: name, weight: exam_array[7].weight + 2.4, id: find_exam(name, allTypes)});\nname = \"IPSE - 5HR Single Exam - Time Extension\";\nexam_array.push({name: name, weight: exam_array[8].weight + 2.3, id: find_exam(name, allTypes)});\nname = \"Exam Booking - 3 Hour Miscellaneous\";\nexam_array.push({name: name, weight: exam_array[9].weight + 1.7, id: find_exam(name, allTypes)});\n\n// Store the initialized exam data for later use.\npostman.setEnvironmentVariable(\"exam_array_data\", JSON.stringify(exam_array));" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Exam-Get-Random", + "event": [ + { + "listen": "test", + "script": { + "id": "382b7b65-d736-4a03-a44a-3891f33b617d", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"create_random_functions\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Function returns a weighted randomized exam type index.\nfunction get_random_index(exam_array) {\n\n // Generate a random number up to the maximum weight allowed.\n random_number = Math.floor(Math.random() * exam_array[exam_array.length - 1].weight);\n \n // Get the index of the exam type corresponding to that weight.\n index = get_index(random_number, exam_array);\n\n // Return the index.\n return index;\n}\n\n// Based on a random number, turns it into a weighted randomized exam type index.\nfunction get_index(random_value, exam_array) {\n index = 0;\n var i;\n for (i = 0; i < exam_array.length; i++) {\n if (random_value <= exam_array[i].weight) {\n index = i;\n break;\n }\n }\n \n return index;\n}\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Exam-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "id": "8cebcf78-f5a2-4694-b108-60e146791a78", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"exam_schema_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the JSON Schema expected in response\nvar examSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"exam\": {\n \"type\": \"object\",\n \"properties\": {\n \"booking_id\": {},\n \"deleted_date\": {},\n \"event_id\": {\"type\": \"string\"},\n \"exam_id\": {\"type\": \"number\"},\n \"exam_method\": {\"type\": \"string\"},\n \"exam_name\": {\"type\": \"string\"},\n \"exam_received_date\": {},\n \"exam_returned_tracking_number\": {},\n \"exam_type\": {\n \"type\": \"object\",\n \"properties\": {\n \"exam_color\": {\"type\": \"string\"},\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_type_name\": {\"type\": \"string\"},\n \"group_exam_ind\": {\"type\": \"number\"},\n \"ita_ind\": {\"type\": \"number\"},\n \"method_type\": {\"type\": \"string\"},\n \"number_of_hours\": {\"type\": \"number\"},\n \"number_of_minutes\": {\"type\": [\"number\", \"null\"]},\n \"pesticide_exam_ind\": {\"type\": \"number\" }\n },\n \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"group_exam_ind\", \"ita_ind\", \"method_type\", \"number_of_hours\", \"number_of_minutes\", \"pesticide_exam_ind\"]\n },\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_written_ind\": {\"type\": \"number\"},\n \"examinee_name\": {\"type\": \"string\"},\n \"expiry_date\": {\"type\": [\"string\", \"null\"]},\n \"notes\": {\"type\": \"string\"},\n \"number_of_students\": {\"type\": \"number\"},\n \"office\":{\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\" },\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\" : \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n },\n },\n \"required\": []\n },\n \"office_id\": {\"type\": \"number\"},\n \"offsite_location\": {},\n \"session_number\": {\"type\": [\"number\", \"null\"]},\n \"booking\": {}\n },\n \"required\": [\"booking\", \"booking_id\", \"deleted_date\", \"event_id\", \"exam_id\", \"exam_method\", \"exam_name\", \"exam_received_date\", \"exam_returned_tracking_number\", \"exam_type\", \"exam_type_id\", \"exam_written_ind\", \"examinee_name\", \"expiry_date\", \"notes\", \"number_of_students\", \"office\", \"office_id\", \"offsite_location\", \"session_number\"]\n }\n },\n \"required\": [\"exam\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Exam Schema\", function(){\n pm.expect(tv4.validate(jsonData, examSchema)).to.be.true;\n});\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Exam-Data-Check", + "event": [ + { + "listen": "test", + "script": { + "id": "8cebcf78-f5a2-4694-b108-60e146791a78", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"exam_data_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Make sure that jsonData has an exam property.\npm.test(\"Response should have exam property\", function(){\n pm.expect(jsonData.hasOwnProperty(\"exam\")).to.be.true;\n});\n\n// If jsonData has exam property, check data.\nif (jsonData.hasOwnProperty(\"exam\")) {\n\n //Test to see if Event ID field remains unchanged\n pm.test(\"Validate Event Id has expected value\", function(){\n pm.expect(jsonData.event_id === environment.event_id);\n });\n\n //Test to see if exam method field remains unchanged\n pm.test(\"Validate exam method has expected value\", function(){\n pm.expect(jsonData.exam_method === environment.exam_method);\n });\n\n //Test to see if exam name field remains unchanged\n pm.test(\"Validate exam name has expected value\", function(){\n pm.expect(jsonData.exam_name === environment.exam_name);\n });\n\n //Test to see if exam type field remains unchanged\n pm.test(\"Validate exam type id has expected value\", function(){\n pm.expect(jsonData.exam_type_id === environment.random_exam_type_id);\n });\n\n //Test to see if exam written indicator field remains unchanged\n pm.test(\"Validate exam written indicator has expected value\", function(){\n pm.expect(jsonData.exam_written_ind === environment.exam_written_ind);\n });\n\n //Test to see if examinee name field remains unchanged\n pm.test(\"Validate examinee name has expected value\", function(){\n pm.expect(jsonData.examinee_name === environment.examinee_name);\n });\n\n //Test to see if notes field remains unchanged\n pm.test(\"Validate notes has expected value\", function(){\n pm.expect(jsonData.notes === environment.notes);\n });\n\n //Test to see if number of students field remains unchanged\n pm.test(\"Validate number of students has expected value\", function(){\n pm.expect(jsonData.number_of_students === environment.number_of_students);\n });\n\n //Test to see if office id remains unchanged\n pm.test(\"Validate office id has expected value\", function(){\n pm.expect(jsonData.office_id === environment.current_office_id);\n });\n\n //Test to see if offsite location is expected\n pm.test(\"Validate offsite location has expected value\", function(){\n pm.expect(jsonData.offsite_location === environment.offsite_location);\n });\n}\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Exam-List-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "id": "8cebcf78-f5a2-4694-b108-60e146791a78", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"exam_schema_list_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the JSON Schema expected in response\nvar examSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"exams\": {\n \"type\": \"array\",\n \"properties\": {\n \"booking_id\": {},\n \"deleted_date\": {},\n \"event_id\": {\"type\": \"string\"},\n \"exam_id\": {\"type\": \"number\"},\n \"exam_method\": {\"type\": \"string\"},\n \"exam_name\": {\"type\": \"string\"},\n \"exam_received_date\": {},\n \"exam_returned_tracking_number\": {},\n \"exam_type\": {\n \"type\": \"object\",\n \"properties\": {\n \"exam_color\": {\"type\": \"string\"},\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_type_name\": {\"type\": \"string\"},\n \"group_exam_ind\": {\"type\": \"number\"},\n \"ita_ind\": {\"type\": \"number\"},\n \"method_type\": {\"type\": \"string\"},\n \"number_of_hours\": {\"type\": \"number\"},\n \"number_of_minutes\": {\"type\": \"number\"},\n \"pesticide_exam_ind\": {\"type\": \"number\" }\n },\n \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"group_exam_ind\", \"ita_ind\", \"method_type\", \"number_of_hours\", \"number_of_minutes\", \"pesticide_exam_ind\"]\n },\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_written_ind\": {\"type\": \"number\"},\n \"examinee_name\": {\"type\": \"string\"},\n \"expiry_date\": {\"type\": [\"string\", \"null\"]},\n \"notes\": {\"type\": \"string\"},\n \"number_of_students\": {\"type\": \"number\"},\n \"office\":{\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\" },\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\" : \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n },\n },\n \"required\": []\n },\n \"office_id\": {\"type\": \"number\"},\n \"offsite_location\": {},\n \"session_number\": {\"type\": [\"number\", \"null\"]},\n \"booking\": {}\n },\n \"required\": [\"booking\", \"booking_id\", \"deleted_date\", \"event_id\", \"exam_id\", \"exam_method\", \"exam_name\", \"exam_received_date\", \"exam_returned_tracking_number\", \"exam_type\", \"exam_type_id\", \"exam_written_ind\", \"examinee_name\", \"expiry_date\", \"notes\", \"number_of_students\", \"office\", \"office_id\", \"offsite_location\", \"session_number\"]\n }\n },\n \"required\": [\"exams\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Exam List Schema\", function(){\n pm.expect(tv4.validate(jsonData, examSchema)).to.be.true;\n});\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Booking-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "id": "8cebcf78-f5a2-4694-b108-60e146791a78", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"booking_schema_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the JSON Schema expected in response\nvar bookingSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"booking\": {\n \"type\": \"object\",\n \"properties\": {\n \"blackout_flag\": {\"type\": \"string\"},\n \"blackout_notes\": {\"type\": [\"string\", \"null\"]},\n \"booking_contact_information\": {\"type\": [\"string\", \"null\"]},\n \"booking_id\": {\"type\": \"number\"},\n \"booking_name\": {\"type\": [\"string\", \"null\"]},\n \"end_time\": {\"type\": \"string\"},\n \"fees\": {\"type\": \"string\"},\n \"invigilators\": {\"type\": \"array\"},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"timezone\": {}\n },\n \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"timezone\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"recurring_uuid\": {\"type\": [\"string\", \"null\"]},\n \"room\": {\n \"type\": \"object\",\n \"properties\": {\n \"capacity\": {\"type\": \"number\"},\n \"color\": {\"type\": \"string\"},\n \"deleted\": {\"type\": [\"string\", \"null\"]},\n \"room_id\": {\"type\": \"number\"},\n \"room_name\": {\"type\": \"string\"}\n },\n \"required\": [\"capacity\", \"color\", \"room_id\", \"room_name\", \"deleted\"]\n },\n \n \"room_id\": {\"type\": \"number\"},\n \"sbc_staff_invigilated\": {\"type\": \"number\"},\n \"shadow_invigilator_id\": {\"type\": [\"number\", \"null\"]},\n \"start_time\": {\"type\": \"string\"}\n },\n \"required\": [\"blackout_flag\", \"blackout_notes\", \"booking_contact_information\", \"booking_id\",\n \"booking_name\", \"end_time\", \"fees\", \"invigilators\", \"office\", \"office_id\",\n \"recurring_uuid\", \"room\", \"room_id\", \"sbc_staff_invigilated\", \"shadow_invigilator_id\",\n \"start_time\"]\n },\n \"errors\": { \"type\": \"object\" }\n },\n \"required\": [\"booking\", \"errors\"]\n}\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Booking Schema\", function(){\n pm.expect(tv4.validate(jsonData, bookingSchema)).to.be.true;\n});\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Booking-Data-Check", + "event": [ + { + "listen": "test", + "script": { + "id": "8cebcf78-f5a2-4694-b108-60e146791a78", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"booking_data_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Make sure that jsonData has an booking property.\npm.test(\"Response should have booking property\", function(){\n pm.expect(jsonData.hasOwnProperty(\"booking\")).to.be.true;\n});\n\n// If jsonData has booking property, check data.\nif (jsonData.hasOwnProperty(\"booking\")) {\n\n //Test to see if booking name has expected value\n pm.test(\"Validate Booking Name has expected value\", function(){\n pm.expect(jsonData.booking_name === environment.booking_name);\n });\n\n //Test to see if start time has expected value\n pm.test(\"Validate start time has expected value\", function(){\n pm.expect(jsonData.start_time === environment.start_time);\n });\n\n //Test to see if end time has expected value\n pm.test(\"Validate end time has expected value\", function(){\n pm.expect(jsonData.end_time === environment.end_time);\n });\n\n //Test to see if room id has expected value\n pm.test(\"Validate room id has expected value\", function(){\n pm.expect(jsonData.room_id === environment.room_id_1);\n });\n\n //Test to see if fees field has expected value\n pm.test(\"Validate fees has expected value\", function(){\n pm.expect(jsonData.fees === environment.fees);\n });\n\n //Test to see if office id field has expected value\n pm.test(\"Validate office id has expected value\", function(){\n pm.expect(jsonData.office_id === environment.current_office_id);\n });\n}\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Booking-List-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "id": "8cebcf78-f5a2-4694-b108-60e146791a78", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"booking_list_schema_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "var bookingSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"bookings\": {\n \"type\": \"array\",\n \"properties\": {\n \"booking_contact_information\": {},\n \"booking_id\": {\"type\": \"number\"},\n \"booking_name\": {\"type\": \"string\"},\n \"end_time\": {\"type\": \"string\"},\n \"fees\": {\"type\": \"string\"},\n \"invigilator\": {},\n \"invigilator_id\": {},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"sb_id\": {\"type\": \"number\"},\n \"timezone\": {}\n },\n \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"sb\", \"sb_id\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"room\": {\n \"type\": \"object\",\n \"properties\": {\n \"capacity\": {\"type\": \"number\"},\n \"color\": {\"type\": \"string\"},\n \"room_id\": {\"type\": \"number\"},\n \"room_name\": {\"type\": \"string\"}\n },\n \"required\": [\"capacity\", \"color\", \"room_id\", \"room_name\"]\n },\n \"room_id\": {\"type\": \"number\"},\n \"start_time\": {\"type\": \"string\"},\n },\n \"required\": [\"booking_contact_information\", \"booking_id\", \"booking_name\", \"end_time\", \"fees\", \"room\", \"room_id\", \"start_time\", \"invigilator_id\", \"office\", \"office_id\"]\n },\n \"errors\": {\n \"type\": \"object\",\n \"properties\": {}\n }\n },\n \"required\": [\"bookings\", \"errors\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Booking List Schema\", function(){\n pm.expect(tv4.validate(jsonData, bookingSchema)).to.be.true;\n});" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Appointment-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"appointment_schema_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the JSON Schema expected in response\nvar appointmentSchema = {\n \"type\": \"object\", \n \"properties\": {\n \"appointment\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointment_id\": {\"type\": \"number\"},\n \"checked_in_time\": {\"type\": [\"string\", \"null\"]},\n \"citizen_name\": {\"type\": \"string\"},\n \"comments\": {\"type\": \"string\"},\n \"contact_information\": {\"type\": [\"string\", \"null\"]},\n \"end_time\": {\"type\": \"string\"},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\": \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n },\n },\n \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"timezone\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"service_id\": {\"type\": [\"null\", \"number\"]},\n \"start_time\": {\"type\": \"string\"},\n \"blackout_flag\": {\"type\": \"string\"},\n \"citizen_id\": {\"type\": \"number\"},\n \"online_flag\": {\"type\": \"boolean\"},\n \"recurring_uuid\": {\"type\": [\"null\", \"string\"]},\n \"services\": {\n \"type\": \"object\",\n \"properties\": {\n \"deleted\": {\"type\": [\"null\", \"string\"]},\n \"display_dashboard_ind\": {\"type\": \"number\"},\n \"timeslot_duration\": {\"type\": [\"null\", \"number\"]},\n \"parent\": {\n \"type\": \"object\",\n \"properties\": {\n \"service_name\": {\"type\": \"string\"}\n },\n \"required\": [\"service_name\"]\n },\n \"service_name\": {\"type\": \"string\"},\n \"service_code\": {\"type\": \"string\"},\n \"actual_service_ind\": {\"type\": \"number\"},\n \"online_link\": {\"type\": [\"null\", \"string\"]},\n \"service_desc\": {\"type\": \"string\"},\n \"service_id\": {\"type\": \"number\"},\n \"parent_id\": {\"type\": \"number\"},\n \"prefix\": {\"type\": \"string\"},\n \"online_availability\": {\"type\": [\"null\", \"string\"]},\n \"external_service_name\": {\"type\": [\"null\", \"string\"]}\n },\n \"required\": [\"deleted\", \"display_dashboard_ind\", \"timeslot_duration\", \"parent\",\n \"service_name\", \"service_code\", \"actual_service_ind\", \"online_link\",\n \"service_desc\", \"service_id\", \"parent_id\", \"prefix\", \"online_availability\",\n \"external_service_name\"]\n }\n },\n \"required\": [\"appointment_id\", \"checked_in_time\", \"citizen_name\", \"comments\",\n \"contact_information\", \"end_time\", \"office\", \"office_id\", \"service_id\",\n \"start_time\", \"blackout_flag\", \"citizen_id\", \"online_flag\",\n \"recurring_uuid\", \"service\"],\n },\n \"errors\": {\"type\": [\"object\", \"string\"]}\n },\n \"required\": [\"appointment\", \"errors\"],\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Appointments Schema\", function(){\n pm.expect(tv4.validate(jsonData, appointmentSchema)).to.be.true;\n});\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Appointment-Data-Check", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"appointment_data_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Make sure that jsonData has an appointment property.\npm.test(\"Response should have appointment property\", function(){\n pm.expect(jsonData.hasOwnProperty(\"appointment\")).to.be.true;\n});\n\nvar name = jsonData.appointment.citizen_name;\nvar comments = jsonData.appointment.comments;\nvar contact = jsonData.appointment.contact_information;\nvar name_expect = JSON.parse(pm.globals.get(\"appt_citizen_name\"));\nvar comments_expect = JSON.parse(pm.globals.get(\"appt_comments\"));\nvar contact_expect = JSON.parse(pm.globals.get(\"appt_contact_information\"));\n\n// If jsonData has booking property, check data.\nif (jsonData.hasOwnProperty(\"appointment\")) {\n\n //Test to see if service id has expected value\n pm.test(\"Validate Service ID has expected value\", function(){\n pm.expect(jsonData.service_id === environment.service_id);\n });\n\n //Test to see if office id has expected value\n pm.test(\"Validate office id has expected value\", function(){\n pm.expect(jsonData.office_id === environment.current_office_id);\n });\n\n //Test to see if start time has expected value\n pm.test(\"Validate start time has expected value\", function(){\n pm.expect(jsonData.start_time === environment.start_time);\n });\n\n //Test to see if end time has expected value\n pm.test(\"Validate end time has expected value\", function(){\n pm.expect(jsonData.end_time === environment.end_time);\n });\n\n //Test to see if category has expected value\n pm.test(\"Validate category has expected value\", function(){\n pm.expect(jsonData.category === environment.category);\n });\n\n //Test to see if citizen name field has expected value\n pm.test(\"Name should be '\" + name_expect + \"', it is '\" + name + \"'\", function(){\n pm.expect(name).to.be.eql(name_expect);\n });\n //Test to see if comments field has expected value\n pm.test(\"Comments should be '\" + comments_expect + \"'; it is '\" + comments +\"'\", function(){\n pm.expect(comments).to.be.eql(comments_expect);\n });\n //Test to see if contact info field has expected value\n pm.test(\"Contact should be '\" + contact_expect + \"'; it is '\" + contact +\"'\", function(){\n pm.expect(contact).to.be.eql(contact_expect);\n });\n};\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Appointment-List-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "id": "8cebcf78-f5a2-4694-b108-60e146791a78", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"appointment_list_schema_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the JSON Schema expected in response\nvar appointmentSchema = {\n \"type\": \"object\", \n \"properties\": {\n \"appointments\": {\n \"type\": \"array\",\n \"properties\": {\n \"appointment_id\": {\"type\": \"number\"},\n \"checked_in_time\": {\"type\": [\"string\", \"null\"]},\n \"citizen_name\": {\"type\": \"string\"},\n \"comments\": {\"type\": \"string\"},\n \"contact_information\": {},\n \"end_time\": {\"type\": \"string\"},\n \"office\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"service_id\": {\"type\": \"number\"},\n \"start_time\": {\"type\": \"string\"},\n \n },\n \"required\": [\"appointment_id\", \"checked_in_time\", \"citizen_name\", \"comments\", \"contact_information\", \"end_time\", \"office\", \"office_id\", \"service_id\", \"start_time\"],\n \"errors\": {}\n }\n },\n \"required\": [\"appointments\"],\n \"errors\": {}\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Appointment List Schema\", function(){\n pm.expect(tv4.validate(jsonData, appointmentSchema)).to.be.true;\n});\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "Who am I TheQ", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "if (jsonData.hasOwnProperty(\"csr\")) {", + "\tcurrentOfficeId = jsonData.csr.office_id;", + "\tcurrentOfficeNumber = jsonData.csr.office.office_number;", + "\tcurrentCsrId = jsonData.csr.csr_id;", + " postman.setEnvironmentVariable(\"current_office_id\", currentOfficeId);", + " postman.setEnvironmentVariable(\"current_office_number\", currentOfficeNumber);", + " postman.setEnvironmentVariable(\"current_csr_id\", currentCsrId);", + "};", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}csrs/me/", + "host": [ + "{{url}}csrs" + ], + "path": [ + "me", + "" + ] + } + }, + "response": [] + }, + { + "name": "Get Room IDs", + "event": [ + { + "listen": "test", + "script": { + "id": "859ae114-22c4-4f3e-9f1f-9f0e06fbc29d", + "exec": [ + "// Define the JSON Schema expected in response", + "var roomSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"rooms\": {", + " \"type\": \"array\",", + " \"properties\": {", + " \"capacity\": {\"type\": \"number\"},", + " \"color\": {\"type\": \"string\"},", + " \"office\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"office_id\": {\"type\": \"number\"},", + " \"office_name\": {\"type\": \"string\"},", + " \"office_number\": {\"type\": \"number\"},", + " \"sb\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"sb_id\": {\"type\": \"number\"},", + " \"sb_type\": {\"type\": \"string\"}", + " },", + " \"required\": [\"sb_id\", \"sb_type\"]", + " },", + " \"sb_id\": {\"type\": \"number\"} ", + " },", + " \"required\": [\"office_id\", \"office_name\", \"office_number\", \"sb\", \"sb_id\"]", + " }", + " },", + " \"required\": [\"capacity\", \"color\", \"office\", \"room_id\", \"room_name\"]", + " }", + " }", + "};", + "", + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Get the max response time allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "", + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate Response Room Schema\", function(){", + " pm.expect(tv4.validate(jsonData, roomSchema)).to.be.true;", + "});", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "if (jsonData.hasOwnProperty(\"rooms\")) {", + " console.log(\"==> Rooms\");", + " room_id_1 = jsonData.rooms[0].room_id;", + " room_id_2 = room_id_1;", + " if (jsonData.rooms.length > 1) {", + " room_id_2 = jsonData.rooms[1].room_id;", + " }", + " postman.setEnvironmentVariable(\"room_id_1\", JSON.stringify(room_id_1.toString()));", + " postman.setEnvironmentVariable(\"room_id_2\", JSON.stringify(room_id_2.toString()));", + "}", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "462566f5-d6cd-4c14-9b11-0cbf7abc0caf", + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}rooms/", + "host": [ + "{{url}}rooms" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Get Service IDs", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "d01c3826-dc28-4cce-957b-ec70d0393e7e", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "3b11031e-4031-4569-91f2-49e23517ffee", + "exec": [ + "// Run basic tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "var schema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"services\": {", + " \"type\": \"array\",", + " \"properties\": {", + " \"display_dashboard_ind\" : {", + " \"type\" : \"number\"", + " },", + " \"deleted\" : {", + " \"type\" : [\"object\", \"null\"]", + " },", + " \"actual_service_ind\" : {", + " \"type\" : \"number\"", + " },", + " \"service_id\" : {", + " \"type\" : [\"number\", \"object\"]", + " },", + " \"service_code\" : {", + " \"type\" : \"string\"", + " },", + " \"prefix\" : {", + " \"type\" : \"string\"", + " },", + " \"service_name\" : {", + " \"type\" : \"string\"", + " },", + " \"parent_id\" : {", + " \"type\" : [\"object\", \"number\", \"null\" ]", + " },", + " \"service_desc\" : {", + " \"type\" : \"string\"", + " }", + " },", + " \"required\" : [\"display_dashboard_ind\", \"deleted\", \"actual_service_ind\", \"service_id\", \"service_code\",", + " \"prefix\", \"service_name\", \"parent_id\", \"service_desc\"]", + " }", + " }", + "};", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate Service Schema\", function(){", + " pm.expect(tv4.validate(jsonData, schema)).to.be.true;", + "});", + "", + "// Loop to validate schema of each channel.", + "var allElements = jsonData.services;", + "var elementCount = 0;", + "var elementMax = Math.min(10, allElements.length);", + "//allElements.forEach(function(element) {", + "for (var currentElement = 0; currentElement < elementMax; currentElement++) {", + " element = allElements[currentElement];", + " elementCount ++;", + " var testTitle = \"Service (\" + elementCount + \"): \" + element.service_name;", + " pm.test(\"Validate Schema for \" + testTitle, function(){", + " pm.expect(tv4.validate(element, schema)).to.be.true;", + " });", + " ", + " // Test the authenticate response.", + " pm.test(\"--> \" + testTitle + \" dashboard_ind must be 0 or 1\", function() {", + " pm.expect(element.display_dashboard_ind).to.be.within(0,1);", + " });", + " pm.test(\"--> \" + testTitle + \" actual_service_ind must be 1\", function() {", + " pm.expect(element.actual_service_ind).to.be.eql(1);", + " });", + " pm.test(\"--> \" + testTitle + \" parent_id must not be null\", function() {", + " pm.expect(element.parent_id).to.not.be.null;", + " });", + "}", + "", + "// Declare and initialize variables.", + "var mspId = 0;", + "var taxId = 0;", + "var mspText = \"Payment - MSP\";", + "var propTaxText = \"Other - PTAX\";", + "", + "// Look for the MSP and Property Tax IDs.", + "allElements.forEach(function(element) {", + " if (element.service_name === mspText) {", + " mspId = element.service_id;", + " }", + " if (element.service_name === propTaxText) {", + " taxId = element.service_id;", + " }", + "});", + "", + "// Check that you found the service IDs.", + "pm.test(\"The \" + mspText + \" service ID (\" + mspId.toString() + \") should not equal 0\", function() {", + " pm.expect(mspId).to.not.be.eql(0);", + "});", + "", + "pm.test(\"The \" + propTaxText + \" service ID (\" + taxId.toString() + \") should not equal 0\", function() {", + " pm.expect(taxId).to.not.be.eql(0);", + "});", + "", + "// Store these IDs for future use.", + "postman.setEnvironmentVariable(\"service_MSP_id\", JSON.stringify(mspId));", + "postman.setEnvironmentVariable(\"service_PropTax_id\", JSON.stringify(taxId));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}services/", + "host": [ + "{{url}}services" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ] + }, + { + "name": "Check app health", + "item": [ + { + "name": "Check healthz driver Booking", + "event": [ + { + "listen": "test", + "script": { + "id": "74adc5ce-caa5-452a-bd96-8ac90a4c11d7", + "exec": [ + "// Set health response time variable.", + "max_response_time = 1500;", + "health_tries = 15;", + "counter = 1;", + "postman.setEnvironmentVariable(\"max_response_time\", JSON.stringify(max_response_time));", + "postman.setEnvironmentVariable(\"health_tries\", JSON.stringify(health_tries));", + "postman.setEnvironmentVariable(\"health_counter\", JSON.stringify(counter));", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "// Test the health response.", + "pm.test(\"Response should have 'message' property\", function() {", + " pm.expect(jsonData).to.have.property('message');", + "});", + "", + "pm.test(\"Response message should be 'api is health'\", function() {", + " pm.expect(jsonData.message).to.be.eql('api is healthy');", + "});", + "", + "// If response time is OK, proceed to the next test.", + "if (pm.response.responseTime < max_response_time) {", + " postman.setNextRequest(\"Check the readyz endpoint Booking\");", + "}", + " ", + "// Response time is too long. Try again, give pod a chance to spin up.", + "else {", + " postman.setNextRequest(\"Check the healthz endpoint Booking\");", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}healthz/", + "host": [ + "{{url}}healthz" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Check the healthz endpoint Booking", + "event": [ + { + "listen": "test", + "script": { + "id": "74adc5ce-caa5-452a-bd96-8ac90a4c11d7", + "exec": [ + "// Get the maximum response time allowed.", + "max_load_time = JSON.parse(globals.max_load_time);", + "", + "// Get and update variables.", + "health_tries = JSON.parse(postman.getEnvironmentVariable(\"health_tries\"));", + "counter = JSON.parse(postman.getEnvironmentVariable(\"health_counter\")) + 1;", + "postman.setEnvironmentVariable(\"health_counter\", JSON.stringify(counter));", + "", + "// Get the response.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Test the health response.", + "pm.test(\"Health Driver: Try \" + counter.toString() + \": Response should have 'message' property\", function() {", + " pm.expect(jsonData).to.have.property('message');", + "});", + "", + "pm.test(\"Response message should be 'api is health'\", function() {", + " pm.expect(jsonData.message).to.be.eql('api is healthy');", + "});", + "", + "// If response time is OK, proceed to the next test.", + "if (pm.response.responseTime < max_load_time) {", + " postman.setNextRequest(\"Check the readyz endpoint Booking\");", + "}", + " ", + "// Response time is too long.", + "else {", + " ", + " // You haven't reached your maximum tries yet. Try again.", + " if (counter < health_tries) {", + " postman.setNextRequest(\"Check the healthz endpoint Booking\");", + " }", + " ", + " // You have reached the maximum. An error, go to next test.", + " else {", + " pm.test(\"Response should be below \" + max_load_time.toString() + ' in ' + health_tries.toString() + ' tries.', function() {", + " pm.expect(counter).to.be.below(health_tries);", + " });", + " postman.setNextRequest(\"Check the readyz endpoint Booking\");", + " }", + "}", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}healthz/", + "host": [ + "{{url}}healthz" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Check the readyz endpoint Booking", + "event": [ + { + "listen": "test", + "script": { + "id": "661c33c4-4a3d-4396-a549-9969edafbfa6", + "exec": [ + "// Perform the standard tests.", + "eval(environment.basic_response_test);", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "// Test the health response.", + "pm.test(\"Response should have 'message' property\", function() {", + " pm.expect(jsonData).to.have.property('message');", + "});", + "", + "pm.test(\"Response message should be 'api is ready'\", function() {", + " pm.expect(jsonData.message).to.be.eql('api is ready');", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}readyz/", + "host": [ + "{{url}}readyz" + ], + "path": [ + "" + ] + } + }, + "response": [] + } + ], + "description": "Checks the application health by calling the healthz and readyz endpoints" + }, + { + "name": "Get Exam Types", + "item": [ + { + "name": "Exam Type List", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "2df2a851-6a71-48e6-b44f-ccf096fe9d83", + "exec": [ + "// Define the JSON Schema expected in response", + "var examTypeSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"exam_color\": {\"type\": \"string\"},", + " \"exam_type_id\": {\"type\": \"number\"},", + " \"exam_type_name\": {\"type\": \"string\"},", + " \"ita_ind\": {\"type\": \"number\"},", + " \"method_type\": {\"type\": \"string\"},", + " \"number_of_hours\": {\"type\": \"number\"},", + " \"group_exam_ind\": {\"type\": \"number\"}", + " },", + " \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"ita_ind\", \"method_type\", \"number_of_hours\", \"group_exam_ind\"]", + " },", + " \"required\": []", + "}; ", + "", + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate Response Exam Type Schema\", function(){", + " pm.expect(tv4.validate(jsonData, examTypeSchema)).to.be.true;", + "});", + "", + "// Store all exam type IDs for future use in adding exams", + "var allExamIds = [];", + "", + "// Make sure some data returned.", + "pm.test(\"Response has exam_types property\", function(){", + " pm.expect(jsonData.hasOwnProperty(\"exam_types\")).to.be.true;", + "});", + "pm.test(\"Response has at least one exam_type\", function(){", + " pm.expect(jsonData.exam_types.length).to.be.above(0);", + "});", + "", + "// Set up list of valid exam types, create random functions.", + "eval(environment.init_exam_type_data);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}exam_types/", + "host": [ + "{{url}}exam_types" + ], + "path": [ + "" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Exams", + "item": [ + { + "name": "Exam Post End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"current_office_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Get exam type data and functions.", + "exam_array = JSON.parse(postman.getEnvironmentVariable(\"exam_array_data\"));", + "eval(environment.create_random_functions);", + "// Create an event number based on the time.", + "var ms = (new Date().getTime()).toString() + \"00\";", + "eventNumber = Number(ms.substring(ms.length-6, ms.len)) + 1;", + "postman.setEnvironmentVariable(\"event_number\", eventNumber);", + "// Update the next event ID.", + "var eventId = \"pm\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", 0);", + "postman.setEnvironmentVariable(\"event_id\", JSON.stringify(eventId));", + "postman.setEnvironmentVariable(\"event_delete\", eventId);", + "// Calculate a random exam type to use.", + "random_index = get_random_index(exam_array);", + "// Store for use.", + "random_exam_type_id = exam_array[random_index].id;", + "postman.setEnvironmentVariable(\"random_exam_type_id\", JSON.stringify(random_exam_type_id.toString()));", + "// Store other variables for later use.", + "postman.setEnvironmentVariable(\"exam_method\", JSON.stringify(\"paper\"));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"Postman Group Exam Name\"));", + "postman.setEnvironmentVariable(\"exam_written_ind\", JSON.stringify(\"0\"));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"Postman Examinee Name\"));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"Postman Test Notes\"));", + "postman.setEnvironmentVariable(\"number_of_students\", JSON.stringify(\"19\"));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"Postman test location\"));", + "// Calculate an expiry date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+7);", + "// Get year, day, month from the later time.", + "year = later.getFullYear().toString();", + "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", + "day = (\"0\" + (later.getDate()).toString()).slice(-2);", + "// Format expiry date for the exam.", + "expiry_date = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", + "// Store globals.", + "pm.globals.set(\"expiry_date\", JSON.stringify(expiry_date));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "// Get the max response time allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "", + "// Check Response code for request", + "pm.test(\"Response code for request is 201\", function(){", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.exam_schema_check);", + "eval(environment.exam_data_check);", + "", + "// If jsonData has an exam property, save exam ID.", + "if (jsonData.hasOwnProperty(\"exam\")) {", + "\tcurrentExamId = jsonData.exam.exam_id;", + " postman.setEnvironmentVariable(\"current_exam_id\", currentExamId);", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\n\t\"event_id\" : {{event_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : \"Postman Group Exam Name\",\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : \"Pm examinee name\",\n \"notes\" : \"Pm sample notes\",\n \"number_of_students\" : \"19\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : \"Pm test location\",\n \"expiry_date\": {{expiry_date}}\n}" + }, + "url": { + "raw": "{{url}}exams/", + "host": [ + "{{url}}exams" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Exam Detail End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "5206f620-8220-4ba4-860a-13c1bb452e6d", + "exec": [ + "// Get the max response time allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "", + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.exam_schema_check);", + "eval(environment.exam_data_check);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Exam List End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "2a7432b9-ffb0-4e23-a224-c3a48171d6c4", + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.exam_schema_list_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}exams/", + "host": [ + "{{url}}exams" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Exam Put End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\",\"exam_method\",\"random_exam_type_id\",\"exam_written_ind\",\"current_office_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"number_of_students\", JSON.stringify(\"21\"));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "// Get the max response time allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "", + "// Check Response code for request", + "pm.test(\"Response code for request is 201\", function(){", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.exam_schema_check);", + "eval(environment.exam_data_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : {{exam_method}},\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : {{exam_written_ind}},\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}\n" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Exam Detail End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "3efcb554-1e5a-4e0a-91b8-aa32eb14a5e6", + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.exam_schema_check);", + "eval(environment.exam_data_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Exam Delete End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "88b43898-330f-4cf1-81c3-8cce3c53f54c", + "exec": [ + "// Get the max response time allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "", + "// Check Response code for request", + "pm.test(\"Response code for request is 204\", function(){", + " pm.response.to.have.status(204);", + "});", + "", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Exams Export", + "item": [ + { + "name": "Exams Export List", + "event": [ + { + "listen": "test", + "script": { + "id": "9e02fbaf-627e-43db-b516-226b1a2874e8", + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time less than 20,000ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(20000);", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "caf977c6-da22-4f6c-b0c9-ca5f0fc3ec29", + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Calculate a start date four weeks prior to today.", + "var start = new Date();", + "start.setDate(start.getDate()-28);", + "// Get year, day, month from the start time.", + "start_year = start.getFullYear().toString();", + "start_month = (\"0\" + (start.getMonth() + 1).toString()).slice(-2);", + "start_day = (\"0\" + (start.getDate()).toString()).slice(-2);", + "start_date = start_year + \"-\" + start_month + \"-\" + start_day;", + "// Get year, day, month from the current day.", + "var today = new Date();", + "end_year = today.getFullYear().toString();", + "end_month = (\"0\" + (today.getMonth() + 1).toString()).slice(-2);", + "end_day = (\"0\" + (today.getDate()).toString()).slice(-2);", + "end_date = end_year + \"-\" + end_month + \"-\" + end_day;", + "console.log(\"Start: \" + start_date);", + "console.log(\"End: \" + end_date);", + "pm.globals.set(\"start_date\", start_date);", + "pm.globals.set(\"end_date\", end_date);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}exams/export/?start_date={{start_date}}&end_date={{end_date}}", + "host": [ + "{{url}}exams" + ], + "path": [ + "export", + "" + ], + "query": [ + { + "key": "start_date", + "value": "{{start_date}}" + }, + { + "key": "end_date", + "value": "{{end_date}}" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Bookings", + "item": [ + { + "name": "Booking Post End-point", + "event": [ + { + "listen": "test", + "script": { + "id": "a4099862-1c9a-48f7-adbf-0240e6eb185a", + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 201\", function(){", + " pm.response.to.have.status(201);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "", + "var booking_id = jsonData.booking.booking_id;", + "", + "//Dynamic variable used for end-point testing later on", + "postman.setEnvironmentVariable(\"booking_id\", JSON.stringify(booking_id));" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "4df5dedd-4976-4cdc-b2be-739b2028cdc4", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_office_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Calculate a start date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+7);", + "// Get year, day, month from the later time.", + "year = later.getFullYear().toString();", + "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", + "day = (\"0\" + (later.getDate()).toString()).slice(-2);", + "// Format starting and ending time for the booking.", + "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", + "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", + "// Store globals.", + "pm.globals.set(\"start_time\", JSON.stringify(start_time));", + "pm.globals.set(\"end_time\", JSON.stringify(end_time));", + "pm.globals.set(\"fees\", JSON.stringify(\"false\"));", + "pm.globals.set(\"booking_name\", JSON.stringify(\"Super big demo next week\"));", + "pm.globals.set(\"room_id\", pm.environment.get(\"room_id_1\"));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"room_id\": {{room_id}},\n \"fees\": {{fees}},\n \"booking_name\": {{booking_name}},\n \"office_id\" : {{current_office_id}}\n}\n" + }, + "url": { + "raw": "{{url}}bookings/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Booking Detail End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"booking_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "232f5232-de75-4f55-b999-2e39e39a12a8", + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}bookings/{{booking_id}}/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "{{booking_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Booking List End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "59fc7e18-6df0-48d9-822c-6518fbece309", + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_list_schema_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}bookings/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Booking Put End-point", + "event": [ + { + "listen": "test", + "script": { + "id": "b127046f-b399-4e66-b76f-b6e79268b8ce", + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "9bde67e2-8eeb-4e50-90bf-caff1fef90a4", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"booking_id\",\"current_office_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Calculate a start date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+7);", + "// Get year, day, month from the later time.", + "year = later.getFullYear().toString();", + "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", + "day = (\"0\" + (later.getDate()).toString()).slice(-2);", + "// Format starting and ending time for the booking.", + "start_time = year + \"-\" + month + \"-\" + day + \"T21:00:00Z\";", + "end_time = year + \"-\" + month + \"-\" + day + \"T23:00:00Z\";", + "pm.globals.set(\"start_time\", JSON.stringify(start_time));", + "pm.globals.set(\"end_time\", JSON.stringify(end_time));", + "pm.globals.set(\"fees\", JSON.stringify(\"true\"));", + "pm.globals.set(\"booking_name\", JSON.stringify(\"Time to pay your fees!\"));", + "pm.globals.set(\"room_id\", pm.environment.get(\"room_id_2\"));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"room_id\": {{room_id}},\n \"fees\": {{fees}},\n \"booking_name\": {{booking_name}},\n \"office_id\" : {{current_office_id}}\n}" + }, + "url": { + "raw": "{{url}}bookings/{{booking_id}}/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "{{booking_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Booking Detail End-point Again", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"booking_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "b5e53be0-ddda-4c99-b563-5a3b449e0f79", + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}bookings/{{booking_id}}/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "{{booking_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Booking Delete End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"booking_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "1e7c1d71-ea74-4a78-9ef2-ee9a7a47d915", + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 204\", function(){", + " pm.response.to.have.status(204);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}bookings/{{booking_id}}/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "{{booking_id}}", + "" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Invigilators", + "item": [ + { + "name": "Invigilator List End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "0e68858e-985c-4fb0-bca6-04d33f65c28d", + "exec": [ + "// Define the JSON Schema expected in response", + "var invigilatorSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"invigilators\": {", + " \"type\": \"array\",", + " \"properties\": {", + " \"contact_email\": {\"type\": \"string\"},", + " \"contact_phone\": {\"type\": \"string\"},", + " \"contract_expiry_date\": {\"type\": \"string\"},", + " \"contract_number\": {\"type\": \"string\"},", + " \"invigilator_id\": {\"type\": \"number\"},", + " \"invigilator_name\": {\"type\": \"string\"},", + " \"invigilator_notes\": {\"type\": \"string\"},", + " \"office\":{", + " \"type\": \"object\",", + " \"properties\": {", + " \"office_id\": {\"type\": \"number\"},", + " \"office_name\": {\"type\": \"string\"},", + " \"office_number\": {\"type\": \"number\"},", + " \"sb\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"sb_id\": {\"type\": \"number\"},", + " \"sb_type\": {\"type\": \"string\"}", + " },", + " \"required\": [\"sb_id\", \"sb_type\"]", + " }", + " },", + " \"required\": [\"office_id\", \"office_name\", \"office_number\", \"sb\", \"sb_id\"]", + " }", + " },", + " \"required\": [\"contact_email\", \"contact_phone\", \"contract_expiry_date\", \"contract_number\", \"invigilator_id\", \"invigilator_name\", \"invigilator_notes\", \"office\"]", + " }", + " }", + "};", + "", + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate Response Invigilator Schema\", function(){", + " pm.expect(tv4.validate(jsonData, invigilatorSchema)).to.be.true;", + "});", + "", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}invigilators/", + "host": [ + "{{url}}invigilators" + ], + "path": [ + "" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Rooms", + "item": [ + { + "name": "Room List End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "859ae114-22c4-4f3e-9f1f-9f0e06fbc29d", + "exec": [ + "// Define the JSON Schema expected in response", + "var roomSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"rooms\": {", + " \"type\": \"array\",", + " \"properties\": {", + " \"capacity\": {\"type\": \"number\"},", + " \"color\": {\"type\": \"string\"},", + " \"office\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"office_id\": {\"type\": \"number\"},", + " \"office_name\": {\"type\": \"string\"},", + " \"office_number\": {\"type\": \"number\"},", + " \"sb\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"sb_id\": {\"type\": \"number\"},", + " \"sb_type\": {\"type\": \"string\"}", + " },", + " \"required\": [\"sb_id\", \"sb_type\"]", + " },", + " \"sb_id\": {\"type\": \"number\"} ", + " },", + " \"required\": [\"office_id\", \"office_name\", \"office_number\", \"sb\", \"sb_id\"]", + " }", + " },", + " \"required\": [\"capacity\", \"color\", \"office\", \"room_id\", \"room_name\"]", + " }", + " }", + "};", + "", + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate Response Room Schema\", function(){", + " pm.expect(tv4.validate(jsonData, roomSchema)).to.be.true;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}rooms/", + "host": [ + "{{url}}rooms" + ], + "path": [ + "" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "CSRS", + "item": [ + { + "name": "CSRS Me Get End-point", + "event": [ + { + "listen": "test", + "script": { + "id": "1ed052a0-06cc-45c7-ae49-b19b96e02d51", + "exec": [ + "// Define the JSON Schema expected in response", + "var CSRSSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"csr\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"csr_id\": {\"type\": \"number\"},", + " \"csr_state\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"csr_state_desc\": {\"type\": \"string\"},", + " \"csr_state_id\": {\"type\": \"number\"},", + " \"csr_state_name\": {\"type\": \"string\"}", + " },", + " \"required\": [\"csr_state_desc\", \"csr_state_id\", \"csr_state_name\"]", + " },", + " \"csr_state_id\": {\"type\": \"number\"},", + " \"deleted\": {},", + " \"finance_designate\": {\"type\": \"number\"},", + " \"office_manager\": {\"type\": \"number\"},", + " \"ita2_designate\": {\"type\": \"number\"},", + " \"office\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"appointments_enabled_ind\": {\"type\": \"number\"},", + " \"back_office_list\": {", + " \"type\": \"array\",", + " \"properties\": {", + " \"actual_service_ind\": {\"type\": \"number\"},", + " \"deleted\": {},", + " \"display_dashboard_ind\": {\"type\": \"number\"},", + " \"parent\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"service_name\": {\"type\": \"string\"}", + " },", + " \"required\": [\"service_name\"]", + " },", + " \"parent_id\": {\"type\": \"number\"},", + " \"prefix\": {\"type\": \"string\"},", + " \"service_code\": {\"type\": \"string\"},", + " \"service_desc\": {\"type\": \"string\"},", + " \"service_id\": {\"type\": \"number\"},", + " \"service_name\": {\"type\": \"string\"},", + " },", + " \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\", \"parent\",", + " \"parent_id\", \"prefix\", \"service_code\", \"service_desc\", \"service_id\",", + " \"service_name\"]", + " },", + " \"counters\": {", + " \"type\": \"array\",", + " \"properties\": {", + " \"counter_id\": {\"type\": \"number\"},", + " \"counter_name\": {\"type\": \"string\"}", + " },", + " \"required\": [\"counter_id\", \"counter_name\"]", + " },", + " \"exams_enabled_ind\": {\"type\": \"number\"},", + " \"office_id\": {\"type\": \"number\"},", + " \"office_name\": {\"type\": \"string\"},", + " \"office_number\": {\"type\": \"number\"},", + " \"quick_list\": {", + " \"type\": \"array\",", + " \"properties\": {", + " \"actual_service_ind\": {\"type\": \"number\"},", + " \"deleted\": {},", + " \"display_dashboard_ind\": {\"type\": \"number\"},", + " \"parent\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"service_name\": {\"type\": \"string\"}", + " },", + " \"required\": [\"service_name\"]", + " },", + " \"parent_id\": {\"type\": \"number\"},", + " \"prefix\": {\"type\": \"string\"},", + " \"service_code\": {\"type\": \"string\"},", + " \"service_desc\": {\"type\": \"string\"},", + " \"service_id\": {\"type\": \"number\"},", + " \"service_name\": {\"type\": \"string\"},", + " },", + " \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\", \"parent\",", + " \"parent_id\", \"prefix\", \"service_code\", \"service_desc\", \"service_id\",", + " \"service_name\"]", + " },", + " \"sb\":{", + " \"type\": \"object\",", + " \"properties\": {", + " \"sb_id\": {\"type\": \"number\"},", + " \"sb_type\": {\"type\": \"string\"}", + " },", + " \"required\": [\"sb_id\", \"sb_type\"]", + " },", + " \"sb_id\": {\"type\": \"number\"},", + " \"timezone\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"timezone_id\": {\"type\": \"number\"},", + " \"timezone_name\": {\"type\": \"string\"}", + " },", + " \"required\": [\"timezone_id\", \"timezone_name\"]", + " }", + " },", + " \"required\": [\"appointments_enabled_ind\", \"back_office_list\", \"counters\",", + " \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\",", + " \"quick_list\", \"sb\", \"sb_id\", ]", + " },", + " \"office_id\": {\"type\": \"number\"},", + " \"pesticide_designate\": {\"type\": \"number\"},", + " \"qt_xn_csr_ind\": {\"type\": \"number\"},", + " \"receptionist_ind\": {\"type\": \"number\"},", + " \"role\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"role_code\": {\"type\": \"string\"},", + " \"role_desc\": {\"type\": \"string\"},", + " \"role_id\": {\"type\": \"number\"}", + " },", + " \"required\": [\"role_code\", \"role_desc\", \"role_id\"]", + " },", + " \"role_id\": {\"type\": \"number\"},", + " \"username\": {\"type\": \"string\"}", + " },", + " },", + " \"attention_needed\": {\"type\": \"boolean\"},", + " \"active_citizens\" : {\"type\": \"array\"},", + " \"back_office_display\": {\"type\": \"string\"},", + " \"recurring_feature_flag\": {\"type\": \"string\"}", + " },", + " \"required\": [\"csr\", \"attention_needed\", \"active_citizens\", \"back_office_display\", \"recurring_feature_flag\"]", + "};", + "", + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate Response CSRs Schema\", function(){", + " pm.expect(tv4.validate(jsonData, CSRSSchema)).to.be.true;", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "1c4020cd-fb05-478c-b908-3197c80d492e", + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}csrs/me/", + "host": [ + "{{url}}csrs" + ], + "path": [ + "me", + "" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Offices", + "item": [ + { + "name": "Office List End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "ad6ffb6d-efad-4e11-b4a9-99e49f457bbd", + "exec": [ + "// Define the JSON Schema expected in response", + "var officeSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"offices\": {", + " \"type\": \"array\",", + " \"properties\": {", + " \"exams_enabled\": {\"type\": \"number\"},", + " \"office_id\": {\"type\": \"number\"},", + " \"office_name\": {\"type\": \"string\"},", + " \"office_number\": {\"type\": \"number\"},", + " \"sb\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"sb_id\": {\"type\": \"number\"},", + " \"sb_type\": {\"type\": \"string\"}", + " },", + " \"required\": [\"sb_id\", \"sb_type\"]", + " },", + " \"sb_id\": {\"type\": \"number\"}", + " },", + " \"required\": [\"exams_enabled\", \"office_id\", \"office_name\", \"office_number\", \"sb\", \"sb_id\"]", + " }", + " }", + "};", + "", + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate Response Office Schema\", function(){", + " pm.expect(tv4.validate(jsonData, officeSchema)).to.be.true;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}offices/", + "host": [ + "{{url}}offices" + ], + "path": [ + "" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Appointments", + "item": [ + { + "name": "Appointment Post End-point", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 201\", function(){", + " pm.response.to.have.status(201);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.appointment_schema_check);", + "eval(environment.appointment_data_check);", + "", + "var appointment_id = jsonData.appointment.appointment_id;", + "", + "//Dynamic variable used for end-point testing later on", + "postman.setEnvironmentVariable(\"appointment_id\", JSON.stringify(appointment_id));" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_office_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Calculate a start date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+7);", + "// Get year, day, month from the later time.", + "year = later.getFullYear().toString();", + "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", + "day = (\"0\" + (later.getDate()).toString()).slice(-2);", + "// Format starting and ending time for the booking.", + "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", + "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", + "pm.globals.set(\"start_time\", JSON.stringify(start_time));", + "pm.globals.set(\"end_time\", JSON.stringify(end_time));", + "pm.globals.set(\"category\", JSON.stringify(\"Exam\"));", + "pm.globals.set(\"service_id\", pm.environment.get(\"service_PropTax_id\"));", + "pm.globals.set(\"appt_comments\", JSON.stringify(\"Missed playoffs, needs to talk #1.\"));", + "pm.globals.set(\"appt_citizen_name\", JSON.stringify(\"LeBron James Appointment #1\"));", + "pm.globals.set(\"appt_contact_information\", JSON.stringify(\"My contact info\"));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"service_id\": {{service_id}},\n \"office_id\" : {{current_office_id}},\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"category\": {{category}},\n \"comments\": {{appt_comments}},\n \"citizen_name\": {{appt_citizen_name}},\n \"contact_information\": {{appt_contact_information}}\n}" + }, + "url": { + "raw": "{{url}}appointments/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Appointment Detail End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"appointment_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "5206f620-8220-4ba4-860a-13c1bb452e6d", + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.appointment_schema_check);", + "eval(environment.appointment_data_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}appointments/{{appointment_id}}/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "{{appointment_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Appointment List End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "2a7432b9-ffb0-4e23-a224-c3a48171d6c4", + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid\\", + "eval(environment.appointment_list_schema_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}appointments/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Appointment Put End-point", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.appointment_schema_check);", + "eval(environment.appointment_data_check);", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"appointment_id\",\"current_office_id\",\"category\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Calculate a start date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+7);", + "// Get year, day, month from the later time.", + "year = later.getFullYear().toString();", + "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", + "day = (\"0\" + (later.getDate()).toString()).slice(-2);", + "// Format starting and ending time for the booking.", + "start_time = year + \"-\" + month + \"-\" + day + \"T21:00:00Z\";", + "end_time = year + \"-\" + month + \"-\" + day + \"T23:00:00Z\";", + "pm.globals.set(\"start_time\", JSON.stringify(start_time));", + "pm.globals.set(\"end_time\", JSON.stringify(end_time));", + "pm.globals.set(\"appt_comments\", JSON.stringify(\"super EARLY\"));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"office_id\" : {{current_office_id}},\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"category\": {{category}},\n \"comments\": {{appt_comments}}\n}" + }, + "url": { + "raw": "{{url}}appointments/{{appointment_id}}/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "{{appointment_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Appointment Delete End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"appointment_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "88b43898-330f-4cf1-81c3-8cce3c53f54c", + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 204\", function(){", + " pm.response.to.have.status(204);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}appointments/{{appointment_id}}/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "{{appointment_id}}", + "" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Public User Appointments", + "item": [ + { + "name": "Authenticate public user token", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"auth_url\",\"realm\",\"clientid\",\"public_user_id\",\"public_user_password\",\"client_secret\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Parse response body", + "var jsonData = {};", + "try {", + " jsonData = JSON.parse(responseBody);", + "} catch (parseErr) {", + " console.log(\"Authentication response body was not JSON.\");", + " console.log(responseBody);", + " pm.globals.set(\"auth_failure_reason\", \"Non-JSON auth response\");", + " pm.execution.setNextRequest(null);", + " throw parseErr;", + "}", + "", + "var authFailureReason = jsonData.error_description || jsonData.error || (\"HTTP \" + pm.response.code);", + "if (pm.response.code !== 200 || !jsonData.access_token) {", + " console.log(\"Authentication failed for \" + pm.info.requestName + \".\");", + " console.log(responseBody);", + " pm.globals.set(\"auth_failure_reason\", authFailureReason);", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Authentication failed: \" + authFailureReason);", + "}", + "", + "pm.test(\"Response code for request is 200\", function(){", + " pm.expect(pm.response.code).to.eql(200);", + "});", + "pm.test(\"Access token exists\", function(){", + " pm.expect(jsonData).to.have.property(\"access_token\");", + " pm.expect(jsonData.access_token).to.be.a(\"string\").and.not.empty;", + "});", + "pm.test(\"Refresh token exists\", function(){", + " pm.expect(jsonData).to.have.property(\"refresh_token\");", + " pm.expect(jsonData.refresh_token).to.be.a(\"string\").and.not.empty;", + "});", + "pm.test(\"Expires In is present\", function(){", + " pm.expect(jsonData).to.have.property(\"expires_in\");", + " pm.expect(jsonData.expires_in).to.not.eql(null);", + "});", + "pm.test(\"Refresh Expires In is present\", function(){", + " pm.expect(jsonData).to.have.property(\"refresh_expires_in\");", + " pm.expect(jsonData.refresh_expires_in).to.not.eql(null);", + "});", + "", + "pm.globals.unset(\"auth_failure_reason\");", + "pm.globals.set(\"public_user_token\", jsonData.access_token);", + "pm.globals.set(\"public_user_refresh_token\", jsonData.refresh_token);", + "pm.globals.set(\"token_expires\", Date.now() + (jsonData.expires_in * 1000));", + "pm.globals.set(\"refresh_token_expires\", Date.now() + (jsonData.refresh_expires_in * 1000));", + "pm.globals.set(\"expires_in\", jsonData.expires_in);", + "pm.globals.set(\"refresh_expires_in\", jsonData.refresh_expires_in);", + "pm.environment.unset(\"user_id\");", + "pm.environment.unset(\"user_phone\");", + "pm.environment.unset(\"appointment_id\");" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/x-www-form-urlencoded" + } + ], + "body": { + "mode": "raw", + "raw": "grant_type=password&client_id={{clientid}}&username={{public_user_id}}&password={{public_user_password}}&client_secret={{client_secret}}" + }, + "url": { + "raw": "{{auth_url}}/auth/realms/{{realm}}/protocol/openid-connect/token", + "host": [ + "{{auth_url}}" + ], + "path": [ + "auth", + "realms", + "{{realm}}", + "protocol", + "openid-connect", + "token" + ] + } + }, + "response": [] + }, + { + "name": "Authenticate and create user", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"public_url\",\"clientid\",\"public_user_id\",\"public_user_password\",\"client_secret\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "var allSchema = {", + " \"type\": \"array\",", + " \"items\": {\"type\": \"object\"}", + "};", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate All Users Schema\", function(){", + " pm.expect(tv4.validate(jsonData, allSchema)).to.be.true;", + "});", + "", + "var firstUser = jsonData[0];", + "console.log(firstUser)", + "", + "var userSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"email\": {\"type\": \"string\"},", + " \"last_name\": {\"type\": \"string\"},", + " \"user_id\": {\"type\": \"number\"},", + " \"username\": {\"type\": \"string\"},", + " \"send_email_reminders\": {\"type\": \"boolean\"},", + " \"send_sms_reminders\": {\"type\": \"boolean\"},", + " \"display_name\": {\"type\": \"string\"},", + " \"telephone\": {\"type\": \"string\"}", + " },", + " \"required\": [\"email\", \"last_name\", \"user_id\", \"username\", \"send_email_reminders\", \"send_sms_reminders\",", + " \"display_name\", \"telephone\"]", + "};", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate First User Schema\", function(){", + " pm.expect(tv4.validate(firstUser, userSchema)).to.be.true;", + "});", + "", + "//Dynamic variables used for end-point testing later on", + "var user_id = firstUser.user_id;", + "var user_phone = firstUser.telephone;", + "postman.setEnvironmentVariable(\"user_id\", JSON.stringify(user_id));", + "postman.setEnvironmentVariable(\"user_phone\", JSON.stringify(user_phone));", + "pm.test(\"Stored user_id for later public user requests\", function(){", + " pm.expect(postman.getEnvironmentVariable(\"user_id\")).to.not.be.oneOf([null, undefined, \"\"]);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{public_user_token}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Typea", + "type": "text", + "value": "application/x-www-form-urlencoded" + } + ], + "body": { + "mode": "raw", + "raw": "grant_type=password&client_id={{clientid}}&username={{public_user_id}}&password={{public_user_password}}&client_secret={{client_secret}}" + }, + "url": { + "raw": "{{public_url}}users/", + "host": [ + "{{public_url}}users" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Discover public appointment office", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"public_url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "var jsonData = JSON.parse(responseBody);", + "var offices = jsonData.offices || [];", + "var office = offices.find(function(candidate) {", + " return candidate.office_name === \"100 Mile House\";", + "});", + "", + "pm.test(\"Public appointment office was discovered\", function(){", + " pm.expect(office).to.not.be.oneOf([null, undefined]);", + "});", + "", + "pm.environment.set(\"public_office_id\", String(office.office_id));", + "pm.environment.set(\"public_office_timezone\", office.timezone.timezone_name);" + ] + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{public_url}}offices/", + "host": [ + "{{public_url}}offices" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Discover public appointment service", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"public_url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "var jsonData = JSON.parse(responseBody);", + "var services = jsonData.services || [];", + "var service = services.find(function(candidate) {", + " return candidate.service_name === \"Deferment Application\";", + "});", + "", + "pm.test(\"Public appointment service was discovered\", function(){", + " pm.expect(service).to.not.be.oneOf([null, undefined]);", + "});", + "", + "pm.environment.set(\"public_service_id\", String(service.service_id));" + ] + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{public_url}}services/", + "host": [ + "{{public_url}}services" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Find available public appointment slot", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"public_url\",\"public_office_id\",\"public_service_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "var jsonData = JSON.parse(responseBody);", + "var slotDay = null;", + "var slot = null;", + "", + "Object.keys(jsonData).forEach(function(dayKey) {", + " if (!slotDay && Array.isArray(jsonData[dayKey]) && jsonData[dayKey].length > 0) {", + " slotDay = dayKey;", + " slot = jsonData[dayKey][0];", + " }", + "});", + "", + "pm.test(\"At least one public appointment slot is available\", function(){", + " pm.expect(slotDay).to.not.be.oneOf([null, undefined, \"\"]);", + " pm.expect(slot).to.not.be.oneOf([null, undefined]);", + "});", + "", + "var timezoneName = pm.environment.get(\"public_office_timezone\") || \"America/Creston\";", + "var offset = timezoneName === \"America/Creston\" ? \"-07:00\" : \"-07:00\";", + "var parts = slotDay.split(\"/\");", + "var dayIso = [parts[2], parts[0], parts[1]].join(\"-\");", + "var startIso = dayIso + \"T\" + slot.start_time + \":00\" + offset;", + "var endIso = dayIso + \"T\" + slot.end_time + \":00\" + offset;", + "", + "pm.globals.set(\"public_start_time\", JSON.stringify(startIso));", + "pm.globals.set(\"public_end_time\", JSON.stringify(endIso));", + "pm.globals.set(\"category\", JSON.stringify(\"Exam\"));", + "pm.globals.set(\"service_id\", pm.environment.get(\"public_service_id\"));", + "pm.globals.set(\"appt_comments\", JSON.stringify(\"My self serve appt.\"));", + "pm.globals.set(\"appt_citizen_name\", JSON.stringify(\"cfms-postman-public-user\"));", + "pm.globals.set(\"appt_contact_information\", JSON.stringify(\"test@test.com\"));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{public_user_token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{public_url}}offices/{{public_office_id}}/slots/?service_id={{public_service_id}}", + "host": [ + "{{public_url}}offices" + ], + "path": [ + "{{public_office_id}}", + "slots", + "" + ], + "query": [ + { + "key": "service_id", + "value": "{{public_service_id}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Book an appointment", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 201\", function(){", + " pm.response.to.have.status(201);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.appointment_schema_check);", + "", + "// Update the comments to include phone number, before data test.", + "var comments_old = JSON.parse(pm.globals.get(\"appt_comments\"));", + "var user_phone = JSON.parse(postman.getEnvironmentVariable(\"user_phone\"));", + "var comments_new = comments_old + '. Phone: ' + user_phone;", + "console.log(\"==> Old: \" + comments_old);", + "console.log(\"==> Phone: \" + user_phone);", + "console.log(\"==> New: \" + comments_new);", + "pm.globals.set(\"appt_comments\", JSON.stringify(comments_new));", + "", + "// Now ready for the data check.", + "eval(environment.appointment_data_check);", + "", + "//Dynamic variable used for end-point testing later on", + "var appointment_id = jsonData.appointment.appointment_id;", + "postman.setEnvironmentVariable(\"appointment_id\", JSON.stringify(appointment_id));", + "pm.test(\"Stored appointment_id for public appointment cleanup\", function(){", + " pm.expect(postman.getEnvironmentVariable(\"appointment_id\")).to.not.be.oneOf([null, undefined, \"\"]);", + "});", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"public_url\",\"service_id\",\"public_office_id\",\"public_start_time\",\"public_end_time\",\"category\",\"appt_comments\",\"appt_citizen_name\",\"appt_contact_information\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "var requiredVars = [\"public_start_time\", \"public_end_time\", \"service_id\"];", + "requiredVars.forEach(function(varName) {", + " pm.test(\"Required variable \" + varName + \" is set before public booking\", function(){", + " pm.expect(pm.globals.get(varName)).to.not.be.oneOf([null, undefined, \"\"]);", + " });", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{public_user_token}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"service_id\": {{service_id}},\n \"office_id\" : {{public_office_id}},\n \"start_time\": {{public_start_time}},\n \"end_time\": {{public_end_time}},\n \"category\": {{category}},\n \"comments\": {{appt_comments}},\n \"citizen_name\": {{appt_citizen_name}},\n \"contact_information\": {{appt_contact_information}}\n}" + }, + "url": { + "raw": "{{public_url}}appointments/", + "host": [ + "{{public_url}}appointments" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Edit user profile", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"public_url\",\"user_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "var allSchema = {", + " \"type\": \"array\",", + " \"items\": {\"type\": \"object\"}", + "};", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate All Users Schema\", function(){", + " pm.expect(tv4.validate(jsonData, allSchema)).to.be.true;", + "});", + "", + "var firstUser = jsonData[0];", + "", + "var userSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"email\": {\"type\": \"string\"},", + " \"last_name\": {\"type\": \"string\"},", + " \"user_id\": {\"type\": \"number\"},", + " \"username\": {\"type\": \"string\"},", + " \"send_email_reminders\": {\"type\": \"boolean\"},", + " \"send_sms_reminders\": {\"type\": \"boolean\"},", + " \"display_name\": {\"type\": \"string\"},", + " \"telephone\": {\"type\": \"string\"}", + " },", + " \"required\": [\"email\", \"last_name\", \"user_id\", \"username\", \"send_email_reminders\", \"send_sms_reminders\",", + " \"display_name\", \"telephone\"]", + "};", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate First User Schema\", function(){", + " pm.expect(tv4.validate(firstUser, userSchema)).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{public_user_token}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"email\": \"test@test.com\",\n \"telephone\": \"0000000000\",\n \"send_email_reminders\": true,\n \"send_sms_reminders\": true\n}" + }, + "url": { + "raw": "{{public_url}}users/{{user_id}}/", + "host": [ + "{{public_url}}users" + ], + "path": [ + "{{user_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Get user profile", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"public_url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "var allSchema = {", + " \"type\": \"array\",", + " \"items\": {\"type\": \"object\"}", + "};", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate All Users Schema\", function(){", + " pm.expect(tv4.validate(jsonData, allSchema)).to.be.true;", + "});", + "", + "var firstUser = jsonData[0];", + "", + "var userSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"email\": {\"type\": \"string\"},", + " \"last_name\": {\"type\": \"string\"},", + " \"user_id\": {\"type\": \"number\"},", + " \"username\": {\"type\": \"string\"},", + " \"send_email_reminders\": {\"type\": \"boolean\"},", + " \"send_sms_reminders\": {\"type\": \"boolean\"},", + " \"display_name\": {\"type\": \"string\"},", + " \"telephone\": {\"type\": \"string\"}", + " },", + " \"required\": [\"email\", \"last_name\", \"user_id\", \"username\", \"send_email_reminders\", \"send_sms_reminders\",", + " \"display_name\", \"telephone\"]", + "};", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate First User Schema\", function(){", + " pm.expect(tv4.validate(firstUser, userSchema)).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{public_user_token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [ + { + "key": "", + "type": "text", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{public_url}}users/me/", + "host": [ + "{{public_url}}users" + ], + "path": [ + "me", + "" + ] + } + }, + "response": [] + }, + { + "name": "List all appointments", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"public_url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid\\", + "eval(environment.appointment_list_schema_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{public_user_token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{public_url}}users/appointments/", + "host": [ + "{{public_url}}users" + ], + "path": [ + "appointments", + "" + ] + } + }, + "response": [] + }, + { + "name": "Appointment Delete End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"public_url\",\"appointment_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 204\", function(){", + " pm.response.to.have.status(204);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.max_response_time);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{public_user_token}}", + "type": "string" + } + ] + }, + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{public_url}}appointments/{{appointment_id}}/", + "host": [ + "{{public_url}}appointments" + ], + "path": [ + "{{appointment_id}}", + "" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + } + ] +} diff --git a/api/postman/Load_Test_Booking.json b/api/postman/Load_Test_Booking.json index 4fee3a530..7b6a9f7e1 100644 --- a/api/postman/Load_Test_Booking.json +++ b/api/postman/Load_Test_Booking.json @@ -1,2794 +1,3284 @@ { - "info": { - "_postman_id": "a0066296-ea47-4c6a-834a-ec58a02f8dea", - "name": "Load_Test_Booking", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" - }, - "item": [ - { - "name": "Setup", - "item": [ - { - "name": "Setup-Variables", - "event": [ - { - "listen": "test", - "script": { - "id": "5409b66d-67a4-449b-8633-9aeca632b388", - "exec": [ - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "e9eed831-7955-4218-a400-ae6e1e7e2e10", - "exec": [ - "// See if the use-prefix global has been set. Use default if not.", - "let usePrefix = '';", - "if (pm.globals.get('use-prefix')) {", - " console.log(\"==> use-prefix exists\");", - " usePrefix = pm.globals.get('use-prefix');", - " console.log(\" --> Prefix is: \" + usePrefix);", - " ", - " // Set up all globals, using the correct prefix.", - " pm.globals.set('auth_url', pm.globals.get(usePrefix + 'auth_url'));", - " pm.globals.set('realm', pm.globals.get(usePrefix + 'realm'));", - " pm.globals.set('clientid', pm.globals.get(usePrefix + 'clientid'));", - " pm.globals.set('client_secret', pm.globals.get(usePrefix + 'client_secret'));", - " pm.globals.set('url', pm.globals.get(usePrefix + 'url'));", - "}", - "else {", - " console.log(\"==> use-prefix does not exist\");", - " console.log(\" --> No default globals set.\");", - "}", - "", - "// If no maximum load time defined, set a default.", - "if (!pm.globals.get('max_load_time')) {", - " console.log(\"==> max_load_time not present, default set.\");", - " pm.globals.set(\"max_load_time\", JSON.stringify(1503));", - "}", - "", - "// If no maximum response defined, set a default.", - "if (!pm.globals.get('max_response_time')) {", - " console.log(\"==> max_response_time not present, default set.\");", - " pm.globals.set(\"max_response_time\", JSON.stringify(15005));", - "}", - "", - "// Display the values of all globals.", - "console.log(\"\");", - "console.log(\"==> Globals are:\");", - "console.log(\" --> auth_url: \" + pm.globals.get(\"auth_url\"));", - "console.log(\" --> realm: \" + pm.globals.get(\"realm\"));", - "console.log(\" --> clientid: \" + pm.globals.get(\"clientid\"));", - "console.log(\" --> client_secret: \" + pm.globals.get(\"client_secret\"));", - "console.log(\" --> url: \" + pm.globals.get(\"url\"));", - "console.log(\" --> max_load_time: \" + pm.globals.get(\"max_load_time\"));", - "console.log(\" --> max_response_time: \" + pm.globals.get(\"max_response_time\"));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Dummy data." - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "Authentication Token", - "event": [ - { - "listen": "test", - "script": { - "id": "454ea7d6-4c7e-4571-8bc1-be7eed57d03a", - "exec": [ - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "//Test to make sure that the access token field is not null", - "pm.test(\"Access Token is not null\", function(){", - " var access_token = jsonData.access_token;", - " if (pm.expect(access_token).not.eql(null)){", - " pm.globals.set(\"token\", access_token);", - " }", - "});", - "//Test to make sure that the refresh token response field is not null", - "pm.test(\"Refresh Token is not null\", function(){", - " var refresh_token = jsonData.refresh_token;", - " if (pm.expect(refresh_token).not.eql(null)){", - " pm.globals.set(\"refresh_token\", refresh_token);", - " }", - "});", - "//Test to make sure that expires in response field is not nullf", - "pm.test(\"Expires In is not null\", function(){", - " var expires_in = jsonData.expires_in;", - " if (pm.expect(expires_in).not.eql(null)){", - " pm.globals.set(\"expires_in\", expires_in);", - " }", - "});", - "//Test to make sure that refresh expires in response fiels is not null", - "pm.test(\"Refresh Expires In is not null\", function(){", - " var refresh_expires_in = jsonData.refresh_expires_in;", - " if (pm.expect(refresh_expires_in).not.eql(null)){", - " pm.globals.set(\"refresh_expires_in\", refresh_expires_in);", - " }", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/x-www-form-urlencoded", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "grant_type=password&client_id={{clientid}}&username={{userid}}&password={{password}}&client_secret={{client_secret}}" - }, - "url": { - "raw": "{{auth_url}}/auth/realms/{{realm}}/protocol/openid-connect/token?Content-Type=application/x-www-form-urlencoded", - "host": [ - "{{auth_url}}" - ], - "path": [ - "auth", - "realms", - "{{realm}}", - "protocol", - "openid-connect", - "token" - ], - "query": [ - { - "key": "Content-Type", - "value": "application/x-www-form-urlencoded" - } - ] - } - }, - "response": [] - }, - { - "name": "CFMS-Install-Basic-Response-Tests", - "event": [ - { - "listen": "test", - "script": { - "id": "a0d8e240-3b40-4654-a32b-bf2e676fdeb9", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"basic_response_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// If no maximum response defined, set a default.\nresponse_max = 0;\nif (globals.response_max) {\n response_max = JSON.parse(globals.response_max);\n}\nelse {\n response_max = 5009;\n pm.globals.set(\"response_max\", JSON.stringify(response_max));\n};\n\n// Get the max response time allowed.\npm.test('Response time less than ' + response_max.toString() + 'ms', function(){\n pm.expect(pm.response.responseTime).to.be.below(response_max);\n});\n\npm.test(\"Response code for request is 200\", function(){\n pm.response.to.have.status(200);\n});\npm.test('Response header should have Content-Type of application/json', function() {\n pm.response.to.have.header('content-type', 'application/json');\n});\npm.test('Response body be in JSON format', function() {\n pm.response.to.be.json; \n});" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Exam-Type-Data", - "event": [ - { - "listen": "test", - "script": { - "id": "382b7b65-d736-4a03-a44a-3891f33b617d", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"init_exam_type_data\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Finds an exam name in the JSON list allTypes of exam types.\nfunction find_exam(input_exam_name, allTypes) {\n\texam_id_value = -1;\n\n // Loop to look for the input exam name.\n if (allTypes) {\n allTypes.forEach(function(type) {\n if ((type.exam_type_name) == input_exam_name) {\n exam_id_value = type.exam_type_id;\n }\n });\n }\n \n // If the exam wasn't found, set it to be the first exam.\n if (exam_id_value == -1) {\n exam_id_value = allTypes[0].exam_type_id;\n }\n\n // Return the exam_id_type of the input exam name.\n return exam_id_value;\n}\n\n// Get the list of all possible exam types.\nallTypes = null;\nvar jsonData = JSON.parse(responseBody);\nif (jsonData.hasOwnProperty(\"exam_types\")) {\n\tallTypes = jsonData.exam_types;\n}\n\nexam_array = [];\nexam_array.push({name: \"Pesticide\", weight: 40.2, id: find_exam(\"Pesticide\", allTypes)});\nname = \"IPSE - 4HR Single Exam\";\nexam_array.push({name: name, weight: exam_array[0].weight + 14.5, id: find_exam(name, allTypes)});\nname = \"SLE - 3HR Group Exam\";\nexam_array.push({name: name, weight: exam_array[1].weight + 7.4, id: find_exam(name, allTypes)});\nname = \"COFQ - 3HR Group Exam\";\nexam_array.push({name: name, weight: exam_array[2].weight + 5.8, id: find_exam(name, allTypes)});\nname = \"IPSE - 4HR Group Exam\";\nexam_array.push({name: name, weight: exam_array[3].weight + 5.7, id: find_exam(name, allTypes)});\nname = \"COFQ - 3HR Single Exam\";\nexam_array.push({name: name, weight: exam_array[4].weight + 5.5, id: find_exam(name, allTypes)});\nname = \"Monthly Session Exam\";\nexam_array.push({name: name, weight: exam_array[5].weight + 3.8, id: find_exam(name, allTypes)});\nname = \"SLE - 3HR Single Exam\";\nexam_array.push({name: name, weight: exam_array[6].weight + 3.5, id: find_exam(name, allTypes)});\nname = \"Angling Guide Outfitter\";\nexam_array.push({name: name, weight: exam_array[7].weight + 2.4, id: find_exam(name, allTypes)});\nname = \"IPSE - 5HR Single Exam - Time Extension\";\nexam_array.push({name: name, weight: exam_array[8].weight + 2.3, id: find_exam(name, allTypes)});\nname = \"Exam Booking - 3 Hour Miscellaneous\";\nexam_array.push({name: name, weight: exam_array[9].weight + 1.7, id: find_exam(name, allTypes)});\n\n// Store the initialized exam data for later use.\npostman.setEnvironmentVariable(\"exam_array_data\", JSON.stringify(exam_array));" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Exam-Get-Random", - "event": [ - { - "listen": "test", - "script": { - "id": "382b7b65-d736-4a03-a44a-3891f33b617d", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"create_random_functions\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Function returns a weighted randomized exam type index.\nfunction get_random_index(exam_array) {\n\n // Generate a random number up to the maximum weight allowed.\n random_number = Math.floor(Math.random() * exam_array[exam_array.length - 1].weight);\n \n // Get the index of the exam type corresponding to that weight.\n index = get_index(random_number, exam_array);\n\n // Return the index.\n return index;\n}\n\n// Based on a random number, turns it into a weighted randomized exam type index.\nfunction get_index(random_value, exam_array) {\n index = 0;\n var i;\n for (i = 0; i < exam_array.length; i++) {\n if (random_value <= exam_array[i].weight) {\n index = i;\n break;\n }\n }\n \n return index;\n}\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Exam-Data-Check", - "event": [ - { - "listen": "test", - "script": { - "id": "8cebcf78-f5a2-4694-b108-60e146791a78", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"exam_data_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Make sure that jsonData has an exam property.\npm.test(\"Response should have exam property\", function(){\n pm.expect(jsonData.hasOwnProperty(\"exam\")).to.be.true;\n});\n\n// If jsonData has exam property, check data.\nif (jsonData.hasOwnProperty(\"exam\")) {\n\n //Test to see if Event ID field remains unchanged\n pm.test(\"Validate Event Id has expected value\", function(){\n pm.expect(jsonData.event_id === environment.event_id);\n });\n\n //Test to see if exam method field remains unchanged\n pm.test(\"Validate exam method has expected value\", function(){\n pm.expect(jsonData.exam_method === environment.exam_method);\n });\n\n //Test to see if exam name field remains unchanged\n pm.test(\"Validate exam name has expected value\", function(){\n pm.expect(jsonData.exam_name === environment.exam_name);\n });\n\n //Test to see if exam type field remains unchanged\n pm.test(\"Validate exam type id has expected value\", function(){\n pm.expect(jsonData.exam_type_id === environment.random_exam_type_id);\n });\n\n //Test to see if exam written indicator field remains unchanged\n pm.test(\"Validate exam written indicator has expected value\", function(){\n pm.expect(jsonData.exam_written_ind === environment.exam_written_ind);\n });\n\n //Test to see if examinee name field remains unchanged\n pm.test(\"Validate examinee name has expected value\", function(){\n pm.expect(jsonData.examinee_name === environment.examinee_name);\n });\n\n //Test to see if notes field remains unchanged\n pm.test(\"Validate notes has expected value\", function(){\n pm.expect(jsonData.notes === environment.notes);\n });\n\n //Test to see if number of students field remains unchanged\n pm.test(\"Validate number of students has expected value\", function(){\n pm.expect(jsonData.number_of_students === environment.number_of_students);\n });\n\n //Test to see if office id remains unchanged\n pm.test(\"Validate office id has expected value\", function(){\n pm.expect(jsonData.office_id === environment.current_office_id);\n });\n\n //Test to see if offsite location is expected\n pm.test(\"Validate offsite location has expected value\", function(){\n pm.expect(jsonData.offsite_location === environment.offsite_location);\n });\n}\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Exam-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "id": "8cebcf78-f5a2-4694-b108-60e146791a78", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"exam_schema_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the JSON Schema expected in response\nvar examSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"exam\": {\n \"type\": \"object\",\n \"properties\": {\n \"booking_id\": {},\n \"deleted_date\": {},\n \"event_id\": {\"type\": \"string\"},\n \"exam_id\": {\"type\": \"number\"},\n \"exam_method\": {\"type\": \"string\"},\n \"exam_name\": {\"type\": \"string\"},\n \"exam_received_date\": {},\n \"exam_returned_tracking_number\": {},\n \"exam_type\": {\n \"type\": \"object\",\n \"properties\": {\n \"exam_color\": {\"type\": \"string\"},\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_type_name\": {\"type\": \"string\"},\n \"group_exam_ind\": {\"type\": \"number\"},\n \"ita_ind\": {\"type\": \"number\"},\n \"method_type\": {\"type\": \"string\"},\n \"number_of_hours\": {\"type\": \"number\"},\n \"number_of_minutes\": {\"type\": [\"number\", \"null\"]},\n \"pesticide_exam_ind\": {\"type\": \"number\" }\n },\n \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"group_exam_ind\", \"ita_ind\", \"method_type\", \"number_of_hours\", \"number_of_minutes\", \"pesticide_exam_ind\"]\n },\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_written_ind\": {\"type\": \"number\"},\n \"examinee_name\": {\"type\": \"string\"},\n \"expiry_date\": {\"type\": [\"string\", \"null\"]},\n \"notes\": {\"type\": \"string\"},\n \"number_of_students\": {\"type\": \"number\"},\n \"office\":{\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\" },\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\" : \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n },\n },\n \"required\": []\n },\n \"office_id\": {\"type\": \"number\"},\n \"offsite_location\": {},\n \"session_number\": {\"type\": [\"number\", \"null\"]},\n \"booking\": {}\n },\n \"required\": [\"booking\", \"booking_id\", \"deleted_date\", \"event_id\", \"exam_id\", \"exam_method\", \"exam_name\", \"exam_received_date\", \"exam_returned_tracking_number\", \"exam_type\", \"exam_type_id\", \"exam_written_ind\", \"examinee_name\", \"expiry_date\", \"notes\", \"number_of_students\", \"office\", \"office_id\", \"offsite_location\", \"session_number\"]\n }\n },\n \"required\": [\"exam\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Exam Schema\", function(){\n pm.expect(tv4.validate(jsonData, examSchema)).to.be.true;\n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Exam-List-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "id": "8cebcf78-f5a2-4694-b108-60e146791a78", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"exam_schema_list_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the JSON Schema expected in response\nvar examSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"exams\": {\n \"type\": \"array\",\n \"properties\": {\n \"booking_id\": {},\n \"deleted_date\": {},\n \"event_id\": {\"type\": \"string\"},\n \"exam_id\": {\"type\": \"number\"},\n \"exam_method\": {\"type\": \"string\"},\n \"exam_name\": {\"type\": \"string\"},\n \"exam_received_date\": {},\n \"exam_returned_tracking_number\": {},\n \"exam_type\": {\n \"type\": \"object\",\n \"properties\": {\n \"exam_color\": {\"type\": \"string\"},\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_type_name\": {\"type\": \"string\"},\n \"group_exam_ind\": {\"type\": \"number\"},\n \"ita_ind\": {\"type\": \"number\"},\n \"method_type\": {\"type\": \"string\"},\n \"number_of_hours\": {\"type\": \"number\"},\n \"number_of_minutes\": {\"type\": \"number\"},\n \"pesticide_exam_ind\": {\"type\": \"number\" }\n },\n \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"group_exam_ind\", \"ita_ind\", \"method_type\", \"number_of_hours\", \"number_of_minutes\", \"pesticide_exam_ind\"]\n },\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_written_ind\": {\"type\": \"number\"},\n \"examinee_name\": {\"type\": \"string\"},\n \"expiry_date\": {\"type\": [\"string\", \"null\"]},\n \"notes\": {\"type\": \"string\"},\n \"number_of_students\": {\"type\": \"number\"},\n \"office\":{\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\" },\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\" : \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n },\n },\n \"required\": []\n },\n \"office_id\": {\"type\": \"number\"},\n \"offsite_location\": {},\n \"session_number\": {\"type\": [\"number\", \"null\"]},\n \"booking\": {}\n },\n \"required\": [\"booking\", \"booking_id\", \"deleted_date\", \"event_id\", \"exam_id\", \"exam_method\", \"exam_name\", \"exam_received_date\", \"exam_returned_tracking_number\", \"exam_type\", \"exam_type_id\", \"exam_written_ind\", \"examinee_name\", \"expiry_date\", \"notes\", \"number_of_students\", \"office\", \"office_id\", \"offsite_location\", \"session_number\"]\n }\n },\n \"required\": [\"exams\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Exam List Schema\", function(){\n pm.expect(tv4.validate(jsonData, examSchema)).to.be.true;\n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Booking-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "id": "8cebcf78-f5a2-4694-b108-60e146791a78", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"booking_schema_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the JSON Schema expected in response\nvar bookingSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"booking\": {\n \"type\": \"object\",\n \"properties\": {\n \"blackout_flag\": {\"type\": \"string\"},\n \"blackout_notes\": {\"type\": [\"string\", \"null\"]},\n \"booking_contact_information\": {\"type\": [\"string\", \"null\"]},\n \"booking_id\": {\"type\": \"number\"},\n \"booking_name\": {\"type\": [\"string\", \"null\"]},\n \"end_time\": {\"type\": \"string\"},\n \"fees\": {\"type\": \"string\"},\n \"invigilators\": {\"type\": \"array\"},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"timezone\": {}\n },\n \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"timezone\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"recurring_uuid\": {\"type\": [\"string\", \"null\"]},\n \"room\": {\n \"type\": \"object\",\n \"properties\": {\n \"capacity\": {\"type\": \"number\"},\n \"color\": {\"type\": \"string\"},\n \"deleted\": {\"type\": [\"string\", \"null\"]},\n \"room_id\": {\"type\": \"number\"},\n \"room_name\": {\"type\": \"string\"}\n },\n \"required\": [\"capacity\", \"color\", \"room_id\", \"room_name\", \"deleted\"]\n },\n \n \"room_id\": {\"type\": \"number\"},\n \"sbc_staff_invigilated\": {\"type\": \"number\"},\n \"shadow_invigilator_id\": {\"type\": [\"number\", \"null\"]},\n \"start_time\": {\"type\": \"string\"}\n },\n \"required\": [\"blackout_flag\", \"blackout_notes\", \"booking_contact_information\", \"booking_id\",\n \"booking_name\", \"end_time\", \"fees\", \"invigilators\", \"office\", \"office_id\",\n \"recurring_uuid\", \"room\", \"room_id\", \"sbc_staff_invigilated\", \"shadow_invigilator_id\",\n \"start_time\"]\n },\n \"errors\": { \"type\": \"object\" }\n },\n \"required\": [\"booking\", \"errors\"]\n}\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Booking Schema\", function(){\n pm.expect(tv4.validate(jsonData, bookingSchema)).to.be.true;\n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Booking-Data-Check", - "event": [ - { - "listen": "test", - "script": { - "id": "8cebcf78-f5a2-4694-b108-60e146791a78", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"booking_data_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Make sure that jsonData has an booking property.\npm.test(\"Response should have booking property\", function(){\n pm.expect(jsonData.hasOwnProperty(\"booking\")).to.be.true;\n});\n\n// If jsonData has booking property, check data.\nif (jsonData.hasOwnProperty(\"booking\")) {\n\n //Test to see if booking name has expected value\n pm.test(\"Validate Booking Name has expected value\", function(){\n pm.expect(jsonData.booking_name === environment.booking_name);\n });\n\n //Test to see if start time has expected value\n pm.test(\"Validate start time has expected value\", function(){\n pm.expect(jsonData.start_time === environment.start_time);\n });\n\n //Test to see if end time has expected value\n pm.test(\"Validate end time has expected value\", function(){\n pm.expect(jsonData.end_time === environment.end_time);\n });\n\n //Test to see if room id has expected value\n pm.test(\"Validate room id has expected value\", function(){\n pm.expect(jsonData.room_id === environment.room_id_1);\n });\n\n //Test to see if fees field has expected value\n pm.test(\"Validate fees has expected value\", function(){\n pm.expect(jsonData.fees === environment.fees);\n });\n\n //Test to see if office id field has expected value\n pm.test(\"Validate office id has expected value\", function(){\n pm.expect(jsonData.office_id === environment.current_office_id);\n });\n}\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Booking-List-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "id": "8cebcf78-f5a2-4694-b108-60e146791a78", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"booking_list_schema_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "var bookingSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"bookings\": {\n \"type\": \"array\",\n \"properties\": {\n \"booking_contact_information\": {},\n \"booking_id\": {\"type\": \"number\"},\n \"booking_name\": {\"type\": \"string\"},\n \"end_time\": {\"type\": \"string\"},\n \"fees\": {\"type\": \"string\"},\n \"invigilator\": {},\n \"invigilator_id\": {},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"sb_id\": {\"type\": \"number\"},\n \"timezone\": {}\n },\n \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"sb\", \"sb_id\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"room\": {\n \"type\": \"object\",\n \"properties\": {\n \"capacity\": {\"type\": \"number\"},\n \"color\": {\"type\": \"string\"},\n \"room_id\": {\"type\": \"number\"},\n \"room_name\": {\"type\": \"string\"}\n },\n \"required\": [\"capacity\", \"color\", \"room_id\", \"room_name\"]\n },\n \"room_id\": {\"type\": \"number\"},\n \"start_time\": {\"type\": \"string\"},\n },\n \"required\": [\"booking_contact_information\", \"booking_id\", \"booking_name\", \"end_time\", \"fees\", \"room\", \"room_id\", \"start_time\", \"invigilator_id\", \"office\", \"office_id\"]\n },\n \"errors\": {\n \"type\": \"object\",\n \"properties\": {}\n }\n },\n \"required\": [\"bookings\", \"errors\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Booking List Schema\", function(){\n pm.expect(tv4.validate(jsonData, bookingSchema)).to.be.true;\n});" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "Who am I TheQ", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "if (jsonData.hasOwnProperty(\"csr\")) {", - "\tcurrentOfficeId = jsonData.csr.office_id;", - "\tcurrentOfficeNumber = jsonData.csr.office.office_number;", - "\tcurrentCsrId = jsonData.csr.csr_id;", - " postman.setEnvironmentVariable(\"current_office_id\", currentOfficeId);", - " postman.setEnvironmentVariable(\"current_office_number\", currentOfficeNumber);", - " postman.setEnvironmentVariable(\"current_csr_id\", currentCsrId);", - "};", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}csrs/me/", - "host": [ - "{{url}}csrs" - ], - "path": [ - "me", - "" - ] - } - }, - "response": [] - }, - { - "name": "Get Room IDs", - "event": [ - { - "listen": "test", - "script": { - "id": "859ae114-22c4-4f3e-9f1f-9f0e06fbc29d", - "exec": [ - "// Define the JSON Schema expected in response", - "var roomSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"rooms\": {", - " \"type\": \"array\",", - " \"properties\": {", - " \"capacity\": {\"type\": \"number\"},", - " \"color\": {\"type\": \"string\"},", - " \"office\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"office_id\": {\"type\": \"number\"},", - " \"office_name\": {\"type\": \"string\"},", - " \"office_number\": {\"type\": \"number\"},", - " \"sb\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"sb_id\": {\"type\": \"number\"},", - " \"sb_type\": {\"type\": \"string\"}", - " },", - " \"required\": [\"sb_id\", \"sb_type\"]", - " },", - " \"sb_id\": {\"type\": \"number\"} ", - " },", - " \"required\": [\"office_id\", \"office_name\", \"office_number\", \"sb\", \"sb_id\"]", - " }", - " },", - " \"required\": [\"capacity\", \"color\", \"office\", \"room_id\", \"room_name\"]", - " }", - " }", - "};", - "", - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Get the max response time allowed.", - "var response_max = JSON.parse(globals.response_max);", - "", - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate Response Room Schema\", function(){", - " pm.expect(tv4.validate(jsonData, roomSchema)).to.be.true;", - "});", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "if (jsonData.hasOwnProperty(\"rooms\")) {", - " console.log(\"==> Rooms\");", - " room_id_1 = jsonData.rooms[0].room_id;", - " room_id_2 = room_id_1;", - " if (jsonData.rooms.length > 1) {", - " room_id_2 = jsonData.rooms[1].room_id;", - " }", - " postman.setEnvironmentVariable(\"room_id_1\", JSON.stringify(room_id_1.toString()));", - " postman.setEnvironmentVariable(\"room_id_2\", JSON.stringify(room_id_2.toString()));", - "}", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "462566f5-d6cd-4c14-9b11-0cbf7abc0caf", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}rooms/", - "host": [ - "{{url}}rooms" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Get Service IDs", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "d01c3826-dc28-4cce-957b-ec70d0393e7e", - "exec": [ - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "3b11031e-4031-4569-91f2-49e23517ffee", - "exec": [ - "// Run basic tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "var schema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"services\": {", - " \"type\": \"array\",", - " \"properties\": {", - " \"display_dashboard_ind\" : {", - " \"type\" : \"number\"", - " },", - " \"deleted\" : {", - " \"type\" : [\"object\", \"null\"]", - " },", - " \"actual_service_ind\" : {", - " \"type\" : \"number\"", - " },", - " \"service_id\" : {", - " \"type\" : [\"number\", \"object\"]", - " },", - " \"service_code\" : {", - " \"type\" : \"string\"", - " },", - " \"prefix\" : {", - " \"type\" : \"string\"", - " },", - " \"service_name\" : {", - " \"type\" : \"string\"", - " },", - " \"parent_id\" : {", - " \"type\" : [\"object\", \"number\", \"null\" ]", - " },", - " \"service_desc\" : {", - " \"type\" : \"string\"", - " }", - " },", - " \"required\" : [\"display_dashboard_ind\", \"deleted\", \"actual_service_ind\", \"service_id\", \"service_code\",", - " \"prefix\", \"service_name\", \"parent_id\", \"service_desc\"]", - " }", - " }", - "};", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate Service Schema\", function(){", - " pm.expect(tv4.validate(jsonData, schema)).to.be.true;", - "});", - "", - "// Loop to validate schema of each channel.", - "var allElements = jsonData.services;", - "var elementCount = 0;", - "var elementMax = Math.min(10, allElements.length);", - "//allElements.forEach(function(element) {", - "for (var currentElement = 0; currentElement < elementMax; currentElement++) {", - " element = allElements[currentElement];", - " elementCount ++;", - " var testTitle = \"Service (\" + elementCount + \"): \" + element.service_name;", - " pm.test(\"Validate Schema for \" + testTitle, function(){", - " pm.expect(tv4.validate(element, schema)).to.be.true;", - " });", - " ", - " // Test the authenticate response.", - " pm.test(\"--> \" + testTitle + \" dashboard_ind must be 0 or 1\", function() {", - " pm.expect(element.display_dashboard_ind).to.be.within(0,1);", - " });", - " pm.test(\"--> \" + testTitle + \" actual_service_ind must be 1\", function() {", - " pm.expect(element.actual_service_ind).to.be.eql(1);", - " });", - " pm.test(\"--> \" + testTitle + \" parent_id must not be null\", function() {", - " pm.expect(element.parent_id).to.not.be.null;", - " });", - "}", - "", - "// Declare and initialize variables.", - "var mspId = 0;", - "var taxId = 0;", - "var mspText = \"Payment - MSP\";", - "var propTaxText = \"Other - PTAX\";", - "", - "// Look for the MSP and Property Tax IDs.", - "allElements.forEach(function(element) {", - " if (element.service_name === mspText) {", - " mspId = element.service_id;", - " }", - " if (element.service_name === propTaxText) {", - " taxId = element.service_id;", - " }", - "});", - "", - "// Check that you found the service IDs.", - "pm.test(\"The \" + mspText + \" service ID (\" + mspId.toString() + \") should not equal 0\", function() {", - " pm.expect(mspId).to.not.be.eql(0);", - "});", - "", - "pm.test(\"The \" + propTaxText + \" service ID (\" + taxId.toString() + \") should not equal 0\", function() {", - " pm.expect(taxId).to.not.be.eql(0);", - "});", - "", - "// Store these IDs for future use.", - "postman.setEnvironmentVariable(\"service_MSP_id\", JSON.stringify(mspId));", - "postman.setEnvironmentVariable(\"service_PropTax_id\", JSON.stringify(taxId));" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}services/", - "host": [ - "{{url}}services" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Get Exam Types", - "item": [ - { - "name": "Exam Type List", - "event": [ - { - "listen": "test", - "script": { - "id": "2df2a851-6a71-48e6-b44f-ccf096fe9d83", - "exec": [ - "// Define the JSON Schema expected in response", - "var examTypeSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"exam_color\": {\"type\": \"string\"},", - " \"exam_type_id\": {\"type\": \"number\"},", - " \"exam_type_name\": {\"type\": \"string\"},", - " \"ita_ind\": {\"type\": \"number\"},", - " \"method_type\": {\"type\": \"string\"},", - " \"number_of_hours\": {\"type\": \"number\"},", - " \"group_exam_ind\": {\"type\": \"number\"}", - " },", - " \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"ita_ind\", \"method_type\", \"number_of_hours\", \"group_exam_ind\"]", - " },", - " \"required\": []", - "}; ", - "", - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate Response Exam Type Schema\", function(){", - " pm.expect(tv4.validate(jsonData, examTypeSchema)).to.be.true;", - "});", - "", - "// Store all exam type IDs for future use in adding exams", - "var allExamIds = [];", - "", - "// Make sure some data returned.", - "pm.test(\"Response has exam_types property\", function(){", - " pm.expect(jsonData.hasOwnProperty(\"exam_types\")).to.be.true;", - "});", - "pm.test(\"Response has at least one exam_type\", function(){", - " pm.expect(jsonData.exam_types.length).to.be.above(0);", - "});", - "", - "// Set up list of valid exam types, create random functions.", - "eval(environment.init_exam_type_data);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}exam_types/", - "host": [ - "{{url}}exam_types" - ], - "path": [ - "" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Exams", - "item": [ - { - "name": "Exam Post End-point", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Get exam type data and functions.", - "exam_array = JSON.parse(postman.getEnvironmentVariable(\"exam_array_data\"));", - "eval(environment.create_random_functions);", - "", - "// Create an event number based on the time.", - "var ms = (new Date().getTime()).toString() + \"00\";", - "eventNumber = Number(ms.substring(ms.length-6, ms.len)) + 1;", - "postman.setEnvironmentVariable(\"event_number\", eventNumber);", - "", - "// Update the next event ID.", - "var eventId = \"pm\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", 0);", - "postman.setEnvironmentVariable(\"event_id\", JSON.stringify(eventId));", - "postman.setEnvironmentVariable(\"event_delete\", eventId);", - "", - "// Calculate a random exam type to use.", - "random_index = get_random_index(exam_array);", - "", - "// Store for use.", - "random_exam_type_id = exam_array[random_index].id;", - "postman.setEnvironmentVariable(\"random_exam_type_id\", JSON.stringify(random_exam_type_id.toString()));", - "", - "// Store other variables for later use.", - "postman.setEnvironmentVariable(\"exam_method\", JSON.stringify(\"paper\"));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"Postman Group Exam Name\"));", - "postman.setEnvironmentVariable(\"exam_written_ind\", JSON.stringify(\"0\"));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"Postman Examinee Name\"));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"Postman Test Notes\"));", - "postman.setEnvironmentVariable(\"number_of_students\", JSON.stringify(\"19\"));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"Postman test location\"));", - "", - "// Calculate an expiry date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+7);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format expiry date for the exam.", - "expiry_date = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", - "", - "// Store globals.", - "pm.globals.set(\"expiry_date\", JSON.stringify(expiry_date));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "// Get the max response time allowed.", - "var response_max = JSON.parse(globals.response_max);", - "", - "// Check Response code for request", - "pm.test(\"Response code for request is 201\", function(){", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.exam_schema_check);", - "eval(environment.exam_data_check);", - "", - "// If jsonData has an exam property, save exam ID.", - "if (jsonData.hasOwnProperty(\"exam\")) {", - "\tcurrentExamId = jsonData.exam.exam_id;", - " postman.setEnvironmentVariable(\"current_exam_id\", currentExamId);", - "}", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}", - "type": "text" - }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\n\t\"event_id\" : {{event_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : \"Postman Group Exam Name\",\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : \"Pm examinee name\",\n \"notes\" : \"Pm sample notes\",\n \"number_of_students\" : \"19\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : \"Pm test location\",\n \"expiry_date\": {{expiry_date}}\n}" - }, - "url": { - "raw": "{{url}}exams/", - "host": [ - "{{url}}exams" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Exam Detail End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "5206f620-8220-4ba4-860a-13c1bb452e6d", - "exec": [ - "// Get the max response time allowed.", - "var response_max = JSON.parse(globals.response_max);", - "", - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.exam_schema_check);", - "eval(environment.exam_data_check);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Exam List End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "2a7432b9-ffb0-4e23-a224-c3a48171d6c4", - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.exam_schema_list_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}exams/", - "host": [ - "{{url}}exams" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Exam Put End-point", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"number_of_students\", JSON.stringify(\"21\"));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "// Get the max response time allowed.", - "var response_max = JSON.parse(globals.response_max);", - "", - "// Check Response code for request", - "pm.test(\"Response code for request is 201\", function(){", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.exam_schema_check);", - "eval(environment.exam_data_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : {{exam_method}},\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : {{exam_written_ind}},\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}\n" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Exam Detail End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "3efcb554-1e5a-4e0a-91b8-aa32eb14a5e6", - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.exam_schema_check);", - "eval(environment.exam_data_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Exam Delete End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "88b43898-330f-4cf1-81c3-8cce3c53f54c", - "exec": [ - "// Get the max response time allowed.", - "var response_max = JSON.parse(globals.response_max);", - "", - "// Check Response code for request", - "pm.test(\"Response code for request is 204\", function(){", - " pm.response.to.have.status(204);", - "});", - "", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "DELETE", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Exams Export", - "item": [ - { - "name": "Exams Export List", - "event": [ - { - "listen": "test", - "script": { - "id": "9e02fbaf-627e-43db-b516-226b1a2874e8", - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time less than 20,000ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(20000);", - "});" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "caf977c6-da22-4f6c-b0c9-ca5f0fc3ec29", - "exec": [ - "// Calculate a start date four weeks prior to today.", - "var start = new Date();", - "start.setDate(start.getDate()-28);", - "", - "// Get year, day, month from the start time.", - "start_year = start.getFullYear().toString();", - "start_month = (\"0\" + (start.getMonth() + 1).toString()).slice(-2);", - "start_day = (\"0\" + (start.getDate()).toString()).slice(-2);", - "start_date = start_year + \"-\" + start_month + \"-\" + start_day;", - "", - "// Get year, day, month from the current day.", - "var today = new Date();", - "end_year = today.getFullYear().toString();", - "end_month = (\"0\" + (today.getMonth() + 1).toString()).slice(-2);", - "end_day = (\"0\" + (today.getDate()).toString()).slice(-2);", - "end_date = end_year + \"-\" + end_month + \"-\" + end_day;", - "", - "console.log(\"Start: \" + start_date);", - "console.log(\"End: \" + end_date);", - "pm.globals.set(\"start_date\", start_date);", - "pm.globals.set(\"end_date\", end_date);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}exams/export/?start_date={{start_date}}&end_date={{end_date}}", - "host": [ - "{{url}}exams" - ], - "path": [ - "export", - "" - ], - "query": [ - { - "key": "start_date", - "value": "{{start_date}}" - }, - { - "key": "end_date", - "value": "{{end_date}}" - } - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Exam Types", - "item": [ - { - "name": "Exam Type List End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "2df2a851-6a71-48e6-b44f-ccf096fe9d83", - "exec": [ - "// Define the JSON Schema expected in response", - "var examTypeSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"exam_color\": {\"type\": \"string\"},", - " \"exam_type_id\": {\"type\": \"number\"},", - " \"exam_type_name\": {\"type\": \"string\"},", - " \"ita_ind\": {\"type\": \"number\"},", - " \"method_type\": {\"type\": \"string\"},", - " \"number_of_hours\": {\"type\": \"number\"},", - " \"group_exam_ind\": {\"type\": \"number\"}", - " },", - " \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"ita_ind\", \"method_type\", \"number_of_hours\", \"group_exam_ind\"]", - " },", - " \"required\": []", - "}; ", - "", - "// Get the max response time allowed.", - "var response_max = JSON.parse(globals.response_max);", - "", - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate Response Exam Type Schema\", function(){", - " pm.expect(tv4.validate(jsonData, examTypeSchema)).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}exam_types/", - "host": [ - "{{url}}exam_types" - ], - "path": [ - "" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Bookings", - "item": [ - { - "name": "Booking Post End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "a4099862-1c9a-48f7-adbf-0240e6eb185a", - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 201\", function(){", - " pm.response.to.have.status(201);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "", - "var booking_id = jsonData.booking.booking_id;", - "", - "//Dynamic variable used for end-point testing later on", - "postman.setEnvironmentVariable(\"booking_id\", JSON.stringify(booking_id));" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "4df5dedd-4976-4cdc-b2be-739b2028cdc4", - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+7);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format starting and ending time for the booking.", - "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", - "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", - "", - "// Store globals.", - "pm.globals.set(\"start_time\", JSON.stringify(start_time));", - "pm.globals.set(\"end_time\", JSON.stringify(end_time));", - "pm.globals.set(\"fees\", JSON.stringify(\"false\"));", - "pm.globals.set(\"booking_name\", JSON.stringify(\"Super big demo next week\"));", - "pm.globals.set(\"room_id\", pm.environment.get(\"room_id_1\"));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"room_id\": {{room_id}},\n \"fees\": {{fees}},\n \"booking_name\": {{booking_name}},\n \"office_id\" : {{current_office_id}}\n}\n" - }, - "url": { - "raw": "{{url}}bookings/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Booking Detail End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "232f5232-de75-4f55-b999-2e39e39a12a8", - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}bookings/{{booking_id}}/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "{{booking_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Booking List End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "59fc7e18-6df0-48d9-822c-6518fbece309", - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_list_schema_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}bookings/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Booking Put End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "b127046f-b399-4e66-b76f-b6e79268b8ce", - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "9bde67e2-8eeb-4e50-90bf-caff1fef90a4", - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+7);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format starting and ending time for the booking.", - "start_time = year + \"-\" + month + \"-\" + day + \"T21:00:00Z\";", - "end_time = year + \"-\" + month + \"-\" + day + \"T23:00:00Z\";", - "", - "pm.globals.set(\"start_time\", JSON.stringify(start_time));", - "pm.globals.set(\"end_time\", JSON.stringify(end_time));", - "pm.globals.set(\"fees\", JSON.stringify(\"true\"));", - "pm.globals.set(\"booking_name\", JSON.stringify(\"Time to pay your fees!\"));", - "pm.globals.set(\"room_id\", pm.environment.get(\"room_id_2\"));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"room_id\": {{room_id}},\n \"fees\": {{fees}},\n \"booking_name\": {{booking_name}},\n \"office_id\" : {{current_office_id}}\n}" - }, - "url": { - "raw": "{{url}}bookings/{{booking_id}}/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "{{booking_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Booking Detail End-point Again", - "event": [ - { - "listen": "test", - "script": { - "id": "b5e53be0-ddda-4c99-b563-5a3b449e0f79", - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.booking_schema_check);", - "eval(environment.booking_data_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}bookings/{{booking_id}}/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "{{booking_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Booking Delete End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "1e7c1d71-ea74-4a78-9ef2-ee9a7a47d915", - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 204\", function(){", - " pm.response.to.have.status(204);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "DELETE", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}bookings/{{booking_id}}/", - "host": [ - "{{url}}bookings" - ], - "path": [ - "{{booking_id}}", - "" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Invigilators", - "item": [ - { - "name": "Invigilator List End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "0e68858e-985c-4fb0-bca6-04d33f65c28d", - "exec": [ - "// Define the JSON Schema expected in response", - "var invigilatorSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"invigilators\": {", - " \"type\": \"array\",", - " \"properties\": {", - " \"contact_email\": {\"type\": \"string\"},", - " \"contact_phone\": {\"type\": \"string\"},", - " \"contract_expiry_date\": {\"type\": \"string\"},", - " \"contract_number\": {\"type\": \"string\"},", - " \"invigilator_id\": {\"type\": \"number\"},", - " \"invigilator_name\": {\"type\": \"string\"},", - " \"invigilator_notes\": {\"type\": \"string\"},", - " \"office\":{", - " \"type\": \"object\",", - " \"properties\": {", - " \"office_id\": {\"type\": \"number\"},", - " \"office_name\": {\"type\": \"string\"},", - " \"office_number\": {\"type\": \"number\"},", - " \"sb\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"sb_id\": {\"type\": \"number\"},", - " \"sb_type\": {\"type\": \"string\"}", - " },", - " \"required\": [\"sb_id\", \"sb_type\"]", - " }", - " },", - " \"required\": [\"office_id\", \"office_name\", \"office_number\", \"sb\", \"sb_id\"]", - " }", - " },", - " \"required\": [\"contact_email\", \"contact_phone\", \"contract_expiry_date\", \"contract_number\", \"invigilator_id\", \"invigilator_name\", \"invigilator_notes\", \"office\"]", - " }", - " }", - "};", - "", - "// Get the max response time allowed.", - "var response_max = JSON.parse(globals.response_max);", - "", - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate Response Invigilator Schema\", function(){", - " pm.expect(tv4.validate(jsonData, invigilatorSchema)).to.be.true;", - "});", - "", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}invigilators/", - "host": [ - "{{url}}invigilators" - ], - "path": [ - "" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Rooms", - "item": [ - { - "name": "Room List End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "859ae114-22c4-4f3e-9f1f-9f0e06fbc29d", - "exec": [ - "// Define the JSON Schema expected in response", - "var roomSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"rooms\": {", - " \"type\": \"array\",", - " \"properties\": {", - " \"capacity\": {\"type\": \"number\"},", - " \"color\": {\"type\": \"string\"},", - " \"office\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"office_id\": {\"type\": \"number\"},", - " \"office_name\": {\"type\": \"string\"},", - " \"office_number\": {\"type\": \"number\"},", - " \"sb\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"sb_id\": {\"type\": \"number\"},", - " \"sb_type\": {\"type\": \"string\"}", - " },", - " \"required\": [\"sb_id\", \"sb_type\"]", - " },", - " \"sb_id\": {\"type\": \"number\"} ", - " },", - " \"required\": [\"office_id\", \"office_name\", \"office_number\", \"sb\", \"sb_id\"]", - " }", - " },", - " \"required\": [\"capacity\", \"color\", \"office\", \"room_id\", \"room_name\"]", - " }", - " }", - "};", - "", - "// Get the max response time allowed.", - "var response_max = JSON.parse(globals.response_max);", - "", - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate Response Room Schema\", function(){", - " pm.expect(tv4.validate(jsonData, roomSchema)).to.be.true;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}rooms/", - "host": [ - "{{url}}rooms" - ], - "path": [ - "" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "CSRS", - "item": [ - { - "name": "CSRS Me Get End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "1ed052a0-06cc-45c7-ae49-b19b96e02d51", - "exec": [ - "// Define the JSON Schema expected in response", - "var CSRSSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"csr\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"csr_id\": {\"type\": \"number\"},", - " \"csr_state\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"csr_state_desc\": {\"type\": \"string\"},", - " \"csr_state_id\": {\"type\": \"number\"},", - " \"csr_state_name\": {\"type\": \"string\"}", - " },", - " \"required\": [\"csr_state_desc\", \"csr_state_id\", \"csr_state_name\"]", - " },", - " \"csr_state_id\": {\"type\": \"number\"},", - " \"deleted\": {},", - " \"finance_designate\": {\"type\": \"number\"},", - " \"office_manager\": {\"type\": \"number\"},", - " \"ita2_designate\": {\"type\": \"number\"},", - " \"office\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"appointments_enabled_ind\": {\"type\": \"number\"},", - " \"back_office_list\": {", - " \"type\": \"array\",", - " \"properties\": {", - " \"actual_service_ind\": {\"type\": \"number\"},", - " \"deleted\": {},", - " \"display_dashboard_ind\": {\"type\": \"number\"},", - " \"parent\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"service_name\": {\"type\": \"string\"}", - " },", - " \"required\": [\"service_name\"]", - " },", - " \"parent_id\": {\"type\": \"number\"},", - " \"prefix\": {\"type\": \"string\"},", - " \"service_code\": {\"type\": \"string\"},", - " \"service_desc\": {\"type\": \"string\"},", - " \"service_id\": {\"type\": \"number\"},", - " \"service_name\": {\"type\": \"string\"},", - " },", - " \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\", \"parent\",", - " \"parent_id\", \"prefix\", \"service_code\", \"service_desc\", \"service_id\",", - " \"service_name\"]", - " },", - " \"counters\": {", - " \"type\": \"array\",", - " \"properties\": {", - " \"counter_id\": {\"type\": \"number\"},", - " \"counter_name\": {\"type\": \"string\"}", - " },", - " \"required\": [\"counter_id\", \"counter_name\"]", - " },", - " \"exams_enabled_ind\": {\"type\": \"number\"},", - " \"office_id\": {\"type\": \"number\"},", - " \"office_name\": {\"type\": \"string\"},", - " \"office_number\": {\"type\": \"number\"},", - " \"quick_list\": {", - " \"type\": \"array\",", - " \"properties\": {", - " \"actual_service_ind\": {\"type\": \"number\"},", - " \"deleted\": {},", - " \"display_dashboard_ind\": {\"type\": \"number\"},", - " \"parent\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"service_name\": {\"type\": \"string\"}", - " },", - " \"required\": [\"service_name\"]", - " },", - " \"parent_id\": {\"type\": \"number\"},", - " \"prefix\": {\"type\": \"string\"},", - " \"service_code\": {\"type\": \"string\"},", - " \"service_desc\": {\"type\": \"string\"},", - " \"service_id\": {\"type\": \"number\"},", - " \"service_name\": {\"type\": \"string\"},", - " },", - " \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\", \"parent\",", - " \"parent_id\", \"prefix\", \"service_code\", \"service_desc\", \"service_id\",", - " \"service_name\"]", - " },", - " \"sb\":{", - " \"type\": \"object\",", - " \"properties\": {", - " \"sb_id\": {\"type\": \"number\"},", - " \"sb_type\": {\"type\": \"string\"}", - " },", - " \"required\": [\"sb_id\", \"sb_type\"]", - " },", - " \"sb_id\": {\"type\": \"number\"},", - " \"timezone\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"timezone_id\": {\"type\": \"number\"},", - " \"timezone_name\": {\"type\": \"string\"}", - " },", - " \"required\": [\"timezone_id\", \"timezone_name\"]", - " }", - " },", - " \"required\": [\"appointments_enabled_ind\", \"back_office_list\", \"counters\",", - " \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\",", - " \"quick_list\", \"sb\", \"sb_id\", ]", - " },", - " \"office_id\": {\"type\": \"number\"},", - " \"pesticide_designate\": {\"type\": \"number\"},", - " \"qt_xn_csr_ind\": {\"type\": \"number\"},", - " \"receptionist_ind\": {\"type\": \"number\"},", - " \"role\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"role_code\": {\"type\": \"string\"},", - " \"role_desc\": {\"type\": \"string\"},", - " \"role_id\": {\"type\": \"number\"}", - " },", - " \"required\": [\"role_code\", \"role_desc\", \"role_id\"]", - " },", - " \"role_id\": {\"type\": \"number\"},", - " \"username\": {\"type\": \"string\"}", - " },", - " },", - " \"attention_needed\": {\"type\": \"boolean\"},", - " \"active_citizens\" : {\"type\": \"array\"},", - " \"back_office_display\": {\"type\": \"string\"},", - " \"recurring_feature_flag\": {\"type\": \"string\"}", - " },", - " \"required\": [\"csr\", \"attention_needed\", \"active_citizens\", \"back_office_display\", \"recurring_feature_flag\"]", - "};", - "", - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate Response CSRs Schema\", function(){", - " pm.expect(tv4.validate(jsonData, CSRSSchema)).to.be.true;", - "});" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "1c4020cd-fb05-478c-b908-3197c80d492e", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}csrs/me/", - "host": [ - "{{url}}csrs" - ], - "path": [ - "me", - "" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Offices", - "item": [ - { - "name": "Office List End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "ad6ffb6d-efad-4e11-b4a9-99e49f457bbd", - "exec": [ - "// Define the JSON Schema expected in response", - "var officeSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"offices\": {", - " \"type\": \"array\",", - " \"properties\": {", - " \"exams_enabled\": {\"type\": \"number\"},", - " \"office_id\": {\"type\": \"number\"},", - " \"office_name\": {\"type\": \"string\"},", - " \"office_number\": {\"type\": \"number\"},", - " \"sb\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"sb_id\": {\"type\": \"number\"},", - " \"sb_type\": {\"type\": \"string\"}", - " },", - " \"required\": [\"sb_id\", \"sb_type\"]", - " },", - " \"sb_id\": {\"type\": \"number\"}", - " },", - " \"required\": [\"exams_enabled\", \"office_id\", \"office_name\", \"office_number\", \"sb\", \"sb_id\"]", - " }", - " }", - "};", - "", - "// Get the max response time allowed.", - "var response_max = JSON.parse(globals.response_max);", - "", - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate Response Office Schema\", function(){", - " pm.expect(tv4.validate(jsonData, officeSchema)).to.be.true;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}offices/", - "host": [ - "{{url}}offices" - ], - "path": [ - "" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Appointments", - "item": [ - { - "name": "Appointment Post End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "851b530c-92d7-482c-9e80-2a1f542b280c", - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 201\", function(){", - " pm.response.to.have.status(201);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "eval(environment.appointment_data_check);", - "", - "var appointment_id = jsonData.appointment.appointment_id;", - "", - "//Dynamic variable used for end-point testing later on", - "postman.setEnvironmentVariable(\"appointment_id\", JSON.stringify(appointment_id));" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "e8444129-3a7b-4a2f-82d0-fd9b5d395f0d", - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+7);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format starting and ending time for the booking.", - "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", - "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", - "", - "pm.globals.set(\"start_time\", JSON.stringify(start_time));", - "pm.globals.set(\"end_time\", JSON.stringify(end_time));", - "pm.globals.set(\"category\", JSON.stringify(\"Exam\"));", - "pm.globals.set(\"comments\", JSON.stringify(\"Missed playoffs, needs to talk #1.\"));", - "pm.globals.set(\"citizen_name\", JSON.stringify(\"LeBron James Appointment #1\"));", - "pm.globals.set(\"service_id\", pm.environment.get(\"service_PropTax_id\"));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"service_id\": {{service_id}},\n \"office_id\" : {{current_office_id}},\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"category\": {{category}},\n \"comments\": {{comments}},\n \"citizen_name\": {{citizen_name}}\n}" - }, - "url": { - "raw": "{{url}}appointments/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Appointment Detail End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "5206f620-8220-4ba4-860a-13c1bb452e6d", - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "eval(environment.appointment_data_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}appointments/{{appointment_id}}/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "{{appointment_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Appointment List End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "2a7432b9-ffb0-4e23-a224-c3a48171d6c4", - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid\\", - "eval(environment.appointment_list_schema_check);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}appointments/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Appointment Put End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "1cf958af-12dd-44f4-a624-d070cc6d90cb", - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "eval(environment.appointment_schema_check);", - "eval(environment.appointment_data_check);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "52ba16f8-f08e-4a75-a64c-39e59c64c1c6", - "exec": [ - "// Calculate a start date a week from today.", - "var later = new Date();", - "later.setDate(later.getDate()+7);", - "", - "// Get year, day, month from the later time.", - "year = later.getFullYear().toString();", - "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", - "day = (\"0\" + (later.getDate()).toString()).slice(-2);", - "", - "// Format starting and ending time for the booking.", - "start_time = year + \"-\" + month + \"-\" + day + \"T21:00:00Z\";", - "end_time = year + \"-\" + month + \"-\" + day + \"T23:00:00Z\";", - "", - "pm.globals.set(\"start_time\", JSON.stringify(start_time));", - "pm.globals.set(\"end_time\", JSON.stringify(end_time));", - "pm.globals.set(\"comments\", JSON.stringify(\"super EARLY\"));" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"office_id\" : {{current_office_id}},\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"category\": {{category}},\n \"comments\": {{comments}}\n}" - }, - "url": { - "raw": "{{url}}appointments/{{appointment_id}}/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "{{appointment_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Appointment Delete End-point", - "event": [ - { - "listen": "test", - "script": { - "id": "88b43898-330f-4cf1-81c3-8cce3c53f54c", - "exec": [ - "// Check Response code for request", - "pm.test(\"Response code for request is 204\", function(){", - " pm.response.to.have.status(204);", - "});", - "", - "// Check if response time less than max allowed.", - "var response_max = JSON.parse(globals.response_max);", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "DELETE", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}appointments/{{appointment_id}}/", - "host": [ - "{{url}}appointments" - ], - "path": [ - "{{appointment_id}}", - "" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "id": "1bfedebf-df09-4b2b-8c49-78fc3b07e34b", - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "id": "787fad5e-5387-4a35-a8f5-0fdb115be54a", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "variable": [ - { - "id": "278ecdd2-62d5-4df1-8d7f-b4cc71138575", - "key": "auth_variable", - "value": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICI1NXhiZzcyaml6NWQ3cEtkbzdwNFhLdTB2VFA2UXMtemthZzFaY1ZKWTZVIn0.eyJqdGkiOiJmZWVlYzU4YS0zOTY0LTQwZDgtOTk3Ni02OTg1ZjNiNmQ2NzYiLCJleHAiOjE1NDQwMzY2NzQsIm5iZiI6MCwiaWF0IjoxNTQ0MDM0ODc0LCJpc3MiOiJodHRwczovL3Nzby10ZXN0LnBhdGhmaW5kZXIuZ292LmJjLmNhL2F1dGgvcmVhbG1zL3NiYyIsImF1ZCI6ImNmbXMtREVWIiwic3ViIjoiY2ZmNTQ3MDItZTkzMC00YjZlLTlhYzgtMmZkMTRjY2FmNzUxIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiY2Ztcy1ERVYiLCJub25jZSI6ImM1Zjg1NzBmLTgwNDktNDUxNC04Mjg4LTJjN2RmMzdkZTc5NSIsImF1dGhfdGltZSI6MTU0NDAzMjgxNywic2Vzc2lvbl9zdGF0ZSI6IjM4YjhiYzY4LTdmZDktNDE0NC04YWQ1LTI4ZGRlNmMwYWE1MCIsImFjciI6IjEiLCJhbGxvd2VkLW9yaWdpbnMiOlsiKiJdLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsidW1hX2F1dGhvcml6YXRpb24iXX0sInJlc291cmNlX2FjY2VzcyI6eyJhY2NvdW50Ijp7InJvbGVzIjpbIm1hbmFnZS1hY2NvdW50IiwibWFuYWdlLWFjY291bnQtbGlua3MiLCJ2aWV3LXByb2ZpbGUiXX19LCJuYW1lIjoiQ0ZNUyBQb3N0bWFuIE9wZXJhdG9yIiwicHJlZmVycmVkX3VzZXJuYW1lIjoiY2Ztcy1wb3N0bWFuLW9wZXJhdG9yIiwiZ2l2ZW5fbmFtZSI6IkNGTVMgUG9zdG1hbiIsImZhbWlseV9uYW1lIjoiT3BlcmF0b3IifQ.CaDq7kLDMu1oqUVm6fhiAw4ubu_D4jVdkXrqLjfCxu9b-9GzyNSIK1Gy0NCesN3caG684-Ofv3LlragMOwdoRhx-xkO6j5rqPhh2EdEDYTGkrnmQrVBjgHECLYN3RSAUWk4oKsp7gRMLDorU6QWLZNRWe9qlzulbss08Mut4nZz1RV0CirvJQ9oshBdpstQIPBM7ZEptcF2AOnc8swcFMJ3mqdrs0ImytArwZEzYwRzSIAR0-kYW-AXq-TK1dk2R7fqkMXmy3ZdHoQlFRfNtfYILVPzBAq3zPftrD-lmCcfUWz-0UcwhmNELQ-Pej-t_Z_eFSPPGkAVIuv_kkHbqQw", - "type": "string" - } - ], - "protocolProfileBehavior": {} -} \ No newline at end of file + "info": { + "_postman_id": "a0066296-ea47-4c6a-834a-ec58a02f8dea", + "name": "Load_Test_Booking", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "Setup", + "item": [ + { + "name": "Setup-Variables", + "event": [ + { + "listen": "test", + "script": { + "id": "5409b66d-67a4-449b-8633-9aeca632b388", + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "e9eed831-7955-4218-a400-ae6e1e7e2e10", + "exec": [ + "// See if the use-prefix global has been set. Use default if not.", + "let usePrefix = '';", + "if (pm.globals.get('use-prefix')) {", + " console.log(\"==> use-prefix exists\");", + " usePrefix = pm.globals.get('use-prefix');", + " console.log(\" --> Prefix is: \" + usePrefix);", + " ", + " // Set up all globals, using the correct prefix.", + " pm.globals.set('auth_url', pm.globals.get(usePrefix + 'auth_url'));", + " pm.globals.set('realm', pm.globals.get(usePrefix + 'realm'));", + " pm.globals.set('clientid', pm.globals.get(usePrefix + 'clientid'));", + " pm.globals.set('client_secret', pm.globals.get(usePrefix + 'client_secret'));", + " pm.globals.set('url', pm.globals.get(usePrefix + 'url'));", + "}", + "else {", + " console.log(\"==> use-prefix does not exist\");", + " console.log(\" --> No default globals set.\");", + "}", + "", + "// If no maximum load time defined, set a default.", + "if (!pm.globals.get('max_load_time')) {", + " console.log(\"==> max_load_time not present, default set.\");", + " pm.globals.set(\"max_load_time\", JSON.stringify(1503));", + "}", + "", + "// If no maximum response defined, set a default.", + "if (!pm.globals.get('max_response_time')) {", + " console.log(\"==> max_response_time not present, default set.\");", + " pm.globals.set(\"max_response_time\", JSON.stringify(15005));", + "}", + "", + "// Display the values of all globals.", + "console.log(\"\");", + "console.log(\"==> Globals are:\");", + "console.log(\" --> auth_url: \" + pm.globals.get(\"auth_url\"));", + "console.log(\" --> realm: \" + pm.globals.get(\"realm\"));", + "console.log(\" --> clientid: \" + pm.globals.get(\"clientid\"));", + "console.log(\" --> client_secret: \" + pm.globals.get(\"client_secret\"));", + "console.log(\" --> url: \" + pm.globals.get(\"url\"));", + "console.log(\" --> max_load_time: \" + pm.globals.get(\"max_load_time\"));", + "console.log(\" --> max_response_time: \" + pm.globals.get(\"max_response_time\"));", + "", + "", + "// Clear run-scoped variables so reruns do not inherit stale state.", + "pm.globals.unset(\"auth_failure_reason\");", + "pm.globals.unset(\"operator_token\");", + "pm.globals.unset(\"operator_refresh_token\");", + "pm.globals.unset(\"nonqtxn_token\");", + "pm.globals.unset(\"nonqtxn_refresh_token\");", + "pm.globals.unset(\"public_user_token\");", + "pm.globals.unset(\"public_user_refresh_token\");", + "pm.globals.unset(\"token\");", + "pm.globals.unset(\"refresh_token\");", + "pm.globals.unset(\"token_expires\");", + "pm.globals.unset(\"refresh_token_expires\");", + "pm.globals.unset(\"expires_in\");", + "pm.globals.unset(\"refresh_expires_in\");", + "pm.environment.unset(\"current_client\");", + "pm.environment.unset(\"first_sr_id\");", + "pm.environment.unset(\"second_sr_id\");", + "pm.environment.unset(\"current_csr_id\");", + "pm.environment.unset(\"current_office_id\");", + "pm.environment.unset(\"current_office_number\");", + "pm.environment.unset(\"counter_id\");", + "pm.environment.unset(\"qtxn_id\");", + "pm.environment.unset(\"channel_telephone_id\");", + "pm.environment.unset(\"channel_email_id\");", + "pm.environment.unset(\"service_PropTax_id\");", + "pm.environment.unset(\"service_MSP_id\");", + "pm.environment.unset(\"user_id\");", + "pm.environment.unset(\"user_phone\");", + "pm.environment.unset(\"appointment_id\");", + "pm.environment.unset(\"public_office_id\");", + "pm.environment.unset(\"public_office_timezone\");", + "pm.environment.unset(\"public_service_id\");" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Dummy data." + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "Authentication Token", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"auth_url\",\"realm\",\"clientid\",\"userid\",\"password\",\"client_secret\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "454ea7d6-4c7e-4571-8bc1-be7eed57d03a", + "exec": [ + "// Parse response body", + "var jsonData = {};", + "try {", + " jsonData = JSON.parse(responseBody);", + "} catch (parseErr) {", + " console.log(\"Authentication response body was not JSON.\");", + " console.log(responseBody);", + " pm.globals.set(\"auth_failure_reason\", \"Non-JSON auth response\");", + " pm.execution.setNextRequest(null);", + " throw parseErr;", + "}", + "", + "var authFailureReason = jsonData.error_description || jsonData.error || (\"HTTP \" + pm.response.code);", + "if (pm.response.code !== 200 || !jsonData.access_token) {", + " console.log(\"Authentication failed for \" + pm.info.requestName + \".\");", + " console.log(responseBody);", + " pm.globals.set(\"auth_failure_reason\", authFailureReason);", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Authentication failed: \" + authFailureReason);", + "}", + "", + "pm.test(\"Response code for request is 200\", function(){", + " pm.expect(pm.response.code).to.eql(200);", + "});", + "pm.test(\"Access token exists\", function(){", + " pm.expect(jsonData).to.have.property(\"access_token\");", + " pm.expect(jsonData.access_token).to.be.a(\"string\").and.not.empty;", + "});", + "pm.test(\"Refresh token exists\", function(){", + " pm.expect(jsonData).to.have.property(\"refresh_token\");", + " pm.expect(jsonData.refresh_token).to.be.a(\"string\").and.not.empty;", + "});", + "pm.test(\"Expires In is present\", function(){", + " pm.expect(jsonData).to.have.property(\"expires_in\");", + " pm.expect(jsonData.expires_in).to.not.eql(null);", + "});", + "pm.test(\"Refresh Expires In is present\", function(){", + " pm.expect(jsonData).to.have.property(\"refresh_expires_in\");", + " pm.expect(jsonData.refresh_expires_in).to.not.eql(null);", + "});", + "", + "pm.globals.unset(\"auth_failure_reason\");", + "pm.globals.set(\"operator_token\", jsonData.access_token);", + "pm.globals.set(\"operator_refresh_token\", jsonData.refresh_token);", + "pm.globals.set(\"token_expires\", Date.now() + (jsonData.expires_in * 1000));", + "pm.globals.set(\"refresh_token_expires\", Date.now() + (jsonData.refresh_expires_in * 1000));", + "pm.globals.set(\"expires_in\", jsonData.expires_in);", + "pm.globals.set(\"refresh_expires_in\", jsonData.refresh_expires_in);", + "pm.globals.set(\"token\", jsonData.access_token);", + "pm.globals.set(\"refresh_token\", jsonData.refresh_token);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/x-www-form-urlencoded", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "grant_type=password&client_id={{clientid}}&username={{userid}}&password={{password}}&client_secret={{client_secret}}" + }, + "url": { + "raw": "{{auth_url}}/auth/realms/{{realm}}/protocol/openid-connect/token?Content-Type=application/x-www-form-urlencoded", + "host": [ + "{{auth_url}}" + ], + "path": [ + "auth", + "realms", + "{{realm}}", + "protocol", + "openid-connect", + "token" + ], + "query": [ + { + "key": "Content-Type", + "value": "application/x-www-form-urlencoded" + } + ] + } + }, + "response": [] + }, + { + "name": "CFMS-Install-Basic-Response-Tests", + "event": [ + { + "listen": "test", + "script": { + "id": "a0d8e240-3b40-4654-a32b-bf2e676fdeb9", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"basic_response_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Get the maximum response time allowed.\nmax_response_time = JSON.parse(globals.max_response_time);\n\npm.test('Response time less than ' + max_response_time.toString() + 'ms', function(){\n pm.expect(pm.response.responseTime).to.be.below(max_response_time);\n});\n\nvar contentType = pm.response.headers.get(\"content-type\") || \"\";\n\npm.test(\"Response code for request is 200\", function(){\n pm.expect(pm.response.code).to.eql(200);\n});\npm.test(\"Response header should include Content-Type application/json\", function() {\n pm.expect(contentType.toLowerCase()).to.include(\"application/json\");\n});\npm.test(\"Response body should be valid JSON\", function() {\n pm.expect(function () { pm.response.json(); }).to.not.throw();\n});\n\nif (pm.response.code !== 200) {\n console.log(\"Unexpected status for \" + pm.info.requestName + \": \" + pm.response.code);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected HTTP 200 but received \" + pm.response.code);\n}\n\nif (contentType.toLowerCase().indexOf(\"application/json\") === -1) {\n console.log(\"Unexpected content-type for \" + pm.info.requestName + \": \" + contentType);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected application/json response\");\n}\n\ntry {\n pm.response.json();\n} catch (parseErr) {\n console.log(\"Response body was not valid JSON for \" + pm.info.requestName + \".\");\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw parseErr;\n}" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Exam-Type-Data", + "event": [ + { + "listen": "test", + "script": { + "id": "382b7b65-d736-4a03-a44a-3891f33b617d", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"init_exam_type_data\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Finds an exam name in the JSON list allTypes of exam types.\nfunction find_exam(input_exam_name, allTypes) {\n\texam_id_value = -1;\n\n // Loop to look for the input exam name.\n if (allTypes) {\n allTypes.forEach(function(type) {\n if ((type.exam_type_name) == input_exam_name) {\n exam_id_value = type.exam_type_id;\n }\n });\n }\n \n // If the exam wasn't found, set it to be the first exam.\n if (exam_id_value == -1) {\n exam_id_value = allTypes[0].exam_type_id;\n }\n\n // Return the exam_id_type of the input exam name.\n return exam_id_value;\n}\n\n// Get the list of all possible exam types.\nallTypes = null;\nvar jsonData = JSON.parse(responseBody);\nif (jsonData.hasOwnProperty(\"exam_types\")) {\n\tallTypes = jsonData.exam_types;\n}\n\nexam_array = [];\nexam_array.push({name: \"Pesticide\", weight: 40.2, id: find_exam(\"Pesticide\", allTypes)});\nname = \"IPSE - 4HR Single Exam\";\nexam_array.push({name: name, weight: exam_array[0].weight + 14.5, id: find_exam(name, allTypes)});\nname = \"SLE - 3HR Group Exam\";\nexam_array.push({name: name, weight: exam_array[1].weight + 7.4, id: find_exam(name, allTypes)});\nname = \"COFQ - 3HR Group Exam\";\nexam_array.push({name: name, weight: exam_array[2].weight + 5.8, id: find_exam(name, allTypes)});\nname = \"IPSE - 4HR Group Exam\";\nexam_array.push({name: name, weight: exam_array[3].weight + 5.7, id: find_exam(name, allTypes)});\nname = \"COFQ - 3HR Single Exam\";\nexam_array.push({name: name, weight: exam_array[4].weight + 5.5, id: find_exam(name, allTypes)});\nname = \"Monthly Session Exam\";\nexam_array.push({name: name, weight: exam_array[5].weight + 3.8, id: find_exam(name, allTypes)});\nname = \"SLE - 3HR Single Exam\";\nexam_array.push({name: name, weight: exam_array[6].weight + 3.5, id: find_exam(name, allTypes)});\nname = \"Angling Guide Outfitter\";\nexam_array.push({name: name, weight: exam_array[7].weight + 2.4, id: find_exam(name, allTypes)});\nname = \"IPSE - 5HR Single Exam - Time Extension\";\nexam_array.push({name: name, weight: exam_array[8].weight + 2.3, id: find_exam(name, allTypes)});\nname = \"Exam Booking - 3 Hour Miscellaneous\";\nexam_array.push({name: name, weight: exam_array[9].weight + 1.7, id: find_exam(name, allTypes)});\n\n// Store the initialized exam data for later use.\npostman.setEnvironmentVariable(\"exam_array_data\", JSON.stringify(exam_array));" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Exam-Get-Random", + "event": [ + { + "listen": "test", + "script": { + "id": "382b7b65-d736-4a03-a44a-3891f33b617d", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"create_random_functions\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Function returns a weighted randomized exam type index.\nfunction get_random_index(exam_array) {\n\n // Generate a random number up to the maximum weight allowed.\n random_number = Math.floor(Math.random() * exam_array[exam_array.length - 1].weight);\n \n // Get the index of the exam type corresponding to that weight.\n index = get_index(random_number, exam_array);\n\n // Return the index.\n return index;\n}\n\n// Based on a random number, turns it into a weighted randomized exam type index.\nfunction get_index(random_value, exam_array) {\n index = 0;\n var i;\n for (i = 0; i < exam_array.length; i++) {\n if (random_value <= exam_array[i].weight) {\n index = i;\n break;\n }\n }\n \n return index;\n}\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Exam-Data-Check", + "event": [ + { + "listen": "test", + "script": { + "id": "8cebcf78-f5a2-4694-b108-60e146791a78", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"exam_data_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Make sure that jsonData has an exam property.\npm.test(\"Response should have exam property\", function(){\n pm.expect(jsonData.hasOwnProperty(\"exam\")).to.be.true;\n});\n\n// If jsonData has exam property, check data.\nif (jsonData.hasOwnProperty(\"exam\")) {\n\n //Test to see if Event ID field remains unchanged\n pm.test(\"Validate Event Id has expected value\", function(){\n pm.expect(jsonData.event_id === environment.event_id);\n });\n\n //Test to see if exam method field remains unchanged\n pm.test(\"Validate exam method has expected value\", function(){\n pm.expect(jsonData.exam_method === environment.exam_method);\n });\n\n //Test to see if exam name field remains unchanged\n pm.test(\"Validate exam name has expected value\", function(){\n pm.expect(jsonData.exam_name === environment.exam_name);\n });\n\n //Test to see if exam type field remains unchanged\n pm.test(\"Validate exam type id has expected value\", function(){\n pm.expect(jsonData.exam_type_id === environment.random_exam_type_id);\n });\n\n //Test to see if exam written indicator field remains unchanged\n pm.test(\"Validate exam written indicator has expected value\", function(){\n pm.expect(jsonData.exam_written_ind === environment.exam_written_ind);\n });\n\n //Test to see if examinee name field remains unchanged\n pm.test(\"Validate examinee name has expected value\", function(){\n pm.expect(jsonData.examinee_name === environment.examinee_name);\n });\n\n //Test to see if notes field remains unchanged\n pm.test(\"Validate notes has expected value\", function(){\n pm.expect(jsonData.notes === environment.notes);\n });\n\n //Test to see if number of students field remains unchanged\n pm.test(\"Validate number of students has expected value\", function(){\n pm.expect(jsonData.number_of_students === environment.number_of_students);\n });\n\n //Test to see if office id remains unchanged\n pm.test(\"Validate office id has expected value\", function(){\n pm.expect(jsonData.office_id === environment.current_office_id);\n });\n\n //Test to see if offsite location is expected\n pm.test(\"Validate offsite location has expected value\", function(){\n pm.expect(jsonData.offsite_location === environment.offsite_location);\n });\n}\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Exam-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "id": "8cebcf78-f5a2-4694-b108-60e146791a78", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"exam_schema_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the JSON Schema expected in response\nvar examSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"exam\": {\n \"type\": \"object\",\n \"properties\": {\n \"booking_id\": {},\n \"deleted_date\": {},\n \"event_id\": {\"type\": \"string\"},\n \"exam_id\": {\"type\": \"number\"},\n \"exam_method\": {\"type\": \"string\"},\n \"exam_name\": {\"type\": \"string\"},\n \"exam_received_date\": {},\n \"exam_returned_tracking_number\": {},\n \"exam_type\": {\n \"type\": \"object\",\n \"properties\": {\n \"exam_color\": {\"type\": \"string\"},\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_type_name\": {\"type\": \"string\"},\n \"group_exam_ind\": {\"type\": \"number\"},\n \"ita_ind\": {\"type\": \"number\"},\n \"method_type\": {\"type\": \"string\"},\n \"number_of_hours\": {\"type\": \"number\"},\n \"number_of_minutes\": {\"type\": [\"number\", \"null\"]},\n \"pesticide_exam_ind\": {\"type\": \"number\" }\n },\n \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"group_exam_ind\", \"ita_ind\", \"method_type\", \"number_of_hours\", \"number_of_minutes\", \"pesticide_exam_ind\"]\n },\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_written_ind\": {\"type\": \"number\"},\n \"examinee_name\": {\"type\": \"string\"},\n \"expiry_date\": {\"type\": [\"string\", \"null\"]},\n \"notes\": {\"type\": \"string\"},\n \"number_of_students\": {\"type\": \"number\"},\n \"office\":{\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\" },\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\" : \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n },\n },\n \"required\": []\n },\n \"office_id\": {\"type\": \"number\"},\n \"offsite_location\": {},\n \"session_number\": {\"type\": [\"number\", \"null\"]},\n \"booking\": {}\n },\n \"required\": [\"booking\", \"booking_id\", \"deleted_date\", \"event_id\", \"exam_id\", \"exam_method\", \"exam_name\", \"exam_received_date\", \"exam_returned_tracking_number\", \"exam_type\", \"exam_type_id\", \"exam_written_ind\", \"examinee_name\", \"expiry_date\", \"notes\", \"number_of_students\", \"office\", \"office_id\", \"offsite_location\", \"session_number\"]\n }\n },\n \"required\": [\"exam\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Exam Schema\", function(){\n pm.expect(tv4.validate(jsonData, examSchema)).to.be.true;\n});\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Exam-List-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "id": "8cebcf78-f5a2-4694-b108-60e146791a78", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"exam_schema_list_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the JSON Schema expected in response\nvar examSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"exams\": {\n \"type\": \"array\",\n \"properties\": {\n \"booking_id\": {},\n \"deleted_date\": {},\n \"event_id\": {\"type\": \"string\"},\n \"exam_id\": {\"type\": \"number\"},\n \"exam_method\": {\"type\": \"string\"},\n \"exam_name\": {\"type\": \"string\"},\n \"exam_received_date\": {},\n \"exam_returned_tracking_number\": {},\n \"exam_type\": {\n \"type\": \"object\",\n \"properties\": {\n \"exam_color\": {\"type\": \"string\"},\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_type_name\": {\"type\": \"string\"},\n \"group_exam_ind\": {\"type\": \"number\"},\n \"ita_ind\": {\"type\": \"number\"},\n \"method_type\": {\"type\": \"string\"},\n \"number_of_hours\": {\"type\": \"number\"},\n \"number_of_minutes\": {\"type\": \"number\"},\n \"pesticide_exam_ind\": {\"type\": \"number\" }\n },\n \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"group_exam_ind\", \"ita_ind\", \"method_type\", \"number_of_hours\", \"number_of_minutes\", \"pesticide_exam_ind\"]\n },\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_written_ind\": {\"type\": \"number\"},\n \"examinee_name\": {\"type\": \"string\"},\n \"expiry_date\": {\"type\": [\"string\", \"null\"]},\n \"notes\": {\"type\": \"string\"},\n \"number_of_students\": {\"type\": \"number\"},\n \"office\":{\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\" },\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\" : \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n },\n },\n \"required\": []\n },\n \"office_id\": {\"type\": \"number\"},\n \"offsite_location\": {},\n \"session_number\": {\"type\": [\"number\", \"null\"]},\n \"booking\": {}\n },\n \"required\": [\"booking\", \"booking_id\", \"deleted_date\", \"event_id\", \"exam_id\", \"exam_method\", \"exam_name\", \"exam_received_date\", \"exam_returned_tracking_number\", \"exam_type\", \"exam_type_id\", \"exam_written_ind\", \"examinee_name\", \"expiry_date\", \"notes\", \"number_of_students\", \"office\", \"office_id\", \"offsite_location\", \"session_number\"]\n }\n },\n \"required\": [\"exams\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Exam List Schema\", function(){\n pm.expect(tv4.validate(jsonData, examSchema)).to.be.true;\n});\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Booking-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "id": "8cebcf78-f5a2-4694-b108-60e146791a78", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"booking_schema_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the JSON Schema expected in response\nvar bookingSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"booking\": {\n \"type\": \"object\",\n \"properties\": {\n \"blackout_flag\": {\"type\": \"string\"},\n \"blackout_notes\": {\"type\": [\"string\", \"null\"]},\n \"booking_contact_information\": {\"type\": [\"string\", \"null\"]},\n \"booking_id\": {\"type\": \"number\"},\n \"booking_name\": {\"type\": [\"string\", \"null\"]},\n \"end_time\": {\"type\": \"string\"},\n \"fees\": {\"type\": \"string\"},\n \"invigilators\": {\"type\": \"array\"},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"timezone\": {}\n },\n \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"timezone\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"recurring_uuid\": {\"type\": [\"string\", \"null\"]},\n \"room\": {\n \"type\": \"object\",\n \"properties\": {\n \"capacity\": {\"type\": \"number\"},\n \"color\": {\"type\": \"string\"},\n \"deleted\": {\"type\": [\"string\", \"null\"]},\n \"room_id\": {\"type\": \"number\"},\n \"room_name\": {\"type\": \"string\"}\n },\n \"required\": [\"capacity\", \"color\", \"room_id\", \"room_name\", \"deleted\"]\n },\n \n \"room_id\": {\"type\": \"number\"},\n \"sbc_staff_invigilated\": {\"type\": \"number\"},\n \"shadow_invigilator_id\": {\"type\": [\"number\", \"null\"]},\n \"start_time\": {\"type\": \"string\"}\n },\n \"required\": [\"blackout_flag\", \"blackout_notes\", \"booking_contact_information\", \"booking_id\",\n \"booking_name\", \"end_time\", \"fees\", \"invigilators\", \"office\", \"office_id\",\n \"recurring_uuid\", \"room\", \"room_id\", \"sbc_staff_invigilated\", \"shadow_invigilator_id\",\n \"start_time\"]\n },\n \"errors\": { \"type\": \"object\" }\n },\n \"required\": [\"booking\", \"errors\"]\n}\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Booking Schema\", function(){\n pm.expect(tv4.validate(jsonData, bookingSchema)).to.be.true;\n});\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Booking-Data-Check", + "event": [ + { + "listen": "test", + "script": { + "id": "8cebcf78-f5a2-4694-b108-60e146791a78", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"booking_data_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Make sure that jsonData has an booking property.\npm.test(\"Response should have booking property\", function(){\n pm.expect(jsonData.hasOwnProperty(\"booking\")).to.be.true;\n});\n\n// If jsonData has booking property, check data.\nif (jsonData.hasOwnProperty(\"booking\")) {\n\n //Test to see if booking name has expected value\n pm.test(\"Validate Booking Name has expected value\", function(){\n pm.expect(jsonData.booking_name === environment.booking_name);\n });\n\n //Test to see if start time has expected value\n pm.test(\"Validate start time has expected value\", function(){\n pm.expect(jsonData.start_time === environment.start_time);\n });\n\n //Test to see if end time has expected value\n pm.test(\"Validate end time has expected value\", function(){\n pm.expect(jsonData.end_time === environment.end_time);\n });\n\n //Test to see if room id has expected value\n pm.test(\"Validate room id has expected value\", function(){\n pm.expect(jsonData.room_id === environment.room_id_1);\n });\n\n //Test to see if fees field has expected value\n pm.test(\"Validate fees has expected value\", function(){\n pm.expect(jsonData.fees === environment.fees);\n });\n\n //Test to see if office id field has expected value\n pm.test(\"Validate office id has expected value\", function(){\n pm.expect(jsonData.office_id === environment.current_office_id);\n });\n}\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Booking-List-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "id": "8cebcf78-f5a2-4694-b108-60e146791a78", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"booking_list_schema_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "var bookingSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"bookings\": {\n \"type\": \"array\",\n \"properties\": {\n \"booking_contact_information\": {},\n \"booking_id\": {\"type\": \"number\"},\n \"booking_name\": {\"type\": \"string\"},\n \"end_time\": {\"type\": \"string\"},\n \"fees\": {\"type\": \"string\"},\n \"invigilator\": {},\n \"invigilator_id\": {},\n \"office\": {\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\"},\n \"sb_id\": {\"type\": \"number\"},\n \"timezone\": {}\n },\n \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"sb\", \"sb_id\"]\n },\n \"office_id\": {\"type\": \"number\"},\n \"room\": {\n \"type\": \"object\",\n \"properties\": {\n \"capacity\": {\"type\": \"number\"},\n \"color\": {\"type\": \"string\"},\n \"room_id\": {\"type\": \"number\"},\n \"room_name\": {\"type\": \"string\"}\n },\n \"required\": [\"capacity\", \"color\", \"room_id\", \"room_name\"]\n },\n \"room_id\": {\"type\": \"number\"},\n \"start_time\": {\"type\": \"string\"},\n },\n \"required\": [\"booking_contact_information\", \"booking_id\", \"booking_name\", \"end_time\", \"fees\", \"room\", \"room_id\", \"start_time\", \"invigilator_id\", \"office\", \"office_id\"]\n },\n \"errors\": {\n \"type\": \"object\",\n \"properties\": {}\n }\n },\n \"required\": [\"bookings\", \"errors\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Booking List Schema\", function(){\n pm.expect(tv4.validate(jsonData, bookingSchema)).to.be.true;\n});" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "Who am I TheQ", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "if (jsonData.hasOwnProperty(\"csr\")) {", + "\tcurrentOfficeId = jsonData.csr.office_id;", + "\tcurrentOfficeNumber = jsonData.csr.office.office_number;", + "\tcurrentCsrId = jsonData.csr.csr_id;", + " postman.setEnvironmentVariable(\"current_office_id\", currentOfficeId);", + " postman.setEnvironmentVariable(\"current_office_number\", currentOfficeNumber);", + " postman.setEnvironmentVariable(\"current_csr_id\", currentCsrId);", + "};", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}csrs/me/", + "host": [ + "{{url}}csrs" + ], + "path": [ + "me", + "" + ] + } + }, + "response": [] + }, + { + "name": "Get Room IDs", + "event": [ + { + "listen": "test", + "script": { + "id": "859ae114-22c4-4f3e-9f1f-9f0e06fbc29d", + "exec": [ + "// Define the JSON Schema expected in response", + "var roomSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"rooms\": {", + " \"type\": \"array\",", + " \"properties\": {", + " \"capacity\": {\"type\": \"number\"},", + " \"color\": {\"type\": \"string\"},", + " \"office\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"office_id\": {\"type\": \"number\"},", + " \"office_name\": {\"type\": \"string\"},", + " \"office_number\": {\"type\": \"number\"},", + " \"sb\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"sb_id\": {\"type\": \"number\"},", + " \"sb_type\": {\"type\": \"string\"}", + " },", + " \"required\": [\"sb_id\", \"sb_type\"]", + " },", + " \"sb_id\": {\"type\": \"number\"} ", + " },", + " \"required\": [\"office_id\", \"office_name\", \"office_number\", \"sb\", \"sb_id\"]", + " }", + " },", + " \"required\": [\"capacity\", \"color\", \"office\", \"room_id\", \"room_name\"]", + " }", + " }", + "};", + "", + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Get the max response time allowed.", + "var response_max = JSON.parse(globals.response_max);", + "", + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate Response Room Schema\", function(){", + " pm.expect(tv4.validate(jsonData, roomSchema)).to.be.true;", + "});", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "if (jsonData.hasOwnProperty(\"rooms\")) {", + " console.log(\"==> Rooms\");", + " room_id_1 = jsonData.rooms[0].room_id;", + " room_id_2 = room_id_1;", + " if (jsonData.rooms.length > 1) {", + " room_id_2 = jsonData.rooms[1].room_id;", + " }", + " postman.setEnvironmentVariable(\"room_id_1\", JSON.stringify(room_id_1.toString()));", + " postman.setEnvironmentVariable(\"room_id_2\", JSON.stringify(room_id_2.toString()));", + "}", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "462566f5-d6cd-4c14-9b11-0cbf7abc0caf", + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}rooms/", + "host": [ + "{{url}}rooms" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Get Service IDs", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "d01c3826-dc28-4cce-957b-ec70d0393e7e", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "3b11031e-4031-4569-91f2-49e23517ffee", + "exec": [ + "// Run basic tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "var schema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"services\": {", + " \"type\": \"array\",", + " \"properties\": {", + " \"display_dashboard_ind\" : {", + " \"type\" : \"number\"", + " },", + " \"deleted\" : {", + " \"type\" : [\"object\", \"null\"]", + " },", + " \"actual_service_ind\" : {", + " \"type\" : \"number\"", + " },", + " \"service_id\" : {", + " \"type\" : [\"number\", \"object\"]", + " },", + " \"service_code\" : {", + " \"type\" : \"string\"", + " },", + " \"prefix\" : {", + " \"type\" : \"string\"", + " },", + " \"service_name\" : {", + " \"type\" : \"string\"", + " },", + " \"parent_id\" : {", + " \"type\" : [\"object\", \"number\", \"null\" ]", + " },", + " \"service_desc\" : {", + " \"type\" : \"string\"", + " }", + " },", + " \"required\" : [\"display_dashboard_ind\", \"deleted\", \"actual_service_ind\", \"service_id\", \"service_code\",", + " \"prefix\", \"service_name\", \"parent_id\", \"service_desc\"]", + " }", + " }", + "};", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate Service Schema\", function(){", + " pm.expect(tv4.validate(jsonData, schema)).to.be.true;", + "});", + "", + "// Loop to validate schema of each channel.", + "var allElements = jsonData.services;", + "var elementCount = 0;", + "var elementMax = Math.min(10, allElements.length);", + "//allElements.forEach(function(element) {", + "for (var currentElement = 0; currentElement < elementMax; currentElement++) {", + " element = allElements[currentElement];", + " elementCount ++;", + " var testTitle = \"Service (\" + elementCount + \"): \" + element.service_name;", + " pm.test(\"Validate Schema for \" + testTitle, function(){", + " pm.expect(tv4.validate(element, schema)).to.be.true;", + " });", + " ", + " // Test the authenticate response.", + " pm.test(\"--> \" + testTitle + \" dashboard_ind must be 0 or 1\", function() {", + " pm.expect(element.display_dashboard_ind).to.be.within(0,1);", + " });", + " pm.test(\"--> \" + testTitle + \" actual_service_ind must be 1\", function() {", + " pm.expect(element.actual_service_ind).to.be.eql(1);", + " });", + " pm.test(\"--> \" + testTitle + \" parent_id must not be null\", function() {", + " pm.expect(element.parent_id).to.not.be.null;", + " });", + "}", + "", + "// Declare and initialize variables.", + "var mspId = 0;", + "var taxId = 0;", + "var mspText = \"Payment - MSP\";", + "var propTaxText = \"Other - PTAX\";", + "", + "// Look for the MSP and Property Tax IDs.", + "allElements.forEach(function(element) {", + " if (element.service_name === mspText) {", + " mspId = element.service_id;", + " }", + " if (element.service_name === propTaxText) {", + " taxId = element.service_id;", + " }", + "});", + "", + "// Check that you found the service IDs.", + "pm.test(\"The \" + mspText + \" service ID (\" + mspId.toString() + \") should not equal 0\", function() {", + " pm.expect(mspId).to.not.be.eql(0);", + "});", + "", + "pm.test(\"The \" + propTaxText + \" service ID (\" + taxId.toString() + \") should not equal 0\", function() {", + " pm.expect(taxId).to.not.be.eql(0);", + "});", + "", + "// Store these IDs for future use.", + "postman.setEnvironmentVariable(\"service_MSP_id\", JSON.stringify(mspId));", + "postman.setEnvironmentVariable(\"service_PropTax_id\", JSON.stringify(taxId));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + } + ], + "url": { + "raw": "{{url}}services/", + "host": [ + "{{url}}services" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Get Exam Types", + "item": [ + { + "name": "Exam Type List", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "2df2a851-6a71-48e6-b44f-ccf096fe9d83", + "exec": [ + "// Define the JSON Schema expected in response", + "var examTypeSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"exam_color\": {\"type\": \"string\"},", + " \"exam_type_id\": {\"type\": \"number\"},", + " \"exam_type_name\": {\"type\": \"string\"},", + " \"ita_ind\": {\"type\": \"number\"},", + " \"method_type\": {\"type\": \"string\"},", + " \"number_of_hours\": {\"type\": \"number\"},", + " \"group_exam_ind\": {\"type\": \"number\"}", + " },", + " \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"ita_ind\", \"method_type\", \"number_of_hours\", \"group_exam_ind\"]", + " },", + " \"required\": []", + "}; ", + "", + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate Response Exam Type Schema\", function(){", + " pm.expect(tv4.validate(jsonData, examTypeSchema)).to.be.true;", + "});", + "", + "// Store all exam type IDs for future use in adding exams", + "var allExamIds = [];", + "", + "// Make sure some data returned.", + "pm.test(\"Response has exam_types property\", function(){", + " pm.expect(jsonData.hasOwnProperty(\"exam_types\")).to.be.true;", + "});", + "pm.test(\"Response has at least one exam_type\", function(){", + " pm.expect(jsonData.exam_types.length).to.be.above(0);", + "});", + "", + "// Set up list of valid exam types, create random functions.", + "eval(environment.init_exam_type_data);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}exam_types/", + "host": [ + "{{url}}exam_types" + ], + "path": [ + "" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Exams", + "item": [ + { + "name": "Exam Post End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"event_id\",\"random_exam_type_id\",\"current_office_id\",\"expiry_date\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Get exam type data and functions.", + "exam_array = JSON.parse(postman.getEnvironmentVariable(\"exam_array_data\"));", + "eval(environment.create_random_functions);", + "// Create an event number based on the time.", + "var ms = (new Date().getTime()).toString() + \"00\";", + "eventNumber = Number(ms.substring(ms.length-6, ms.len)) + 1;", + "postman.setEnvironmentVariable(\"event_number\", eventNumber);", + "// Update the next event ID.", + "var eventId = \"pm\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", 0);", + "postman.setEnvironmentVariable(\"event_id\", JSON.stringify(eventId));", + "postman.setEnvironmentVariable(\"event_delete\", eventId);", + "// Calculate a random exam type to use.", + "random_index = get_random_index(exam_array);", + "// Store for use.", + "random_exam_type_id = exam_array[random_index].id;", + "postman.setEnvironmentVariable(\"random_exam_type_id\", JSON.stringify(random_exam_type_id.toString()));", + "// Store other variables for later use.", + "postman.setEnvironmentVariable(\"exam_method\", JSON.stringify(\"paper\"));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"Postman Group Exam Name\"));", + "postman.setEnvironmentVariable(\"exam_written_ind\", JSON.stringify(\"0\"));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"Postman Examinee Name\"));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"Postman Test Notes\"));", + "postman.setEnvironmentVariable(\"number_of_students\", JSON.stringify(\"19\"));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"Postman test location\"));", + "// Calculate an expiry date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+7);", + "// Get year, day, month from the later time.", + "year = later.getFullYear().toString();", + "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", + "day = (\"0\" + (later.getDate()).toString()).slice(-2);", + "// Format expiry date for the exam.", + "expiry_date = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", + "// Store globals.", + "pm.globals.set(\"expiry_date\", JSON.stringify(expiry_date));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "// Get the max response time allowed.", + "var response_max = JSON.parse(globals.response_max);", + "", + "// Check Response code for request", + "pm.test(\"Response code for request is 201\", function(){", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.exam_schema_check);", + "eval(environment.exam_data_check);", + "", + "// If jsonData has an exam property, save exam ID.", + "if (jsonData.hasOwnProperty(\"exam\")) {", + "\tcurrentExamId = jsonData.exam.exam_id;", + " postman.setEnvironmentVariable(\"current_exam_id\", currentExamId);", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\n\t\"event_id\" : {{event_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : \"Postman Group Exam Name\",\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : \"Pm examinee name\",\n \"notes\" : \"Pm sample notes\",\n \"number_of_students\" : \"19\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : \"Pm test location\",\n \"expiry_date\": {{expiry_date}}\n}" + }, + "url": { + "raw": "{{url}}exams/", + "host": [ + "{{url}}exams" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Exam Detail End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "5206f620-8220-4ba4-860a-13c1bb452e6d", + "exec": [ + "// Get the max response time allowed.", + "var response_max = JSON.parse(globals.response_max);", + "", + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.exam_schema_check);", + "eval(environment.exam_data_check);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Exam List End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "2a7432b9-ffb0-4e23-a224-c3a48171d6c4", + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.exam_schema_list_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}exams/", + "host": [ + "{{url}}exams" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Exam Put End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\",\"update_id\",\"exam_method\",\"exam_name\",\"random_exam_type_id\",\"exam_written_ind\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"number_of_students\", JSON.stringify(\"21\"));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "// Get the max response time allowed.", + "var response_max = JSON.parse(globals.response_max);", + "", + "// Check Response code for request", + "pm.test(\"Response code for request is 201\", function(){", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.exam_schema_check);", + "eval(environment.exam_data_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : {{exam_method}},\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : {{exam_written_ind}},\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}\n" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Exam Detail End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "3efcb554-1e5a-4e0a-91b8-aa32eb14a5e6", + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.exam_schema_check);", + "eval(environment.exam_data_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Exam Delete End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "88b43898-330f-4cf1-81c3-8cce3c53f54c", + "exec": [ + "// Get the max response time allowed.", + "var response_max = JSON.parse(globals.response_max);", + "", + "// Check Response code for request", + "pm.test(\"Response code for request is 204\", function(){", + " pm.response.to.have.status(204);", + "});", + "", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Exams Export", + "item": [ + { + "name": "Exams Export List", + "event": [ + { + "listen": "test", + "script": { + "id": "9e02fbaf-627e-43db-b516-226b1a2874e8", + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time less than 20,000ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(20000);", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "caf977c6-da22-4f6c-b0c9-ca5f0fc3ec29", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"start_date\",\"end_date\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Calculate a start date four weeks prior to today.", + "var start = new Date();", + "start.setDate(start.getDate()-28);", + "// Get year, day, month from the start time.", + "start_year = start.getFullYear().toString();", + "start_month = (\"0\" + (start.getMonth() + 1).toString()).slice(-2);", + "start_day = (\"0\" + (start.getDate()).toString()).slice(-2);", + "start_date = start_year + \"-\" + start_month + \"-\" + start_day;", + "// Get year, day, month from the current day.", + "var today = new Date();", + "end_year = today.getFullYear().toString();", + "end_month = (\"0\" + (today.getMonth() + 1).toString()).slice(-2);", + "end_day = (\"0\" + (today.getDate()).toString()).slice(-2);", + "end_date = end_year + \"-\" + end_month + \"-\" + end_day;", + "console.log(\"Start: \" + start_date);", + "console.log(\"End: \" + end_date);", + "pm.globals.set(\"start_date\", start_date);", + "pm.globals.set(\"end_date\", end_date);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}exams/export/?start_date={{start_date}}&end_date={{end_date}}", + "host": [ + "{{url}}exams" + ], + "path": [ + "export", + "" + ], + "query": [ + { + "key": "start_date", + "value": "{{start_date}}" + }, + { + "key": "end_date", + "value": "{{end_date}}" + } + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Exam Types", + "item": [ + { + "name": "Exam Type List End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "2df2a851-6a71-48e6-b44f-ccf096fe9d83", + "exec": [ + "// Define the JSON Schema expected in response", + "var examTypeSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"exam_color\": {\"type\": \"string\"},", + " \"exam_type_id\": {\"type\": \"number\"},", + " \"exam_type_name\": {\"type\": \"string\"},", + " \"ita_ind\": {\"type\": \"number\"},", + " \"method_type\": {\"type\": \"string\"},", + " \"number_of_hours\": {\"type\": \"number\"},", + " \"group_exam_ind\": {\"type\": \"number\"}", + " },", + " \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"ita_ind\", \"method_type\", \"number_of_hours\", \"group_exam_ind\"]", + " },", + " \"required\": []", + "}; ", + "", + "// Get the max response time allowed.", + "var response_max = JSON.parse(globals.response_max);", + "", + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate Response Exam Type Schema\", function(){", + " pm.expect(tv4.validate(jsonData, examTypeSchema)).to.be.true;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}exam_types/", + "host": [ + "{{url}}exam_types" + ], + "path": [ + "" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Bookings", + "item": [ + { + "name": "Booking Post End-point", + "event": [ + { + "listen": "test", + "script": { + "id": "a4099862-1c9a-48f7-adbf-0240e6eb185a", + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 201\", function(){", + " pm.response.to.have.status(201);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.response_max);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "", + "var booking_id = jsonData.booking.booking_id;", + "", + "//Dynamic variable used for end-point testing later on", + "postman.setEnvironmentVariable(\"booking_id\", JSON.stringify(booking_id));" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "4df5dedd-4976-4cdc-b2be-739b2028cdc4", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"start_time\",\"end_time\",\"room_id\",\"fees\",\"booking_name\",\"current_office_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Calculate a start date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+7);", + "// Get year, day, month from the later time.", + "year = later.getFullYear().toString();", + "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", + "day = (\"0\" + (later.getDate()).toString()).slice(-2);", + "// Format starting and ending time for the booking.", + "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", + "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", + "// Store globals.", + "pm.globals.set(\"start_time\", JSON.stringify(start_time));", + "pm.globals.set(\"end_time\", JSON.stringify(end_time));", + "pm.globals.set(\"fees\", JSON.stringify(\"false\"));", + "pm.globals.set(\"booking_name\", JSON.stringify(\"Super big demo next week\"));", + "pm.globals.set(\"room_id\", pm.environment.get(\"room_id_1\"));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"room_id\": {{room_id}},\n \"fees\": {{fees}},\n \"booking_name\": {{booking_name}},\n \"office_id\" : {{current_office_id}}\n}\n" + }, + "url": { + "raw": "{{url}}bookings/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Booking Detail End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"booking_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "232f5232-de75-4f55-b999-2e39e39a12a8", + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}bookings/{{booking_id}}/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "{{booking_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Booking List End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "59fc7e18-6df0-48d9-822c-6518fbece309", + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_list_schema_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}bookings/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Booking Put End-point", + "event": [ + { + "listen": "test", + "script": { + "id": "b127046f-b399-4e66-b76f-b6e79268b8ce", + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.response_max);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "9bde67e2-8eeb-4e50-90bf-caff1fef90a4", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"booking_id\",\"start_time\",\"end_time\",\"room_id\",\"fees\",\"booking_name\",\"current_office_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Calculate a start date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+7);", + "// Get year, day, month from the later time.", + "year = later.getFullYear().toString();", + "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", + "day = (\"0\" + (later.getDate()).toString()).slice(-2);", + "// Format starting and ending time for the booking.", + "start_time = year + \"-\" + month + \"-\" + day + \"T21:00:00Z\";", + "end_time = year + \"-\" + month + \"-\" + day + \"T23:00:00Z\";", + "pm.globals.set(\"start_time\", JSON.stringify(start_time));", + "pm.globals.set(\"end_time\", JSON.stringify(end_time));", + "pm.globals.set(\"fees\", JSON.stringify(\"true\"));", + "pm.globals.set(\"booking_name\", JSON.stringify(\"Time to pay your fees!\"));", + "pm.globals.set(\"room_id\", pm.environment.get(\"room_id_2\"));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"room_id\": {{room_id}},\n \"fees\": {{fees}},\n \"booking_name\": {{booking_name}},\n \"office_id\" : {{current_office_id}}\n}" + }, + "url": { + "raw": "{{url}}bookings/{{booking_id}}/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "{{booking_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Booking Detail End-point Again", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"booking_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "b5e53be0-ddda-4c99-b563-5a3b449e0f79", + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.booking_schema_check);", + "eval(environment.booking_data_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}bookings/{{booking_id}}/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "{{booking_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Booking Delete End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"booking_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "1e7c1d71-ea74-4a78-9ef2-ee9a7a47d915", + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 204\", function(){", + " pm.response.to.have.status(204);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.response_max);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}bookings/{{booking_id}}/", + "host": [ + "{{url}}bookings" + ], + "path": [ + "{{booking_id}}", + "" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Invigilators", + "item": [ + { + "name": "Invigilator List End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "0e68858e-985c-4fb0-bca6-04d33f65c28d", + "exec": [ + "// Define the JSON Schema expected in response", + "var invigilatorSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"invigilators\": {", + " \"type\": \"array\",", + " \"properties\": {", + " \"contact_email\": {\"type\": \"string\"},", + " \"contact_phone\": {\"type\": \"string\"},", + " \"contract_expiry_date\": {\"type\": \"string\"},", + " \"contract_number\": {\"type\": \"string\"},", + " \"invigilator_id\": {\"type\": \"number\"},", + " \"invigilator_name\": {\"type\": \"string\"},", + " \"invigilator_notes\": {\"type\": \"string\"},", + " \"office\":{", + " \"type\": \"object\",", + " \"properties\": {", + " \"office_id\": {\"type\": \"number\"},", + " \"office_name\": {\"type\": \"string\"},", + " \"office_number\": {\"type\": \"number\"},", + " \"sb\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"sb_id\": {\"type\": \"number\"},", + " \"sb_type\": {\"type\": \"string\"}", + " },", + " \"required\": [\"sb_id\", \"sb_type\"]", + " }", + " },", + " \"required\": [\"office_id\", \"office_name\", \"office_number\", \"sb\", \"sb_id\"]", + " }", + " },", + " \"required\": [\"contact_email\", \"contact_phone\", \"contract_expiry_date\", \"contract_number\", \"invigilator_id\", \"invigilator_name\", \"invigilator_notes\", \"office\"]", + " }", + " }", + "};", + "", + "// Get the max response time allowed.", + "var response_max = JSON.parse(globals.response_max);", + "", + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate Response Invigilator Schema\", function(){", + " pm.expect(tv4.validate(jsonData, invigilatorSchema)).to.be.true;", + "});", + "", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}invigilators/", + "host": [ + "{{url}}invigilators" + ], + "path": [ + "" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Rooms", + "item": [ + { + "name": "Room List End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "859ae114-22c4-4f3e-9f1f-9f0e06fbc29d", + "exec": [ + "// Define the JSON Schema expected in response", + "var roomSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"rooms\": {", + " \"type\": \"array\",", + " \"properties\": {", + " \"capacity\": {\"type\": \"number\"},", + " \"color\": {\"type\": \"string\"},", + " \"office\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"office_id\": {\"type\": \"number\"},", + " \"office_name\": {\"type\": \"string\"},", + " \"office_number\": {\"type\": \"number\"},", + " \"sb\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"sb_id\": {\"type\": \"number\"},", + " \"sb_type\": {\"type\": \"string\"}", + " },", + " \"required\": [\"sb_id\", \"sb_type\"]", + " },", + " \"sb_id\": {\"type\": \"number\"} ", + " },", + " \"required\": [\"office_id\", \"office_name\", \"office_number\", \"sb\", \"sb_id\"]", + " }", + " },", + " \"required\": [\"capacity\", \"color\", \"office\", \"room_id\", \"room_name\"]", + " }", + " }", + "};", + "", + "// Get the max response time allowed.", + "var response_max = JSON.parse(globals.response_max);", + "", + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate Response Room Schema\", function(){", + " pm.expect(tv4.validate(jsonData, roomSchema)).to.be.true;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}rooms/", + "host": [ + "{{url}}rooms" + ], + "path": [ + "" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "CSRS", + "item": [ + { + "name": "CSRS Me Get End-point", + "event": [ + { + "listen": "test", + "script": { + "id": "1ed052a0-06cc-45c7-ae49-b19b96e02d51", + "exec": [ + "// Define the JSON Schema expected in response", + "var CSRSSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"csr\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"csr_id\": {\"type\": \"number\"},", + " \"csr_state\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"csr_state_desc\": {\"type\": \"string\"},", + " \"csr_state_id\": {\"type\": \"number\"},", + " \"csr_state_name\": {\"type\": \"string\"}", + " },", + " \"required\": [\"csr_state_desc\", \"csr_state_id\", \"csr_state_name\"]", + " },", + " \"csr_state_id\": {\"type\": \"number\"},", + " \"deleted\": {},", + " \"finance_designate\": {\"type\": \"number\"},", + " \"office_manager\": {\"type\": \"number\"},", + " \"ita2_designate\": {\"type\": \"number\"},", + " \"office\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"appointments_enabled_ind\": {\"type\": \"number\"},", + " \"back_office_list\": {", + " \"type\": \"array\",", + " \"properties\": {", + " \"actual_service_ind\": {\"type\": \"number\"},", + " \"deleted\": {},", + " \"display_dashboard_ind\": {\"type\": \"number\"},", + " \"parent\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"service_name\": {\"type\": \"string\"}", + " },", + " \"required\": [\"service_name\"]", + " },", + " \"parent_id\": {\"type\": \"number\"},", + " \"prefix\": {\"type\": \"string\"},", + " \"service_code\": {\"type\": \"string\"},", + " \"service_desc\": {\"type\": \"string\"},", + " \"service_id\": {\"type\": \"number\"},", + " \"service_name\": {\"type\": \"string\"},", + " },", + " \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\", \"parent\",", + " \"parent_id\", \"prefix\", \"service_code\", \"service_desc\", \"service_id\",", + " \"service_name\"]", + " },", + " \"counters\": {", + " \"type\": \"array\",", + " \"properties\": {", + " \"counter_id\": {\"type\": \"number\"},", + " \"counter_name\": {\"type\": \"string\"}", + " },", + " \"required\": [\"counter_id\", \"counter_name\"]", + " },", + " \"exams_enabled_ind\": {\"type\": \"number\"},", + " \"office_id\": {\"type\": \"number\"},", + " \"office_name\": {\"type\": \"string\"},", + " \"office_number\": {\"type\": \"number\"},", + " \"quick_list\": {", + " \"type\": \"array\",", + " \"properties\": {", + " \"actual_service_ind\": {\"type\": \"number\"},", + " \"deleted\": {},", + " \"display_dashboard_ind\": {\"type\": \"number\"},", + " \"parent\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"service_name\": {\"type\": \"string\"}", + " },", + " \"required\": [\"service_name\"]", + " },", + " \"parent_id\": {\"type\": \"number\"},", + " \"prefix\": {\"type\": \"string\"},", + " \"service_code\": {\"type\": \"string\"},", + " \"service_desc\": {\"type\": \"string\"},", + " \"service_id\": {\"type\": \"number\"},", + " \"service_name\": {\"type\": \"string\"},", + " },", + " \"required\": [\"actual_service_ind\", \"deleted\", \"display_dashboard_ind\", \"parent\",", + " \"parent_id\", \"prefix\", \"service_code\", \"service_desc\", \"service_id\",", + " \"service_name\"]", + " },", + " \"sb\":{", + " \"type\": \"object\",", + " \"properties\": {", + " \"sb_id\": {\"type\": \"number\"},", + " \"sb_type\": {\"type\": \"string\"}", + " },", + " \"required\": [\"sb_id\", \"sb_type\"]", + " },", + " \"sb_id\": {\"type\": \"number\"},", + " \"timezone\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"timezone_id\": {\"type\": \"number\"},", + " \"timezone_name\": {\"type\": \"string\"}", + " },", + " \"required\": [\"timezone_id\", \"timezone_name\"]", + " }", + " },", + " \"required\": [\"appointments_enabled_ind\", \"back_office_list\", \"counters\",", + " \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\",", + " \"quick_list\", \"sb\", \"sb_id\", ]", + " },", + " \"office_id\": {\"type\": \"number\"},", + " \"pesticide_designate\": {\"type\": \"number\"},", + " \"qt_xn_csr_ind\": {\"type\": \"number\"},", + " \"receptionist_ind\": {\"type\": \"number\"},", + " \"role\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"role_code\": {\"type\": \"string\"},", + " \"role_desc\": {\"type\": \"string\"},", + " \"role_id\": {\"type\": \"number\"}", + " },", + " \"required\": [\"role_code\", \"role_desc\", \"role_id\"]", + " },", + " \"role_id\": {\"type\": \"number\"},", + " \"username\": {\"type\": \"string\"}", + " },", + " },", + " \"attention_needed\": {\"type\": \"boolean\"},", + " \"active_citizens\" : {\"type\": \"array\"},", + " \"back_office_display\": {\"type\": \"string\"},", + " \"recurring_feature_flag\": {\"type\": \"string\"}", + " },", + " \"required\": [\"csr\", \"attention_needed\", \"active_citizens\", \"back_office_display\", \"recurring_feature_flag\"]", + "};", + "", + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate Response CSRs Schema\", function(){", + " pm.expect(tv4.validate(jsonData, CSRSSchema)).to.be.true;", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "1c4020cd-fb05-478c-b908-3197c80d492e", + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}csrs/me/", + "host": [ + "{{url}}csrs" + ], + "path": [ + "me", + "" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Offices", + "item": [ + { + "name": "Office List End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "ad6ffb6d-efad-4e11-b4a9-99e49f457bbd", + "exec": [ + "// Define the JSON Schema expected in response", + "var officeSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"offices\": {", + " \"type\": \"array\",", + " \"properties\": {", + " \"exams_enabled\": {\"type\": \"number\"},", + " \"office_id\": {\"type\": \"number\"},", + " \"office_name\": {\"type\": \"string\"},", + " \"office_number\": {\"type\": \"number\"},", + " \"sb\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"sb_id\": {\"type\": \"number\"},", + " \"sb_type\": {\"type\": \"string\"}", + " },", + " \"required\": [\"sb_id\", \"sb_type\"]", + " },", + " \"sb_id\": {\"type\": \"number\"}", + " },", + " \"required\": [\"exams_enabled\", \"office_id\", \"office_name\", \"office_number\", \"sb\", \"sb_id\"]", + " }", + " }", + "};", + "", + "// Get the max response time allowed.", + "var response_max = JSON.parse(globals.response_max);", + "", + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate Response Office Schema\", function(){", + " pm.expect(tv4.validate(jsonData, officeSchema)).to.be.true;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}offices/", + "host": [ + "{{url}}offices" + ], + "path": [ + "" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Appointments", + "item": [ + { + "name": "Appointment Post End-point", + "event": [ + { + "listen": "test", + "script": { + "id": "851b530c-92d7-482c-9e80-2a1f542b280c", + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 201\", function(){", + " pm.response.to.have.status(201);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.response_max);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.appointment_schema_check);", + "eval(environment.appointment_data_check);", + "", + "var appointment_id = jsonData.appointment.appointment_id;", + "", + "//Dynamic variable used for end-point testing later on", + "postman.setEnvironmentVariable(\"appointment_id\", JSON.stringify(appointment_id));" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "e8444129-3a7b-4a2f-82d0-fd9b5d395f0d", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"service_id\",\"current_office_id\",\"start_time\",\"end_time\",\"category\",\"comments\",\"citizen_name\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Calculate a start date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+7);", + "// Get year, day, month from the later time.", + "year = later.getFullYear().toString();", + "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", + "day = (\"0\" + (later.getDate()).toString()).slice(-2);", + "// Format starting and ending time for the booking.", + "start_time = year + \"-\" + month + \"-\" + day + \"T17:00:00Z\";", + "end_time = year + \"-\" + month + \"-\" + day + \"T19:00:00Z\";", + "pm.globals.set(\"start_time\", JSON.stringify(start_time));", + "pm.globals.set(\"end_time\", JSON.stringify(end_time));", + "pm.globals.set(\"category\", JSON.stringify(\"Exam\"));", + "pm.globals.set(\"comments\", JSON.stringify(\"Missed playoffs, needs to talk #1.\"));", + "pm.globals.set(\"citizen_name\", JSON.stringify(\"LeBron James Appointment #1\"));", + "pm.globals.set(\"service_id\", pm.environment.get(\"service_PropTax_id\"));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"service_id\": {{service_id}},\n \"office_id\" : {{current_office_id}},\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"category\": {{category}},\n \"comments\": {{comments}},\n \"citizen_name\": {{citizen_name}}\n}" + }, + "url": { + "raw": "{{url}}appointments/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Appointment Detail End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"appointment_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "5206f620-8220-4ba4-860a-13c1bb452e6d", + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.appointment_schema_check);", + "eval(environment.appointment_data_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}appointments/{{appointment_id}}/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "{{appointment_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Appointment List End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "2a7432b9-ffb0-4e23-a224-c3a48171d6c4", + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid\\", + "eval(environment.appointment_list_schema_check);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}appointments/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Appointment Put End-point", + "event": [ + { + "listen": "test", + "script": { + "id": "1cf958af-12dd-44f4-a624-d070cc6d90cb", + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.response_max);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "eval(environment.appointment_schema_check);", + "eval(environment.appointment_data_check);", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "52ba16f8-f08e-4a75-a64c-39e59c64c1c6", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"appointment_id\",\"current_office_id\",\"start_time\",\"end_time\",\"category\",\"comments\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Calculate a start date a week from today.", + "var later = new Date();", + "later.setDate(later.getDate()+7);", + "// Get year, day, month from the later time.", + "year = later.getFullYear().toString();", + "month = (\"0\" + (later.getMonth() + 1).toString()).slice(-2);", + "day = (\"0\" + (later.getDate()).toString()).slice(-2);", + "// Format starting and ending time for the booking.", + "start_time = year + \"-\" + month + \"-\" + day + \"T21:00:00Z\";", + "end_time = year + \"-\" + month + \"-\" + day + \"T23:00:00Z\";", + "pm.globals.set(\"start_time\", JSON.stringify(start_time));", + "pm.globals.set(\"end_time\", JSON.stringify(end_time));", + "pm.globals.set(\"comments\", JSON.stringify(\"super EARLY\"));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"office_id\" : {{current_office_id}},\n \"start_time\": {{start_time}},\n \"end_time\": {{end_time}},\n \"category\": {{category}},\n \"comments\": {{comments}}\n}" + }, + "url": { + "raw": "{{url}}appointments/{{appointment_id}}/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "{{appointment_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Appointment Delete End-point", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"appointment_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "88b43898-330f-4cf1-81c3-8cce3c53f54c", + "exec": [ + "// Check Response code for request", + "pm.test(\"Response code for request is 204\", function(){", + " pm.response.to.have.status(204);", + "});", + "", + "// Check if response time less than max allowed.", + "var response_max = JSON.parse(globals.response_max);", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}appointments/{{appointment_id}}/", + "host": [ + "{{url}}appointments" + ], + "path": [ + "{{appointment_id}}", + "" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "id": "1bfedebf-df09-4b2b-8c49-78fc3b07e34b", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "787fad5e-5387-4a35-a8f5-0fdb115be54a", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "id": "278ecdd2-62d5-4df1-8d7f-b4cc71138575", + "key": "auth_variable", + "value": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICI1NXhiZzcyaml6NWQ3cEtkbzdwNFhLdTB2VFA2UXMtemthZzFaY1ZKWTZVIn0.eyJqdGkiOiJmZWVlYzU4YS0zOTY0LTQwZDgtOTk3Ni02OTg1ZjNiNmQ2NzYiLCJleHAiOjE1NDQwMzY2NzQsIm5iZiI6MCwiaWF0IjoxNTQ0MDM0ODc0LCJpc3MiOiJodHRwczovL3Nzby10ZXN0LnBhdGhmaW5kZXIuZ292LmJjLmNhL2F1dGgvcmVhbG1zL3NiYyIsImF1ZCI6ImNmbXMtREVWIiwic3ViIjoiY2ZmNTQ3MDItZTkzMC00YjZlLTlhYzgtMmZkMTRjY2FmNzUxIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiY2Ztcy1ERVYiLCJub25jZSI6ImM1Zjg1NzBmLTgwNDktNDUxNC04Mjg4LTJjN2RmMzdkZTc5NSIsImF1dGhfdGltZSI6MTU0NDAzMjgxNywic2Vzc2lvbl9zdGF0ZSI6IjM4YjhiYzY4LTdmZDktNDE0NC04YWQ1LTI4ZGRlNmMwYWE1MCIsImFjciI6IjEiLCJhbGxvd2VkLW9yaWdpbnMiOlsiKiJdLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsidW1hX2F1dGhvcml6YXRpb24iXX0sInJlc291cmNlX2FjY2VzcyI6eyJhY2NvdW50Ijp7InJvbGVzIjpbIm1hbmFnZS1hY2NvdW50IiwibWFuYWdlLWFjY291bnQtbGlua3MiLCJ2aWV3LXByb2ZpbGUiXX19LCJuYW1lIjoiQ0ZNUyBQb3N0bWFuIE9wZXJhdG9yIiwicHJlZmVycmVkX3VzZXJuYW1lIjoiY2Ztcy1wb3N0bWFuLW9wZXJhdG9yIiwiZ2l2ZW5fbmFtZSI6IkNGTVMgUG9zdG1hbiIsImZhbWlseV9uYW1lIjoiT3BlcmF0b3IifQ.CaDq7kLDMu1oqUVm6fhiAw4ubu_D4jVdkXrqLjfCxu9b-9GzyNSIK1Gy0NCesN3caG684-Ofv3LlragMOwdoRhx-xkO6j5rqPhh2EdEDYTGkrnmQrVBjgHECLYN3RSAUWk4oKsp7gRMLDorU6QWLZNRWe9qlzulbss08Mut4nZz1RV0CirvJQ9oshBdpstQIPBM7ZEptcF2AOnc8swcFMJ3mqdrs0ImytArwZEzYwRzSIAR0-kYW-AXq-TK1dk2R7fqkMXmy3ZdHoQlFRfNtfYILVPzBAq3zPftrD-lmCcfUWz-0UcwhmNELQ-Pej-t_Z_eFSPPGkAVIuv_kkHbqQw", + "type": "string" + } + ], + "protocolProfileBehavior": {} +} diff --git a/api/postman/Load_Test_Exam.json b/api/postman/Load_Test_Exam.json index ba772d631..e49d4901f 100644 --- a/api/postman/Load_Test_Exam.json +++ b/api/postman/Load_Test_Exam.json @@ -1,3497 +1,3859 @@ { - "info": { - "_postman_id": "b8ea4228-164b-4447-a63e-d2c384530553", - "name": "Load_Test_Exam", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" - }, - "item": [ - { - "name": "Setup", - "item": [ - { - "name": "Setup-Variables", - "event": [ - { - "listen": "test", - "script": { - "id": "5409b66d-67a4-449b-8633-9aeca632b388", - "exec": [ - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "e9eed831-7955-4218-a400-ae6e1e7e2e10", - "exec": [ - "// See if the use-prefix global has been set. Use default if not.", - "let usePrefix = '';", - "if (pm.globals.get('use-prefix')) {", - " console.log(\"==> use-prefix exists\");", - " usePrefix = pm.globals.get('use-prefix');", - " console.log(\" --> Prefix is: \" + usePrefix);", - " ", - " // Set up all globals, using the correct prefix.", - " pm.globals.set('auth_url', pm.globals.get(usePrefix + 'auth_url'));", - " pm.globals.set('realm', pm.globals.get(usePrefix + 'realm'));", - " pm.globals.set('clientid', pm.globals.get(usePrefix + 'clientid'));", - " pm.globals.set('client_secret', pm.globals.get(usePrefix + 'client_secret'));", - " pm.globals.set('url', pm.globals.get(usePrefix + 'url'));", - "}", - "else {", - " console.log(\"==> use-prefix does not exist\");", - " console.log(\" --> No default globals set.\");", - "}", - "", - "// If no maximum load time defined, set a default.", - "if (!pm.globals.get('max_load_time')) {", - " console.log(\"==> max_load_time not present, default set.\");", - " pm.globals.set(\"max_load_time\", JSON.stringify(1503));", - "}", - "", - "// If no maximum response defined, set a default.", - "if (!pm.globals.get('max_response_time')) {", - " console.log(\"==> max_response_time not present, default set.\");", - " pm.globals.set(\"max_response_time\", JSON.stringify(15005));", - "}", - "", - "// Display the values of all globals.", - "console.log(\"\");", - "console.log(\"==> Globals are:\");", - "console.log(\" --> auth_url: \" + pm.globals.get(\"auth_url\"));", - "console.log(\" --> realm: \" + pm.globals.get(\"realm\"));", - "console.log(\" --> clientid: \" + pm.globals.get(\"clientid\"));", - "console.log(\" --> client_secret: \" + pm.globals.get(\"client_secret\"));", - "console.log(\" --> url: \" + pm.globals.get(\"url\"));", - "console.log(\" --> max_load_time: \" + pm.globals.get(\"max_load_time\"));", - "console.log(\" --> max_response_time: \" + pm.globals.get(\"max_response_time\"));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Dummy data." - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Auth-First", - "event": [ - { - "listen": "test", - "script": { - "id": "5409b66d-67a4-449b-8633-9aeca632b388", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"auth_first\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "auth_url = globals.auth_url;\nrealm = globals.realm;\nclientid = globals.clientid;\nuserid = globals.userid;\npassword = globals.password;\nclient_secret = globals.client_secret;\n\nconst echoPostRequest = {\n url: auth_url + '/auth/realms/' + realm + '/protocol/openid-connect/token',\n method: 'POST',\n header: 'Content-Type:application/x-www-form-urlencoded',\n body: {\n mode: 'raw',\n raw: 'grant_type=password&client_id=' + clientid \n + '&username=' + userid \n + '&password=' + password\n + '&client_secret=' + client_secret\n }\n};\npm.sendRequest(echoPostRequest, function (err, res) {\n var jsonData = res.json();\n if (jsonData.hasOwnProperty('access_token')) {\n \tpm.environment.set(\"token\", jsonData.access_token);\n\t pm.environment.set(\"refresh_token\", jsonData.refresh_token);\n\t console.log(err ? err : res.json());\n\t} else {\n\t pm.environment.set(\"token\", 0);\n\t pm.environment.set(\"refresh_token\", 0);\n\t pm.environment.set(\"token_expires\", 0);\n\t pm.environment.set(\"refresh_token_expires\", 0);\n\t}\n});" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Auth-Script", - "event": [ - { - "listen": "test", - "script": { - "id": "f386cf22-bb0f-47d9-9c22-cda162ed4375", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"auth_script\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "auth_url = globals.auth_url;\nrealm = globals.realm;\nclientid = globals.clientid;\nuserid = environment.userid;\npassword = globals.password;\nclient_secret = globals.client_secret;\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Basic-Response-Tests", - "event": [ - { - "listen": "test", - "script": { - "id": "a0d8e240-3b40-4654-a32b-bf2e676fdeb9", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"basic_response_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Test the authenticate response.\npm.test(\"Response time should be below 1500ms\", function() {\n pm.expect(pm.response.responseTime).to.be.below(1500);\n});\npm.test('Response statusCode should be 200 OK', function() {\n pm.response.to.have.status(200);\n});\npm.test('Response header should have Content-Type of application/json', function() {\n pm.response.to.have.header('content-type', 'application/json');\n});\npm.test('Response body be in JSON format', function() {\n pm.response.to.be.json; \n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Complex-Response-Tests", - "event": [ - { - "listen": "test", - "script": { - "id": "f006b951-3205-4f21-a315-369f85591929", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"complex_response_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Test the authenticate response.\npm.test('Response time should be below 25000ms', function() {\n pm.response.responseTime.to.be.below(25000);\n});\npm.test('Response statusCode should be 200 OK', function() {\n response.to.have.status(200);\n});\npm.test('Response header should have Content-Type of application/json', function() {\n response.to.have.header('content-type', 'application/json');\n});\npm.test('Response body be in JSON format', function() {\n response.to.be.json; \n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Create-Response-Tests", - "event": [ - { - "listen": "test", - "script": { - "id": "382b7b65-d736-4a03-a44a-3891f33b617d", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"create_response_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Test the authenticate response.\npm.test('Response time should be below 20000ms', function() {\n pm.expect(pm.response.responseTime).to.be.below(20000);\n});\npm.test('Response statusCode should be 201 CREATED', function() {\n pm.response.to.have.status(201);\n});\npm.test('Response header should have Content-Type of application/json', function() {\n pm.response.to.have.header('content-type', 'application/json');\n});\npm.test('Response body be in JSON format', function() {\n pm.response.to.be.json; \n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Exam-Type-Data", - "event": [ - { - "listen": "test", - "script": { - "id": "382b7b65-d736-4a03-a44a-3891f33b617d", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"init_exam_type_data\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Finds an exam name in the JSON list allTypes of exam types.\nfunction find_exam(input_exam_name, allTypes) {\n\texam_id_value = -1;\n\n // Loop to look for the input exam name.\n if (allTypes) {\n allTypes.forEach(function(type) {\n if ((type.exam_type_name) == input_exam_name) {\n exam_id_value = type.exam_type_id;\n }\n });\n }\n \n // If the exam wasn't found, set it to be the first exam.\n if (exam_id_value == -1) {\n exam_id_value = allTypes[0].exam_type_id;\n }\n\n // Return the exam_id_type of the input exam name.\n return exam_id_value;\n}\n\n// Get the list of all possible exam types.\nallTypes = null;\nvar jsonData = JSON.parse(responseBody);\nif (jsonData.hasOwnProperty(\"exam_types\")) {\n\tallTypes = jsonData.exam_types;\n}\n\nexam_array = [];\nexam_array.push({name: \"Pesticide\", weight: 40.2, id: find_exam(\"Pesticide\", allTypes)});\nname = \"IPSE - 4HR Single Exam\";\nexam_array.push({name: name, weight: exam_array[0].weight + 14.5, id: find_exam(name, allTypes)});\nname = \"SLE - 3HR Group Exam\";\nexam_array.push({name: name, weight: exam_array[1].weight + 7.4, id: find_exam(name, allTypes)});\nname = \"COFQ - 3HR Group Exam\";\nexam_array.push({name: name, weight: exam_array[2].weight + 5.8, id: find_exam(name, allTypes)});\nname = \"IPSE - 4HR Group Exam\";\nexam_array.push({name: name, weight: exam_array[3].weight + 5.7, id: find_exam(name, allTypes)});\nname = \"COFQ - 3HR Single Exam\";\nexam_array.push({name: name, weight: exam_array[4].weight + 5.5, id: find_exam(name, allTypes)});\nname = \"Monthly Session Exam\";\nexam_array.push({name: name, weight: exam_array[5].weight + 3.8, id: find_exam(name, allTypes)});\nname = \"SLE - 3HR Single Exam\";\nexam_array.push({name: name, weight: exam_array[6].weight + 3.5, id: find_exam(name, allTypes)});\nname = \"Angling Guide Outfitter\";\nexam_array.push({name: name, weight: exam_array[7].weight + 2.4, id: find_exam(name, allTypes)});\nname = \"IPSE - 5HR Single Exam - Time Extension\";\nexam_array.push({name: name, weight: exam_array[8].weight + 2.3, id: find_exam(name, allTypes)});\nname = \"Exam Booking - 3 Hour Miscellaneous\";\nexam_array.push({name: name, weight: exam_array[9].weight + 1.7, id: find_exam(name, allTypes)});\n\n// Store the initialized exam data for later use.\npostman.setEnvironmentVariable(\"exam_array_data\", JSON.stringify(exam_array));" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Exam-Get-Random", - "event": [ - { - "listen": "test", - "script": { - "id": "382b7b65-d736-4a03-a44a-3891f33b617d", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"create_random_functions\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Function returns a weighted randomized exam type index.\nfunction get_random_index(exam_array) {\n\n // Generate a random number up to the maximum weight allowed.\n random_number = Math.floor(Math.random() * exam_array[exam_array.length - 1].weight);\n \n // Get the index of the exam type corresponding to that weight.\n index = get_index(random_number, exam_array);\n\n // Return the index.\n return index;\n}\n\n// Based on a random number, turns it into a weighted randomized exam type index.\nfunction get_index(random_value, exam_array) {\n index = 0;\n var i;\n for (i = 0; i < exam_array.length; i++) {\n if (random_value <= exam_array[i].weight) {\n index = i;\n break;\n }\n }\n \n return index;\n}\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Exam-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "id": "8cebcf78-f5a2-4694-b108-60e146791a78", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"exam_schema_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the JSON Schema expected in response\nvar examSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"exam\": {\n \"type\": \"object\",\n \"properties\": {\n \"booking_id\": {},\n \"deleted_date\": {},\n \"event_id\": {\"type\": \"string\"},\n \"exam_id\": {\"type\": \"number\"},\n \"exam_method\": {\"type\": \"string\"},\n \"exam_name\": {\"type\": \"string\"},\n \"exam_received_date\": {},\n \"exam_returned_tracking_number\": {},\n \"exam_type\": {\n \"type\": \"object\",\n \"properties\": {\n \"exam_color\": {\"type\": \"string\"},\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_type_name\": {\"type\": \"string\"},\n \"group_exam_ind\": {\"type\": \"number\"},\n \"ita_ind\": {\"type\": \"number\"},\n \"method_type\": {\"type\": \"string\"},\n \"number_of_hours\": {\"type\": \"number\"},\n \"number_of_minutes\": {\"type\": [\"number\", \"null\"]},\n \"pesticide_exam_ind\": {\"type\": \"number\" }\n },\n \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"group_exam_ind\", \"ita_ind\", \"method_type\", \"number_of_hours\", \"number_of_minutes\", \"pesticide_exam_ind\"]\n },\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_written_ind\": {\"type\": \"number\"},\n \"examinee_name\": {\"type\": \"string\"},\n \"expiry_date\": {\"type\": [\"string\", \"null\"]},\n \"notes\": {\"type\": \"string\"},\n \"number_of_students\": {\"type\": \"number\"},\n \"office\":{\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\" },\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\" : \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n },\n },\n \"required\": []\n },\n \"office_id\": {\"type\": \"number\"},\n \"offsite_location\": {},\n \"session_number\": {\"type\": [\"number\", \"null\"]},\n \"booking\": {}\n },\n \"required\": [\"booking\", \"booking_id\", \"deleted_date\", \"event_id\", \"exam_id\", \"exam_method\", \"exam_name\", \"exam_received_date\", \"exam_returned_tracking_number\", \"exam_type\", \"exam_type_id\", \"exam_written_ind\", \"examinee_name\", \"expiry_date\", \"notes\", \"number_of_students\", \"office\", \"office_id\", \"offsite_location\", \"session_number\"]\n }\n },\n \"required\": [\"exam\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Exam Schema\", function(){\n pm.expect(tv4.validate(jsonData, examSchema)).to.be.true;\n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Exam-Data-Check", - "event": [ - { - "listen": "test", - "script": { - "id": "8cebcf78-f5a2-4694-b108-60e146791a78", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"exam_data_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Make sure that jsonData has an exam property.\npm.test(\"Response should have exam property\", function(){\n pm.expect(jsonData.hasOwnProperty(\"exam\")).to.be.true;\n});\n\n// If jsonData has exam property, check data.\nif (jsonData.hasOwnProperty(\"exam\")) {\n\n //Test to see if Event ID field remains unchanged\n pm.test(\"Validate Event Id has expected value\", function(){\n pm.expect(jsonData.event_id === environment.event_id);\n });\n\n //Test to see if exam method field remains unchanged\n pm.test(\"Validate exam method has expected value\", function(){\n pm.expect(jsonData.exam_method === environment.exam_method);\n });\n\n //Test to see if exam name field remains unchanged\n pm.test(\"Validate exam name has expected value\", function(){\n pm.expect(jsonData.exam_name === environment.exam_name);\n });\n\n //Test to see if exam type field remains unchanged\n pm.test(\"Validate exam type id has expected value\", function(){\n pm.expect(jsonData.exam_type_id === environment.random_exam_type_id);\n });\n\n //Test to see if exam written indicator field remains unchanged\n pm.test(\"Validate exam written indicator has expected value\", function(){\n pm.expect(jsonData.exam_written_ind === environment.exam_written_ind);\n });\n\n //Test to see if examinee name field remains unchanged\n pm.test(\"Validate examinee name has expected value\", function(){\n pm.expect(jsonData.examinee_name === environment.examinee_name);\n });\n\n //Test to see if notes field remains unchanged\n pm.test(\"Validate notes has expected value\", function(){\n pm.expect(jsonData.notes === environment.notes);\n });\n\n //Test to see if number of students field remains unchanged\n pm.test(\"Validate number of students has expected value\", function(){\n pm.expect(jsonData.number_of_students === environment.number_of_students);\n });\n\n //Test to see if office id remains unchanged\n pm.test(\"Validate office id has expected value\", function(){\n pm.expect(jsonData.office_id === environment.current_office_id);\n });\n\n //Test to see if offsite location is expected\n pm.test(\"Validate offsite location has expected value\", function(){\n pm.expect(jsonData.offsite_location === environment.offsite_location);\n });\n}\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Exam-List-Schema-Check", - "event": [ - { - "listen": "test", - "script": { - "id": "8cebcf78-f5a2-4694-b108-60e146791a78", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"exam_schema_list_check\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Define the JSON Schema expected in response\nvar examSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"exams\": {\n \"type\": \"array\",\n \"properties\": {\n \"booking_id\": {},\n \"deleted_date\": {},\n \"event_id\": {\"type\": \"string\"},\n \"exam_id\": {\"type\": \"number\"},\n \"exam_method\": {\"type\": \"string\"},\n \"exam_name\": {\"type\": \"string\"},\n \"exam_received_date\": {},\n \"exam_returned_tracking_number\": {},\n \"exam_type\": {\n \"type\": \"object\",\n \"properties\": {\n \"exam_color\": {\"type\": \"string\"},\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_type_name\": {\"type\": \"string\"},\n \"group_exam_ind\": {\"type\": \"number\"},\n \"ita_ind\": {\"type\": \"number\"},\n \"method_type\": {\"type\": \"string\"},\n \"number_of_hours\": {\"type\": \"number\"},\n \"number_of_minutes\": {\"type\": \"number\"},\n \"pesticide_exam_ind\": {\"type\": \"number\" }\n },\n \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"group_exam_ind\", \"ita_ind\", \"method_type\", \"number_of_hours\", \"number_of_minutes\", \"pesticide_exam_ind\"]\n },\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_written_ind\": {\"type\": \"number\"},\n \"examinee_name\": {\"type\": \"string\"},\n \"expiry_date\": {\"type\": [\"string\", \"null\"]},\n \"notes\": {\"type\": \"string\"},\n \"number_of_students\": {\"type\": \"number\"},\n \"office\":{\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\" },\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\" : \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n },\n },\n \"required\": []\n },\n \"office_id\": {\"type\": \"number\"},\n \"offsite_location\": {},\n \"session_number\": {\"type\": [\"number\", \"null\"]},\n \"booking\": {}\n },\n \"required\": [\"booking\", \"booking_id\", \"deleted_date\", \"event_id\", \"exam_id\", \"exam_method\", \"exam_name\", \"exam_received_date\", \"exam_returned_tracking_number\", \"exam_type\", \"exam_type_id\", \"exam_written_ind\", \"examinee_name\", \"expiry_date\", \"notes\", \"number_of_students\", \"office\", \"office_id\", \"offsite_location\", \"session_number\"]\n }\n },\n \"required\": [\"exams\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Exam List Schema\", function(){\n pm.expect(tv4.validate(jsonData, examSchema)).to.be.true;\n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "Who am I", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "if (jsonData.hasOwnProperty(\"csr\")) {", - "\tcurrentOfficeId = jsonData.csr.office_id;", - "\tcurrentOfficeNumber = jsonData.csr.office.office_number;", - "\tcurrentCsrId = jsonData.csr.csr_id;", - " postman.setEnvironmentVariable(\"current_office_id\", currentOfficeId);", - " postman.setEnvironmentVariable(\"current_office_number\", currentOfficeNumber);", - " postman.setEnvironmentVariable(\"current_csr_id\", currentCsrId);", - "};", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}csrs/me/", - "host": [ - "{{url}}csrs" - ], - "path": [ - "me", - "" - ] - } - }, - "response": [] - } - ], - "description": "This folder performs basic authentication features.", - "protocolProfileBehavior": {} - }, - { - "name": "Check app health", - "item": [ - { - "name": "Check healthz driver TheQ", - "event": [ - { - "listen": "test", - "script": { - "id": "74adc5ce-caa5-452a-bd96-8ac90a4c11d7", - "exec": [ - "// Get the maximum response time allowed.", - "max_load_time = JSON.parse(globals.max_load_time);", - "", - "// Set health response time variable.", - "health_tries = 15;", - "counter = 1;", - "postman.setEnvironmentVariable(\"health_tries\", JSON.stringify(health_tries));", - "postman.setEnvironmentVariable(\"health_counter\", JSON.stringify(counter));", - "", - "// Get the response.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Test the health response.", - "pm.test(\"Health Driver: Try \" + counter.toString() + \": Response should have 'message' property\", function() {", - " pm.expect(jsonData).to.have.property('message');", - "});", - "", - "pm.test(\"Response message should be 'api is healthy'\", function() {", - " pm.expect(jsonData.message).to.be.eql('api is healthy');", - "});", - "", - "// If response time is OK, proceed to the next test.", - "if (pm.response.responseTime < max_load_time) {", - " postman.setNextRequest(\"Check the readyz endpoint TheQ\");", - "}", - " ", - "// Response time is too long. Try again, give pod a chance to spin up.", - "else {", - " postman.setNextRequest(\"Check the healthz endpoint TheQ\");", - "}" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}healthz/", - "host": [ - "{{url}}healthz" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Check the healthz endpoint TheQ", - "event": [ - { - "listen": "test", - "script": { - "id": "74adc5ce-caa5-452a-bd96-8ac90a4c11d7", - "exec": [ - "// Get the maximum load time allowed.", - "max_load_time = JSON.parse(postman.getEnvironmentVariable(\"max_load_time\"));", - "", - "// Get and update variables.", - "health_tries = JSON.parse(postman.getEnvironmentVariable(\"health_tries\"));", - "counter = JSON.parse(postman.getEnvironmentVariable(\"health_counter\")) + 1;", - "postman.setEnvironmentVariable(\"health_counter\", JSON.stringify(counter));", - "", - "// Get the response.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Test the health response.", - "pm.test(\"Health Driver: Try \" + counter.toString() + \": Response should have 'message' property\", function() {", - " pm.expect(jsonData).to.have.property('message');", - "});", - "", - "pm.test(\"Response message should be 'api is healthy'\", function() {", - " pm.expect(jsonData.message).to.be.eql('api is healthy');", - "});", - "", - "// If response time is OK, proceed to the next test.", - "if (pm.response.responseTime < max_load_time) {", - " postman.setNextRequest(\"Check the readyz endpoint TheQ\");", - "}", - " ", - "// Response time is too long.", - "else {", - " ", - " // You haven't reached your maximum tries yet. Try again.", - " if (counter < health_tries) {", - " postman.setNextRequest(\"Check the healthz endpoint\");", - " }", - " ", - " // You have reached the maximum. An error, go to next test.", - " else {", - " pm.test(\"Response should be below \" + max_load_time.toString() + ' in ' + health_tries.toString() + ' tries.', function() {", - " pm.expect(counter).to.be.below(health_tries);", - " });", - " postman.setNextRequest(\"Check the readyz endpoint TheQ\");", - " }", - "}", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}healthz/", - "host": [ - "{{url}}healthz" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Check the readyz endpoint TheQ", - "event": [ - { - "listen": "test", - "script": { - "id": "661c33c4-4a3d-4396-a549-9969edafbfa6", - "exec": [ - "// Perform the standard tests.", - "eval(environment.basic_response_test);", - "", - "var jsonData = JSON.parse(responseBody);", - "", - "// Test the health response.", - "pm.test(\"Response should have 'message' property\", function() {", - " pm.expect(jsonData).to.have.property('message');", - "});", - "", - "pm.test(\"Response message should be 'api is ready'\", function() {", - " pm.expect(jsonData.message).to.be.eql('api is ready');", - "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}readyz/", - "host": [ - "{{url}}readyz" - ], - "path": [ - "" - ] - } - }, - "response": [] - } - ], - "description": "Checks the application health by calling the healthz and readyz endpoints", - "protocolProfileBehavior": {} - }, - { - "name": "Check user login", - "item": [ - { - "name": "Authenticate user", - "event": [ - { - "listen": "test", - "script": { - "id": "43df8e47-2b93-48b0-a5ff-bb3396d12537", - "exec": [ - "// Do the basic checks.", - "eval(environment.basic_response_test);", - "", - "// Get the response.", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to make sure that the access token field is not null", - "pm.test(\"Access Token is not null\", function(){", - " var access_token = jsonData.access_token;", - " pm.expect(access_token).not.eql(null);", - "});", - "", - "//Test to make sure that the refresh token response field is not null", - "pm.test(\"Refresh Token is not null\", function(){", - " var refresh_token = jsonData.refresh_token;", - " pm.expect(refresh_token).not.eql(null);", - "});", - "", - "//Test to make sure that expires in response field is not nullf", - "pm.test(\"Expires In is not null\", function(){", - " var expires_in = jsonData.expires_in;", - " pm.expect(expires_in).not.eql(null);", - "});", - "", - "//Test to make sure that refresh expires in response fiels is not null", - "pm.test(\"Refresh Expires In is not null\", function(){", - " var refresh_expires_in = jsonData.refresh_expires_in;", - " pm.expect(refresh_expires_in).not.eql(null);", - "});", - "", - "var jsonData = pm.response.json();", - "pm.globals.set(\"token\", jsonData.access_token);", - "pm.globals.set(\"refresh_token\", jsonData.refresh_token);", - "pm.globals.set(\"token_expires\", Date.now()+(jsonData.expires_in * 1000));", - "pm.globals.set(\"refresh_token_expires\", Date.now()+(jsonData.refresh_expires_in * 1000));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/x-www-form-urlencoded" - } - ], - "body": { - "mode": "raw", - "raw": "grant_type=password&client_id={{clientid}}&username={{userid}}&password={{password}}&client_secret={{client_secret}}" - }, - "url": { - "raw": "{{auth_url}}/auth/realms/{{realm}}/protocol/openid-connect/token?Content-Type=application/x-www-form-urlencoded", - "host": [ - "{{auth_url}}" - ], - "path": [ - "auth", - "realms", - "{{realm}}", - "protocol", - "openid-connect", - "token" - ], - "query": [ - { - "key": "Content-Type", - "value": "application/x-www-form-urlencoded" - } - ] - }, - "description": "Make sure the operator ID can log in" - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Get Exam Types", - "item": [ - { - "name": "Exam Type List", - "event": [ - { - "listen": "test", - "script": { - "id": "2df2a851-6a71-48e6-b44f-ccf096fe9d83", - "exec": [ - "// Define the JSON Schema expected in response", - "var examTypeSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"exam_color\": {\"type\": \"string\"},", - " \"exam_type_id\": {\"type\": \"number\"},", - " \"exam_type_name\": {\"type\": \"string\"},", - " \"ita_ind\": {\"type\": \"number\"},", - " \"method_type\": {\"type\": \"string\"},", - " \"number_of_hours\": {\"type\": \"number\"},", - " \"group_exam_ind\": {\"type\": \"number\"}", - " },", - " \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"ita_ind\", \"method_type\", \"number_of_hours\", \"group_exam_ind\"]", - " },", - " \"required\": []", - "}; ", - "", - "// Get the max response time allowed.", - "console.log(\"==> Before getting response max\");", - "var response_max = JSON.parse(globals.max_response_time);", - "", - "// Check Response code for request", - "console.log(\"==> Before checking response code\");", - "pm.test(\"Response code for request is 200\", function(){", - " pm.response.to.have.status(200);", - "});", - "", - "console.log(\"==> Before checking response time\");", - "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", - " pm.expect(pm.response.responseTime).to.be.below(response_max);", - "});", - "", - "// Parse response body", - "console.log(\"==> Before getting response body\");", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "console.log(\"==> Before checking schema\");", - "pm.test(\"Validate Response Exam Type Schema\", function(){", - " pm.expect(tv4.validate(jsonData, examTypeSchema)).to.be.true;", - "});", - "", - "// Store all exam type IDs for future use in adding exams", - "console.log(\"==> Before allelements\");", - "var allExamIds = [];", - "", - "// Make sure some data returned.", - "console.log(\"==> Before checking there is an exam_types property\");", - "pm.test(\"Response has exam_types property\", function(){", - " pm.expect(jsonData.hasOwnProperty(\"exam_types\")).to.be.true;", - "});", - "console.log(\"==> Before checking at least one exam type\");", - "pm.test(\"Response has at least one exam_type\", function(){", - " pm.expect(jsonData.exam_types.length).to.be.above(0);", - "});", - "", - "// Set up list of valid exam types, create random functions.", - "console.log(\"==> setting environment variables\");", - "eval(environment.init_exam_type_data);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{url}}exam_types/", - "host": [ - "{{url}}exam_types" - ], - "path": [ - "" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Exam test 5 updates", - "item": [ - { - "name": "Create exam", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Get exam type data and functions.", - "exam_array = JSON.parse(postman.getEnvironmentVariable(\"exam_array_data\"));", - "eval(environment.create_random_functions);", - "", - "// Create an event number based on the time.", - "var ms = (new Date().getTime()).toString() + \"00\";", - "eventNumber = Number(ms.substring(ms.length-6, ms.len)) + 1;", - "postman.setEnvironmentVariable(\"event_number\", eventNumber);", - "", - "// Update the next event ID.", - "var eventId = \"pm\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", 0);", - "postman.setEnvironmentVariable(\"event_id\", JSON.stringify(eventId));", - "postman.setEnvironmentVariable(\"event_delete\", eventId);", - "", - "// Calculate a random exam type to use.", - "random_index = get_random_index(exam_array);", - "", - "// Store for use.", - "random_exam_type_id = exam_array[random_index].id;", - "postman.setEnvironmentVariable(\"random_exam_type_id\", JSON.stringify(random_exam_type_id.toString()));" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "if (jsonData.hasOwnProperty(\"exam\")) {", - "\tcurrentExamId = jsonData.exam.exam_id;", - " postman.setEnvironmentVariable(\"current_exam_id\", currentExamId);", - "};", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}", - "type": "text" - }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\n\t\"event_id\" : {{event_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : \"Postman Group Exam Name\",\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : \"Pm examinee name\",\n \"notes\" : \"Pm sample notes\",\n \"number_of_students\" : \"19\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : \"Pm test location\"\n}" - }, - "url": { - "raw": "{{url}}exams/", - "host": [ - "{{url}}exams" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Update exam info (1-1)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}\n" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Update exam info (1-2)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Update exam info (1-3)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Update exam info (1-4)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Update exam info (1-5)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "List exams", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite locatoin - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : \"6\",\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" - }, - "url": { - "raw": "{{url}}exams/?office_number={{current_office_number}}", - "host": [ - "{{url}}exams" - ], - "path": [ - "" - ], - "query": [ - { - "key": "office_number", - "value": "{{current_office_number}}" - } - ] - } - }, - "response": [] - }, - { - "name": "Delete exam", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "0ec5c421-a4af-4424-8201-86864e291f0e", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}", - "type": "text" - } - ], - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Exam test 3 updates", - "item": [ - { - "name": "Create exam", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Get exam type data and functions.", - "exam_array = JSON.parse(postman.getEnvironmentVariable(\"exam_array_data\"));", - "eval(environment.create_random_functions);", - "", - "// Create an event number based on the time.", - "var ms = (new Date().getTime()).toString() + \"00\";", - "eventNumber = Number(ms.substring(ms.length-6, ms.len)) + 1;", - "postman.setEnvironmentVariable(\"event_number\", eventNumber);", - "", - "// Update the next event ID.", - "var eventId = \"pm\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", 0);", - "postman.setEnvironmentVariable(\"event_id\", JSON.stringify(eventId));", - "postman.setEnvironmentVariable(\"event_delete\", eventId);", - "", - "// Calculate a random exam type to use.", - "random_index = get_random_index(exam_array);", - "", - "// Store for use.", - "random_exam_type_id = exam_array[random_index].id;", - "postman.setEnvironmentVariable(\"random_exam_type_id\", JSON.stringify(random_exam_type_id.toString()));" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "if (jsonData.hasOwnProperty(\"exam\")) {", - "\tcurrentExamId = jsonData.exam.exam_id;", - " postman.setEnvironmentVariable(\"current_exam_id\", currentExamId);", - "};", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}", - "type": "text" - }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\n\t\"event_id\" : {{event_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : \"Postman Group Exam Name\",\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : \"Pm examinee name\",\n \"notes\" : \"Pm sample notes\",\n \"number_of_students\" : \"19\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : \"Pm test location\"\n}" - }, - "url": { - "raw": "{{url}}exams/", - "host": [ - "{{url}}exams" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Update exam info (2-1)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Update exam info (2-2)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Update exam info (2-3)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "List exams", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite locatoin - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : \"6\",\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" - }, - "url": { - "raw": "{{url}}exams/?office_number={{current_office_number}}", - "host": [ - "{{url}}exams" - ], - "path": [ - "" - ], - "query": [ - { - "key": "office_number", - "value": "{{current_office_number}}" - } - ] - } - }, - "response": [] - }, - { - "name": "Delete exam", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "0ec5c421-a4af-4424-8201-86864e291f0e", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}", - "type": "text" - } - ], - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Exam tests 8 updates", - "item": [ - { - "name": "Create exam", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Get exam type data and functions.", - "exam_array = JSON.parse(postman.getEnvironmentVariable(\"exam_array_data\"));", - "eval(environment.create_random_functions);", - "", - "// Create an event number based on the time.", - "var ms = (new Date().getTime()).toString() + \"00\";", - "eventNumber = Number(ms.substring(ms.length-6, ms.len)) + 1;", - "postman.setEnvironmentVariable(\"event_number\", eventNumber);", - "", - "// Update the next event ID.", - "var eventId = \"pm\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", 0);", - "postman.setEnvironmentVariable(\"event_id\", JSON.stringify(eventId));", - "postman.setEnvironmentVariable(\"event_delete\", eventId);", - "", - "// Calculate a random exam type to use.", - "random_index = get_random_index(exam_array);", - "", - "// Store for use.", - "random_exam_type_id = exam_array[random_index].id;", - "postman.setEnvironmentVariable(\"random_exam_type_id\", JSON.stringify(random_exam_type_id.toString()));" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "if (jsonData.hasOwnProperty(\"exam\")) {", - "\tcurrentExamId = jsonData.exam.exam_id;", - " postman.setEnvironmentVariable(\"current_exam_id\", currentExamId);", - "};", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}", - "type": "text" - }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\n\t\"event_id\" : {{event_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : \"Postman Group Exam Name\",\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : \"Pm examinee name\",\n \"notes\" : \"Pm sample notes\",\n \"number_of_students\" : \"19\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : \"Pm test location\"\n}" - }, - "url": { - "raw": "{{url}}exams/", - "host": [ - "{{url}}exams" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Update exam info (3-1)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Update exam info (3-2)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Update exam info (3-3)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Update exam info (3-4)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Update exam info (3-5)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Update exam info (3-6)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Update exam info (3-7)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "Update exam info (3-8)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "List exams", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite locatoin - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : \"6\",\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" - }, - "url": { - "raw": "{{url}}exams/?office_number={{current_office_number}}", - "host": [ - "{{url}}exams" - ], - "path": [ - "" - ], - "query": [ - { - "key": "office_number", - "value": "{{current_office_number}}" - } - ] - } - }, - "response": [] - }, - { - "name": "Delete exam", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "0ec5c421-a4af-4424-8201-86864e291f0e", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}", - "type": "text" - } - ], - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Exam 1 test single update", - "item": [ - { - "name": "Create exam", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Get exam type data and functions.", - "exam_array = JSON.parse(postman.getEnvironmentVariable(\"exam_array_data\"));", - "eval(environment.create_random_functions);", - "", - "// Create an event number based on the time.", - "var ms = (new Date().getTime()).toString() + \"00\";", - "eventNumber = Number(ms.substring(ms.length-6, ms.len)) + 1;", - "postman.setEnvironmentVariable(\"event_number\", eventNumber);", - "", - "// Update the next event ID.", - "var eventId = \"pm\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", 0);", - "postman.setEnvironmentVariable(\"event_id\", JSON.stringify(eventId));", - "postman.setEnvironmentVariable(\"event_delete\", eventId);", - "", - "// Calculate a random exam type to use.", - "random_index = get_random_index(exam_array);", - "", - "// Store for use.", - "random_exam_type_id = exam_array[random_index].id;", - "postman.setEnvironmentVariable(\"random_exam_type_id\", JSON.stringify(random_exam_type_id.toString()));" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "if (jsonData.hasOwnProperty(\"exam\")) {", - "\tcurrentExamId = jsonData.exam.exam_id;", - " postman.setEnvironmentVariable(\"current_exam_id\", currentExamId);", - "};", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}", - "type": "text" - }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\n\t\"event_id\" : {{event_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : \"Postman Group Exam Name\",\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : \"Pm examinee name\",\n \"notes\" : \"Pm sample notes\",\n \"number_of_students\" : \"19\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : \"Pm test location\"\n}" - }, - "url": { - "raw": "{{url}}exams/", - "host": [ - "{{url}}exams" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Update exam info", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "List exams", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : \"6\",\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" - }, - "url": { - "raw": "{{url}}exams/?office_number={{current_office_number}}", - "host": [ - "{{url}}exams" - ], - "path": [ - "" - ], - "query": [ - { - "key": "office_number", - "value": "{{current_office_number}}" - } - ] - } - }, - "response": [] - }, - { - "name": "Delete exam", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "0ec5c421-a4af-4424-8201-86864e291f0e", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}", - "type": "text" - } - ], - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Exam 2 test single update", - "item": [ - { - "name": "Create exam", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Get exam type data and functions.", - "exam_array = JSON.parse(postman.getEnvironmentVariable(\"exam_array_data\"));", - "eval(environment.create_random_functions);", - "", - "// Create an event number based on the time.", - "var ms = (new Date().getTime()).toString() + \"00\";", - "eventNumber = Number(ms.substring(ms.length-6, ms.len)) + 1;", - "postman.setEnvironmentVariable(\"event_number\", eventNumber);", - "", - "// Update the next event ID.", - "var eventId = \"pm\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", 0);", - "postman.setEnvironmentVariable(\"event_id\", JSON.stringify(eventId));", - "postman.setEnvironmentVariable(\"event_delete\", eventId);", - "", - "// Calculate a random exam type to use.", - "random_index = get_random_index(exam_array);", - "", - "// Store for use.", - "random_exam_type_id = exam_array[random_index].id;", - "postman.setEnvironmentVariable(\"random_exam_type_id\", JSON.stringify(random_exam_type_id.toString()));" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "if (jsonData.hasOwnProperty(\"exam\")) {", - "\tcurrentExamId = jsonData.exam.exam_id;", - " postman.setEnvironmentVariable(\"current_exam_id\", currentExamId);", - "};", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}", - "type": "text" - }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\n\t\"event_id\" : {{event_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : \"Postman Group Exam Name\",\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : \"Pm examinee name\",\n \"notes\" : \"Pm sample notes\",\n \"number_of_students\" : \"19\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : \"Pm test location\"\n}" - }, - "url": { - "raw": "{{url}}exams/", - "host": [ - "{{url}}exams" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Update exam info", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "List exams", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : \"6\",\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" - }, - "url": { - "raw": "{{url}}exams/?office_number={{current_office_number}}", - "host": [ - "{{url}}exams" - ], - "path": [ - "" - ], - "query": [ - { - "key": "office_number", - "value": "{{current_office_number}}" - } - ] - } - }, - "response": [] - }, - { - "name": "Delete exam", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "0ec5c421-a4af-4424-8201-86864e291f0e", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}", - "type": "text" - } - ], - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Exam 3 test single update", - "item": [ - { - "name": "Create exam", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Get exam type data and functions.", - "exam_array = JSON.parse(postman.getEnvironmentVariable(\"exam_array_data\"));", - "eval(environment.create_random_functions);", - "", - "// Create an event number based on the time.", - "var ms = (new Date().getTime()).toString() + \"00\";", - "eventNumber = Number(ms.substring(ms.length-6, ms.len)) + 1;", - "postman.setEnvironmentVariable(\"event_number\", eventNumber);", - "", - "// Update the next event ID.", - "var eventId = \"pm\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", 0);", - "postman.setEnvironmentVariable(\"event_id\", JSON.stringify(eventId));", - "postman.setEnvironmentVariable(\"event_delete\", eventId);", - "", - "// Calculate a random exam type to use.", - "random_index = get_random_index(exam_array);", - "", - "// Store for use.", - "random_exam_type_id = exam_array[random_index].id;", - "postman.setEnvironmentVariable(\"random_exam_type_id\", JSON.stringify(random_exam_type_id.toString()));" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "if (jsonData.hasOwnProperty(\"exam\")) {", - "\tcurrentExamId = jsonData.exam.exam_id;", - " postman.setEnvironmentVariable(\"current_exam_id\", currentExamId);", - "};", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}", - "type": "text" - }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\n\t\"event_id\" : {{event_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : \"Postman Group Exam Name\",\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : \"Pm examinee name\",\n \"notes\" : \"Pm sample notes\",\n \"number_of_students\" : \"19\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : \"Pm test location\"\n}" - }, - "url": { - "raw": "{{url}}exams/", - "host": [ - "{{url}}exams" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Update exam info", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" - }, - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - }, - { - "name": "List exams", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "", - "// Update the next event ID.", - "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", - "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", - "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", - "postman.setEnvironmentVariable(\"update_number\", updateNumber);", - "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", - "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", - "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : \"6\",\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" - }, - "url": { - "raw": "{{url}}exams/?office_number={{current_office_number}}", - "host": [ - "{{url}}exams" - ], - "path": [ - "" - ], - "query": [ - { - "key": "office_number", - "value": "{{current_office_number}}" - } - ] - } - }, - "response": [] - }, - { - "name": "Delete exam", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "0ec5c421-a4af-4424-8201-86864e291f0e", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}", - "type": "text" - } - ], - "url": { - "raw": "{{url}}exams/{{current_exam_id}}/", - "host": [ - "{{url}}exams" - ], - "path": [ - "{{current_exam_id}}", - "" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - } - ], - "protocolProfileBehavior": {} -} \ No newline at end of file + "info": { + "_postman_id": "b8ea4228-164b-4447-a63e-d2c384530553", + "name": "Load_Test_Exam", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "Setup", + "item": [ + { + "name": "Setup-Variables", + "event": [ + { + "listen": "test", + "script": { + "id": "5409b66d-67a4-449b-8633-9aeca632b388", + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "e9eed831-7955-4218-a400-ae6e1e7e2e10", + "exec": [ + "// See if the use-prefix global has been set. Use default if not.", + "let usePrefix = '';", + "if (pm.globals.get('use-prefix')) {", + " console.log(\"==> use-prefix exists\");", + " usePrefix = pm.globals.get('use-prefix');", + " console.log(\" --> Prefix is: \" + usePrefix);", + " ", + " // Set up all globals, using the correct prefix.", + " pm.globals.set('auth_url', pm.globals.get(usePrefix + 'auth_url'));", + " pm.globals.set('realm', pm.globals.get(usePrefix + 'realm'));", + " pm.globals.set('clientid', pm.globals.get(usePrefix + 'clientid'));", + " pm.globals.set('client_secret', pm.globals.get(usePrefix + 'client_secret'));", + " pm.globals.set('url', pm.globals.get(usePrefix + 'url'));", + "}", + "else {", + " console.log(\"==> use-prefix does not exist\");", + " console.log(\" --> No default globals set.\");", + "}", + "", + "// If no maximum load time defined, set a default.", + "if (!pm.globals.get('max_load_time')) {", + " console.log(\"==> max_load_time not present, default set.\");", + " pm.globals.set(\"max_load_time\", JSON.stringify(1503));", + "}", + "", + "// If no maximum response defined, set a default.", + "if (!pm.globals.get('max_response_time')) {", + " console.log(\"==> max_response_time not present, default set.\");", + " pm.globals.set(\"max_response_time\", JSON.stringify(15005));", + "}", + "", + "// Display the values of all globals.", + "console.log(\"\");", + "console.log(\"==> Globals are:\");", + "console.log(\" --> auth_url: \" + pm.globals.get(\"auth_url\"));", + "console.log(\" --> realm: \" + pm.globals.get(\"realm\"));", + "console.log(\" --> clientid: \" + pm.globals.get(\"clientid\"));", + "console.log(\" --> client_secret: \" + pm.globals.get(\"client_secret\"));", + "console.log(\" --> url: \" + pm.globals.get(\"url\"));", + "console.log(\" --> max_load_time: \" + pm.globals.get(\"max_load_time\"));", + "console.log(\" --> max_response_time: \" + pm.globals.get(\"max_response_time\"));", + "", + "", + "// Clear run-scoped variables so reruns do not inherit stale state.", + "pm.globals.unset(\"auth_failure_reason\");", + "pm.globals.unset(\"operator_token\");", + "pm.globals.unset(\"operator_refresh_token\");", + "pm.globals.unset(\"nonqtxn_token\");", + "pm.globals.unset(\"nonqtxn_refresh_token\");", + "pm.globals.unset(\"public_user_token\");", + "pm.globals.unset(\"public_user_refresh_token\");", + "pm.globals.unset(\"token\");", + "pm.globals.unset(\"refresh_token\");", + "pm.globals.unset(\"token_expires\");", + "pm.globals.unset(\"refresh_token_expires\");", + "pm.globals.unset(\"expires_in\");", + "pm.globals.unset(\"refresh_expires_in\");", + "pm.environment.unset(\"current_client\");", + "pm.environment.unset(\"first_sr_id\");", + "pm.environment.unset(\"second_sr_id\");", + "pm.environment.unset(\"current_csr_id\");", + "pm.environment.unset(\"current_office_id\");", + "pm.environment.unset(\"current_office_number\");", + "pm.environment.unset(\"counter_id\");", + "pm.environment.unset(\"qtxn_id\");", + "pm.environment.unset(\"channel_telephone_id\");", + "pm.environment.unset(\"channel_email_id\");", + "pm.environment.unset(\"service_PropTax_id\");", + "pm.environment.unset(\"service_MSP_id\");", + "pm.environment.unset(\"user_id\");", + "pm.environment.unset(\"user_phone\");", + "pm.environment.unset(\"appointment_id\");", + "pm.environment.unset(\"public_office_id\");", + "pm.environment.unset(\"public_office_timezone\");", + "pm.environment.unset(\"public_service_id\");" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Dummy data." + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Basic-Response-Tests", + "event": [ + { + "listen": "test", + "script": { + "id": "a0d8e240-3b40-4654-a32b-bf2e676fdeb9", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"basic_response_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Get the maximum response time allowed.\nmax_response_time = JSON.parse(globals.max_response_time);\n\npm.test('Response time less than ' + max_response_time.toString() + 'ms', function(){\n pm.expect(pm.response.responseTime).to.be.below(max_response_time);\n});\n\nvar contentType = pm.response.headers.get(\"content-type\") || \"\";\n\npm.test(\"Response code for request is 200\", function(){\n pm.expect(pm.response.code).to.eql(200);\n});\npm.test(\"Response header should include Content-Type application/json\", function() {\n pm.expect(contentType.toLowerCase()).to.include(\"application/json\");\n});\npm.test(\"Response body should be valid JSON\", function() {\n pm.expect(function () { pm.response.json(); }).to.not.throw();\n});\n\nif (pm.response.code !== 200) {\n console.log(\"Unexpected status for \" + pm.info.requestName + \": \" + pm.response.code);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected HTTP 200 but received \" + pm.response.code);\n}\n\nif (contentType.toLowerCase().indexOf(\"application/json\") === -1) {\n console.log(\"Unexpected content-type for \" + pm.info.requestName + \": \" + contentType);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected application/json response\");\n}\n\ntry {\n pm.response.json();\n} catch (parseErr) {\n console.log(\"Response body was not valid JSON for \" + pm.info.requestName + \".\");\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw parseErr;\n}" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Complex-Response-Tests", + "event": [ + { + "listen": "test", + "script": { + "id": "f006b951-3205-4f21-a315-369f85591929", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"complex_response_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Get the maximum response time allowed.\nmax_response_time = JSON.parse(globals.max_response_time);\n\npm.test('Response time less than ' + max_response_time.toString() + 'ms', function(){\n pm.expect(pm.response.responseTime).to.be.below(max_response_time);\n});\n\nvar contentType = pm.response.headers.get(\"content-type\") || \"\";\n\npm.test(\"Response code for request is 200\", function(){\n pm.expect(pm.response.code).to.eql(200);\n});\npm.test(\"Response header should include Content-Type application/json\", function() {\n pm.expect(contentType.toLowerCase()).to.include(\"application/json\");\n});\npm.test(\"Response body should be valid JSON\", function() {\n pm.expect(function () { pm.response.json(); }).to.not.throw();\n});\n\nif (pm.response.code !== 200) {\n console.log(\"Unexpected status for \" + pm.info.requestName + \": \" + pm.response.code);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected HTTP 200 but received \" + pm.response.code);\n}\n\nif (contentType.toLowerCase().indexOf(\"application/json\") === -1) {\n console.log(\"Unexpected content-type for \" + pm.info.requestName + \": \" + contentType);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected application/json response\");\n}\n\ntry {\n pm.response.json();\n} catch (parseErr) {\n console.log(\"Response body was not valid JSON for \" + pm.info.requestName + \".\");\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw parseErr;\n}" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Create-Response-Tests", + "event": [ + { + "listen": "test", + "script": { + "id": "382b7b65-d736-4a03-a44a-3891f33b617d", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"create_response_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Get the maximum response time allowed.\nmax_response_time = JSON.parse(globals.max_response_time);\n\npm.test('Response time less than ' + max_response_time.toString() + 'ms', function(){\n pm.expect(pm.response.responseTime).to.be.below(max_response_time);\n});\n\nvar contentType = pm.response.headers.get(\"content-type\") || \"\";\n\npm.test(\"Response status code should be 201 CREATED\", function(){\n pm.expect(pm.response.code).to.eql(201);\n});\npm.test(\"Response header should include Content-Type application/json\", function() {\n pm.expect(contentType.toLowerCase()).to.include(\"application/json\");\n});\npm.test(\"Response body should be valid JSON\", function() {\n pm.expect(function () { pm.response.json(); }).to.not.throw();\n});\n\nif (pm.response.code !== 201) {\n console.log(\"Unexpected status for \" + pm.info.requestName + \": \" + pm.response.code);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected HTTP 201 but received \" + pm.response.code);\n}\n\nif (contentType.toLowerCase().indexOf(\"application/json\") === -1) {\n console.log(\"Unexpected content-type for \" + pm.info.requestName + \": \" + contentType);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected application/json response\");\n}\n\ntry {\n pm.response.json();\n} catch (parseErr) {\n console.log(\"Response body was not valid JSON for \" + pm.info.requestName + \".\");\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw parseErr;\n}" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Exam-Type-Data", + "event": [ + { + "listen": "test", + "script": { + "id": "382b7b65-d736-4a03-a44a-3891f33b617d", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"init_exam_type_data\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Finds an exam name in the JSON list allTypes of exam types.\nfunction find_exam(input_exam_name, allTypes) {\n\texam_id_value = -1;\n\n // Loop to look for the input exam name.\n if (allTypes) {\n allTypes.forEach(function(type) {\n if ((type.exam_type_name) == input_exam_name) {\n exam_id_value = type.exam_type_id;\n }\n });\n }\n \n // If the exam wasn't found, set it to be the first exam.\n if (exam_id_value == -1) {\n exam_id_value = allTypes[0].exam_type_id;\n }\n\n // Return the exam_id_type of the input exam name.\n return exam_id_value;\n}\n\n// Get the list of all possible exam types.\nallTypes = null;\nvar jsonData = JSON.parse(responseBody);\nif (jsonData.hasOwnProperty(\"exam_types\")) {\n\tallTypes = jsonData.exam_types;\n}\n\nexam_array = [];\nexam_array.push({name: \"Pesticide\", weight: 40.2, id: find_exam(\"Pesticide\", allTypes)});\nname = \"IPSE - 4HR Single Exam\";\nexam_array.push({name: name, weight: exam_array[0].weight + 14.5, id: find_exam(name, allTypes)});\nname = \"SLE - 3HR Group Exam\";\nexam_array.push({name: name, weight: exam_array[1].weight + 7.4, id: find_exam(name, allTypes)});\nname = \"COFQ - 3HR Group Exam\";\nexam_array.push({name: name, weight: exam_array[2].weight + 5.8, id: find_exam(name, allTypes)});\nname = \"IPSE - 4HR Group Exam\";\nexam_array.push({name: name, weight: exam_array[3].weight + 5.7, id: find_exam(name, allTypes)});\nname = \"COFQ - 3HR Single Exam\";\nexam_array.push({name: name, weight: exam_array[4].weight + 5.5, id: find_exam(name, allTypes)});\nname = \"Monthly Session Exam\";\nexam_array.push({name: name, weight: exam_array[5].weight + 3.8, id: find_exam(name, allTypes)});\nname = \"SLE - 3HR Single Exam\";\nexam_array.push({name: name, weight: exam_array[6].weight + 3.5, id: find_exam(name, allTypes)});\nname = \"Angling Guide Outfitter\";\nexam_array.push({name: name, weight: exam_array[7].weight + 2.4, id: find_exam(name, allTypes)});\nname = \"IPSE - 5HR Single Exam - Time Extension\";\nexam_array.push({name: name, weight: exam_array[8].weight + 2.3, id: find_exam(name, allTypes)});\nname = \"Exam Booking - 3 Hour Miscellaneous\";\nexam_array.push({name: name, weight: exam_array[9].weight + 1.7, id: find_exam(name, allTypes)});\n\n// Store the initialized exam data for later use.\npostman.setEnvironmentVariable(\"exam_array_data\", JSON.stringify(exam_array));" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Exam-Get-Random", + "event": [ + { + "listen": "test", + "script": { + "id": "382b7b65-d736-4a03-a44a-3891f33b617d", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"create_random_functions\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Function returns a weighted randomized exam type index.\nfunction get_random_index(exam_array) {\n\n // Generate a random number up to the maximum weight allowed.\n random_number = Math.floor(Math.random() * exam_array[exam_array.length - 1].weight);\n \n // Get the index of the exam type corresponding to that weight.\n index = get_index(random_number, exam_array);\n\n // Return the index.\n return index;\n}\n\n// Based on a random number, turns it into a weighted randomized exam type index.\nfunction get_index(random_value, exam_array) {\n index = 0;\n var i;\n for (i = 0; i < exam_array.length; i++) {\n if (random_value <= exam_array[i].weight) {\n index = i;\n break;\n }\n }\n \n return index;\n}\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Exam-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "id": "8cebcf78-f5a2-4694-b108-60e146791a78", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"exam_schema_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the JSON Schema expected in response\nvar examSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"exam\": {\n \"type\": \"object\",\n \"properties\": {\n \"booking_id\": {},\n \"deleted_date\": {},\n \"event_id\": {\"type\": \"string\"},\n \"exam_id\": {\"type\": \"number\"},\n \"exam_method\": {\"type\": \"string\"},\n \"exam_name\": {\"type\": \"string\"},\n \"exam_received_date\": {},\n \"exam_returned_tracking_number\": {},\n \"exam_type\": {\n \"type\": \"object\",\n \"properties\": {\n \"exam_color\": {\"type\": \"string\"},\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_type_name\": {\"type\": \"string\"},\n \"group_exam_ind\": {\"type\": \"number\"},\n \"ita_ind\": {\"type\": \"number\"},\n \"method_type\": {\"type\": \"string\"},\n \"number_of_hours\": {\"type\": \"number\"},\n \"number_of_minutes\": {\"type\": [\"number\", \"null\"]},\n \"pesticide_exam_ind\": {\"type\": \"number\" }\n },\n \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"group_exam_ind\", \"ita_ind\", \"method_type\", \"number_of_hours\", \"number_of_minutes\", \"pesticide_exam_ind\"]\n },\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_written_ind\": {\"type\": \"number\"},\n \"examinee_name\": {\"type\": \"string\"},\n \"expiry_date\": {\"type\": [\"string\", \"null\"]},\n \"notes\": {\"type\": \"string\"},\n \"number_of_students\": {\"type\": \"number\"},\n \"office\":{\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\" },\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\" : \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n },\n },\n \"required\": []\n },\n \"office_id\": {\"type\": \"number\"},\n \"offsite_location\": {},\n \"session_number\": {\"type\": [\"number\", \"null\"]},\n \"booking\": {}\n },\n \"required\": [\"booking\", \"booking_id\", \"deleted_date\", \"event_id\", \"exam_id\", \"exam_method\", \"exam_name\", \"exam_received_date\", \"exam_returned_tracking_number\", \"exam_type\", \"exam_type_id\", \"exam_written_ind\", \"examinee_name\", \"expiry_date\", \"notes\", \"number_of_students\", \"office\", \"office_id\", \"offsite_location\", \"session_number\"]\n }\n },\n \"required\": [\"exam\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Exam Schema\", function(){\n pm.expect(tv4.validate(jsonData, examSchema)).to.be.true;\n});\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Exam-Data-Check", + "event": [ + { + "listen": "test", + "script": { + "id": "8cebcf78-f5a2-4694-b108-60e146791a78", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"exam_data_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Make sure that jsonData has an exam property.\npm.test(\"Response should have exam property\", function(){\n pm.expect(jsonData.hasOwnProperty(\"exam\")).to.be.true;\n});\n\n// If jsonData has exam property, check data.\nif (jsonData.hasOwnProperty(\"exam\")) {\n\n //Test to see if Event ID field remains unchanged\n pm.test(\"Validate Event Id has expected value\", function(){\n pm.expect(jsonData.event_id === environment.event_id);\n });\n\n //Test to see if exam method field remains unchanged\n pm.test(\"Validate exam method has expected value\", function(){\n pm.expect(jsonData.exam_method === environment.exam_method);\n });\n\n //Test to see if exam name field remains unchanged\n pm.test(\"Validate exam name has expected value\", function(){\n pm.expect(jsonData.exam_name === environment.exam_name);\n });\n\n //Test to see if exam type field remains unchanged\n pm.test(\"Validate exam type id has expected value\", function(){\n pm.expect(jsonData.exam_type_id === environment.random_exam_type_id);\n });\n\n //Test to see if exam written indicator field remains unchanged\n pm.test(\"Validate exam written indicator has expected value\", function(){\n pm.expect(jsonData.exam_written_ind === environment.exam_written_ind);\n });\n\n //Test to see if examinee name field remains unchanged\n pm.test(\"Validate examinee name has expected value\", function(){\n pm.expect(jsonData.examinee_name === environment.examinee_name);\n });\n\n //Test to see if notes field remains unchanged\n pm.test(\"Validate notes has expected value\", function(){\n pm.expect(jsonData.notes === environment.notes);\n });\n\n //Test to see if number of students field remains unchanged\n pm.test(\"Validate number of students has expected value\", function(){\n pm.expect(jsonData.number_of_students === environment.number_of_students);\n });\n\n //Test to see if office id remains unchanged\n pm.test(\"Validate office id has expected value\", function(){\n pm.expect(jsonData.office_id === environment.current_office_id);\n });\n\n //Test to see if offsite location is expected\n pm.test(\"Validate offsite location has expected value\", function(){\n pm.expect(jsonData.offsite_location === environment.offsite_location);\n });\n}\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Exam-List-Schema-Check", + "event": [ + { + "listen": "test", + "script": { + "id": "8cebcf78-f5a2-4694-b108-60e146791a78", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"exam_schema_list_check\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Define the JSON Schema expected in response\nvar examSchema = {\n \"type\": \"object\",\n \"properties\": {\n \"exams\": {\n \"type\": \"array\",\n \"properties\": {\n \"booking_id\": {},\n \"deleted_date\": {},\n \"event_id\": {\"type\": \"string\"},\n \"exam_id\": {\"type\": \"number\"},\n \"exam_method\": {\"type\": \"string\"},\n \"exam_name\": {\"type\": \"string\"},\n \"exam_received_date\": {},\n \"exam_returned_tracking_number\": {},\n \"exam_type\": {\n \"type\": \"object\",\n \"properties\": {\n \"exam_color\": {\"type\": \"string\"},\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_type_name\": {\"type\": \"string\"},\n \"group_exam_ind\": {\"type\": \"number\"},\n \"ita_ind\": {\"type\": \"number\"},\n \"method_type\": {\"type\": \"string\"},\n \"number_of_hours\": {\"type\": \"number\"},\n \"number_of_minutes\": {\"type\": \"number\"},\n \"pesticide_exam_ind\": {\"type\": \"number\" }\n },\n \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"group_exam_ind\", \"ita_ind\", \"method_type\", \"number_of_hours\", \"number_of_minutes\", \"pesticide_exam_ind\"]\n },\n \"exam_type_id\": {\"type\": \"number\"},\n \"exam_written_ind\": {\"type\": \"number\"},\n \"examinee_name\": {\"type\": \"string\"},\n \"expiry_date\": {\"type\": [\"string\", \"null\"]},\n \"notes\": {\"type\": \"string\"},\n \"number_of_students\": {\"type\": \"number\"},\n \"office\":{\n \"type\": \"object\",\n \"properties\": {\n \"appointments_enabled_ind\": {\"type\": \"number\"},\n \"exams_enabled_ind\": {\"type\": \"number\"},\n \"office_id\": {\"type\": \"number\"},\n \"office_name\": {\"type\": \"string\"},\n \"office_number\": {\"type\": \"number\" },\n \"timezone\": {\n \"type\": \"object\",\n \"properties\": {\n \"timezone_id\": {\"type\" : \"number\"},\n \"timezone_name\": {\"type\": \"string\"}\n },\n \"required\": [\"timezone_id\", \"timezone_name\"]\n },\n },\n \"required\": []\n },\n \"office_id\": {\"type\": \"number\"},\n \"offsite_location\": {},\n \"session_number\": {\"type\": [\"number\", \"null\"]},\n \"booking\": {}\n },\n \"required\": [\"booking\", \"booking_id\", \"deleted_date\", \"event_id\", \"exam_id\", \"exam_method\", \"exam_name\", \"exam_received_date\", \"exam_returned_tracking_number\", \"exam_type\", \"exam_type_id\", \"exam_written_ind\", \"examinee_name\", \"expiry_date\", \"notes\", \"number_of_students\", \"office\", \"office_id\", \"offsite_location\", \"session_number\"]\n }\n },\n \"required\": [\"exams\"]\n};\n\n//Test to see if response schema is valid\npm.test(\"Validate Response Exam List Schema\", function(){\n pm.expect(tv4.validate(jsonData, examSchema)).to.be.true;\n});\n" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "Who am I", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "if (jsonData.hasOwnProperty(\"csr\")) {", + "\tcurrentOfficeId = jsonData.csr.office_id;", + "\tcurrentOfficeNumber = jsonData.csr.office.office_number;", + "\tcurrentCsrId = jsonData.csr.csr_id;", + " postman.setEnvironmentVariable(\"current_office_id\", currentOfficeId);", + " postman.setEnvironmentVariable(\"current_office_number\", currentOfficeNumber);", + " postman.setEnvironmentVariable(\"current_csr_id\", currentCsrId);", + "};", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}csrs/me/", + "host": [ + "{{url}}csrs" + ], + "path": [ + "me", + "" + ] + } + }, + "response": [] + } + ], + "description": "This folder performs basic authentication features.", + "protocolProfileBehavior": {} + }, + { + "name": "Check app health", + "item": [ + { + "name": "Check healthz driver TheQ", + "event": [ + { + "listen": "test", + "script": { + "id": "74adc5ce-caa5-452a-bd96-8ac90a4c11d7", + "exec": [ + "// Get the maximum response time allowed.", + "max_load_time = JSON.parse(globals.max_load_time);", + "", + "// Set health response time variable.", + "health_tries = 15;", + "counter = 1;", + "postman.setEnvironmentVariable(\"health_tries\", JSON.stringify(health_tries));", + "postman.setEnvironmentVariable(\"health_counter\", JSON.stringify(counter));", + "", + "// Get the response.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Test the health response.", + "pm.test(\"Health Driver: Try \" + counter.toString() + \": Response should have 'message' property\", function() {", + " pm.expect(jsonData).to.have.property('message');", + "});", + "", + "pm.test(\"Response message should be 'api is healthy'\", function() {", + " pm.expect(jsonData.message).to.be.eql('api is healthy');", + "});", + "", + "// If response time is OK, proceed to the next test.", + "if (pm.response.responseTime < max_load_time) {", + " postman.setNextRequest(\"Check the readyz endpoint TheQ\");", + "}", + " ", + "// Response time is too long. Try again, give pod a chance to spin up.", + "else {", + " postman.setNextRequest(\"Check the healthz endpoint TheQ\");", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}healthz/", + "host": [ + "{{url}}healthz" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Check the healthz endpoint TheQ", + "event": [ + { + "listen": "test", + "script": { + "id": "74adc5ce-caa5-452a-bd96-8ac90a4c11d7", + "exec": [ + "// Get the maximum load time allowed.", + "max_load_time = JSON.parse(postman.getEnvironmentVariable(\"max_load_time\"));", + "", + "// Get and update variables.", + "health_tries = JSON.parse(postman.getEnvironmentVariable(\"health_tries\"));", + "counter = JSON.parse(postman.getEnvironmentVariable(\"health_counter\")) + 1;", + "postman.setEnvironmentVariable(\"health_counter\", JSON.stringify(counter));", + "", + "// Get the response.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Test the health response.", + "pm.test(\"Health Driver: Try \" + counter.toString() + \": Response should have 'message' property\", function() {", + " pm.expect(jsonData).to.have.property('message');", + "});", + "", + "pm.test(\"Response message should be 'api is healthy'\", function() {", + " pm.expect(jsonData.message).to.be.eql('api is healthy');", + "});", + "", + "// If response time is OK, proceed to the next test.", + "if (pm.response.responseTime < max_load_time) {", + " postman.setNextRequest(\"Check the readyz endpoint TheQ\");", + "}", + " ", + "// Response time is too long.", + "else {", + " ", + " // You haven't reached your maximum tries yet. Try again.", + " if (counter < health_tries) {", + " postman.setNextRequest(\"Check the healthz endpoint\");", + " }", + " ", + " // You have reached the maximum. An error, go to next test.", + " else {", + " pm.test(\"Response should be below \" + max_load_time.toString() + ' in ' + health_tries.toString() + ' tries.', function() {", + " pm.expect(counter).to.be.below(health_tries);", + " });", + " postman.setNextRequest(\"Check the readyz endpoint TheQ\");", + " }", + "}", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}healthz/", + "host": [ + "{{url}}healthz" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Check the readyz endpoint TheQ", + "event": [ + { + "listen": "test", + "script": { + "id": "661c33c4-4a3d-4396-a549-9969edafbfa6", + "exec": [ + "// Perform the standard tests.", + "eval(environment.basic_response_test);", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "// Test the health response.", + "pm.test(\"Response should have 'message' property\", function() {", + " pm.expect(jsonData).to.have.property('message');", + "});", + "", + "pm.test(\"Response message should be 'api is ready'\", function() {", + " pm.expect(jsonData.message).to.be.eql('api is ready');", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}readyz/", + "host": [ + "{{url}}readyz" + ], + "path": [ + "" + ] + } + }, + "response": [] + } + ], + "description": "Checks the application health by calling the healthz and readyz endpoints", + "protocolProfileBehavior": {} + }, + { + "name": "Check user login", + "item": [ + { + "name": "Authenticate user", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"auth_url\",\"realm\",\"clientid\",\"userid\",\"password\",\"client_secret\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "43df8e47-2b93-48b0-a5ff-bb3396d12537", + "exec": [ + "// Parse response body", + "var jsonData = {};", + "try {", + " jsonData = JSON.parse(responseBody);", + "} catch (parseErr) {", + " console.log(\"Authentication response body was not JSON.\");", + " console.log(responseBody);", + " pm.globals.set(\"auth_failure_reason\", \"Non-JSON auth response\");", + " pm.execution.setNextRequest(null);", + " throw parseErr;", + "}", + "", + "var authFailureReason = jsonData.error_description || jsonData.error || (\"HTTP \" + pm.response.code);", + "if (pm.response.code !== 200 || !jsonData.access_token) {", + " console.log(\"Authentication failed for \" + pm.info.requestName + \".\");", + " console.log(responseBody);", + " pm.globals.set(\"auth_failure_reason\", authFailureReason);", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Authentication failed: \" + authFailureReason);", + "}", + "", + "pm.test(\"Response code for request is 200\", function(){", + " pm.expect(pm.response.code).to.eql(200);", + "});", + "pm.test(\"Access token exists\", function(){", + " pm.expect(jsonData).to.have.property(\"access_token\");", + " pm.expect(jsonData.access_token).to.be.a(\"string\").and.not.empty;", + "});", + "pm.test(\"Refresh token exists\", function(){", + " pm.expect(jsonData).to.have.property(\"refresh_token\");", + " pm.expect(jsonData.refresh_token).to.be.a(\"string\").and.not.empty;", + "});", + "pm.test(\"Expires In is present\", function(){", + " pm.expect(jsonData).to.have.property(\"expires_in\");", + " pm.expect(jsonData.expires_in).to.not.eql(null);", + "});", + "pm.test(\"Refresh Expires In is present\", function(){", + " pm.expect(jsonData).to.have.property(\"refresh_expires_in\");", + " pm.expect(jsonData.refresh_expires_in).to.not.eql(null);", + "});", + "", + "pm.globals.unset(\"auth_failure_reason\");", + "pm.globals.set(\"operator_token\", jsonData.access_token);", + "pm.globals.set(\"operator_refresh_token\", jsonData.refresh_token);", + "pm.globals.set(\"token_expires\", Date.now() + (jsonData.expires_in * 1000));", + "pm.globals.set(\"refresh_token_expires\", Date.now() + (jsonData.refresh_expires_in * 1000));", + "pm.globals.set(\"expires_in\", jsonData.expires_in);", + "pm.globals.set(\"refresh_expires_in\", jsonData.refresh_expires_in);", + "pm.globals.set(\"token\", jsonData.access_token);", + "pm.globals.set(\"refresh_token\", jsonData.refresh_token);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/x-www-form-urlencoded" + } + ], + "body": { + "mode": "raw", + "raw": "grant_type=password&client_id={{clientid}}&username={{userid}}&password={{password}}&client_secret={{client_secret}}" + }, + "url": { + "raw": "{{auth_url}}/auth/realms/{{realm}}/protocol/openid-connect/token?Content-Type=application/x-www-form-urlencoded", + "host": [ + "{{auth_url}}" + ], + "path": [ + "auth", + "realms", + "{{realm}}", + "protocol", + "openid-connect", + "token" + ], + "query": [ + { + "key": "Content-Type", + "value": "application/x-www-form-urlencoded" + } + ] + }, + "description": "Make sure the operator ID can log in" + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Get Exam Types", + "item": [ + { + "name": "Exam Type List", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "2df2a851-6a71-48e6-b44f-ccf096fe9d83", + "exec": [ + "// Define the JSON Schema expected in response", + "var examTypeSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"exam_color\": {\"type\": \"string\"},", + " \"exam_type_id\": {\"type\": \"number\"},", + " \"exam_type_name\": {\"type\": \"string\"},", + " \"ita_ind\": {\"type\": \"number\"},", + " \"method_type\": {\"type\": \"string\"},", + " \"number_of_hours\": {\"type\": \"number\"},", + " \"group_exam_ind\": {\"type\": \"number\"}", + " },", + " \"required\": [\"exam_color\", \"exam_type_id\", \"exam_type_name\", \"ita_ind\", \"method_type\", \"number_of_hours\", \"group_exam_ind\"]", + " },", + " \"required\": []", + "}; ", + "", + "// Get the max response time allowed.", + "console.log(\"==> Before getting response max\");", + "var response_max = JSON.parse(globals.max_response_time);", + "", + "// Check Response code for request", + "console.log(\"==> Before checking response code\");", + "pm.test(\"Response code for request is 200\", function(){", + " pm.response.to.have.status(200);", + "});", + "", + "console.log(\"==> Before checking response time\");", + "pm.test(\"Response time less than \" + response_max.toString() + \"ms\", function(){", + " pm.expect(pm.response.responseTime).to.be.below(response_max);", + "});", + "", + "// Parse response body", + "console.log(\"==> Before getting response body\");", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "console.log(\"==> Before checking schema\");", + "pm.test(\"Validate Response Exam Type Schema\", function(){", + " pm.expect(tv4.validate(jsonData, examTypeSchema)).to.be.true;", + "});", + "", + "// Store all exam type IDs for future use in adding exams", + "console.log(\"==> Before allelements\");", + "var allExamIds = [];", + "", + "// Make sure some data returned.", + "console.log(\"==> Before checking there is an exam_types property\");", + "pm.test(\"Response has exam_types property\", function(){", + " pm.expect(jsonData.hasOwnProperty(\"exam_types\")).to.be.true;", + "});", + "console.log(\"==> Before checking at least one exam type\");", + "pm.test(\"Response has at least one exam_type\", function(){", + " pm.expect(jsonData.exam_types.length).to.be.above(0);", + "});", + "", + "// Set up list of valid exam types, create random functions.", + "console.log(\"==> setting environment variables\");", + "eval(environment.init_exam_type_data);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}exam_types/", + "host": [ + "{{url}}exam_types" + ], + "path": [ + "" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Exam test 5 updates", + "item": [ + { + "name": "Create exam", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"event_id\",\"random_exam_type_id\",\"current_office_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Get exam type data and functions.", + "exam_array = JSON.parse(postman.getEnvironmentVariable(\"exam_array_data\"));", + "eval(environment.create_random_functions);", + "// Create an event number based on the time.", + "var ms = (new Date().getTime()).toString() + \"00\";", + "eventNumber = Number(ms.substring(ms.length-6, ms.len)) + 1;", + "postman.setEnvironmentVariable(\"event_number\", eventNumber);", + "// Update the next event ID.", + "var eventId = \"pm\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", 0);", + "postman.setEnvironmentVariable(\"event_id\", JSON.stringify(eventId));", + "postman.setEnvironmentVariable(\"event_delete\", eventId);", + "// Calculate a random exam type to use.", + "random_index = get_random_index(exam_array);", + "// Store for use.", + "random_exam_type_id = exam_array[random_index].id;", + "postman.setEnvironmentVariable(\"random_exam_type_id\", JSON.stringify(random_exam_type_id.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "if (jsonData.hasOwnProperty(\"exam\")) {", + "\tcurrentExamId = jsonData.exam.exam_id;", + " postman.setEnvironmentVariable(\"current_exam_id\", currentExamId);", + "};", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\n\t\"event_id\" : {{event_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : \"Postman Group Exam Name\",\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : \"Pm examinee name\",\n \"notes\" : \"Pm sample notes\",\n \"number_of_students\" : \"19\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : \"Pm test location\"\n}" + }, + "url": { + "raw": "{{url}}exams/", + "host": [ + "{{url}}exams" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Update exam info (1-1)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\",\"update_id\",\"exam_name\",\"random_exam_type_id\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}\n" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Update exam info (1-2)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\",\"update_id\",\"exam_name\",\"random_exam_type_id\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Update exam info (1-3)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\",\"update_id\",\"exam_name\",\"random_exam_type_id\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Update exam info (1-4)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\",\"update_id\",\"exam_name\",\"random_exam_type_id\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Update exam info (1-5)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\",\"update_id\",\"exam_name\",\"random_exam_type_id\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "List exams", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_office_number\",\"operator_token\",\"update_id\",\"exam_name\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite locatoin - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : \"6\",\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" + }, + "url": { + "raw": "{{url}}exams/?office_number={{current_office_number}}", + "host": [ + "{{url}}exams" + ], + "path": [ + "" + ], + "query": [ + { + "key": "office_number", + "value": "{{current_office_number}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Delete exam", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "0ec5c421-a4af-4424-8201-86864e291f0e", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}", + "type": "text" + } + ], + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Exam test 3 updates", + "item": [ + { + "name": "Create exam", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"event_id\",\"random_exam_type_id\",\"current_office_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Get exam type data and functions.", + "exam_array = JSON.parse(postman.getEnvironmentVariable(\"exam_array_data\"));", + "eval(environment.create_random_functions);", + "// Create an event number based on the time.", + "var ms = (new Date().getTime()).toString() + \"00\";", + "eventNumber = Number(ms.substring(ms.length-6, ms.len)) + 1;", + "postman.setEnvironmentVariable(\"event_number\", eventNumber);", + "// Update the next event ID.", + "var eventId = \"pm\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", 0);", + "postman.setEnvironmentVariable(\"event_id\", JSON.stringify(eventId));", + "postman.setEnvironmentVariable(\"event_delete\", eventId);", + "// Calculate a random exam type to use.", + "random_index = get_random_index(exam_array);", + "// Store for use.", + "random_exam_type_id = exam_array[random_index].id;", + "postman.setEnvironmentVariable(\"random_exam_type_id\", JSON.stringify(random_exam_type_id.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "if (jsonData.hasOwnProperty(\"exam\")) {", + "\tcurrentExamId = jsonData.exam.exam_id;", + " postman.setEnvironmentVariable(\"current_exam_id\", currentExamId);", + "};", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\n\t\"event_id\" : {{event_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : \"Postman Group Exam Name\",\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : \"Pm examinee name\",\n \"notes\" : \"Pm sample notes\",\n \"number_of_students\" : \"19\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : \"Pm test location\"\n}" + }, + "url": { + "raw": "{{url}}exams/", + "host": [ + "{{url}}exams" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Update exam info (2-1)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\",\"update_id\",\"exam_name\",\"random_exam_type_id\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Update exam info (2-2)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\",\"update_id\",\"exam_name\",\"random_exam_type_id\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Update exam info (2-3)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\",\"update_id\",\"exam_name\",\"random_exam_type_id\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "List exams", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_office_number\",\"operator_token\",\"update_id\",\"exam_name\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite locatoin - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : \"6\",\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" + }, + "url": { + "raw": "{{url}}exams/?office_number={{current_office_number}}", + "host": [ + "{{url}}exams" + ], + "path": [ + "" + ], + "query": [ + { + "key": "office_number", + "value": "{{current_office_number}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Delete exam", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "0ec5c421-a4af-4424-8201-86864e291f0e", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}", + "type": "text" + } + ], + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Exam tests 8 updates", + "item": [ + { + "name": "Create exam", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"event_id\",\"random_exam_type_id\",\"current_office_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Get exam type data and functions.", + "exam_array = JSON.parse(postman.getEnvironmentVariable(\"exam_array_data\"));", + "eval(environment.create_random_functions);", + "// Create an event number based on the time.", + "var ms = (new Date().getTime()).toString() + \"00\";", + "eventNumber = Number(ms.substring(ms.length-6, ms.len)) + 1;", + "postman.setEnvironmentVariable(\"event_number\", eventNumber);", + "// Update the next event ID.", + "var eventId = \"pm\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", 0);", + "postman.setEnvironmentVariable(\"event_id\", JSON.stringify(eventId));", + "postman.setEnvironmentVariable(\"event_delete\", eventId);", + "// Calculate a random exam type to use.", + "random_index = get_random_index(exam_array);", + "// Store for use.", + "random_exam_type_id = exam_array[random_index].id;", + "postman.setEnvironmentVariable(\"random_exam_type_id\", JSON.stringify(random_exam_type_id.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "if (jsonData.hasOwnProperty(\"exam\")) {", + "\tcurrentExamId = jsonData.exam.exam_id;", + " postman.setEnvironmentVariable(\"current_exam_id\", currentExamId);", + "};", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\n\t\"event_id\" : {{event_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : \"Postman Group Exam Name\",\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : \"Pm examinee name\",\n \"notes\" : \"Pm sample notes\",\n \"number_of_students\" : \"19\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : \"Pm test location\"\n}" + }, + "url": { + "raw": "{{url}}exams/", + "host": [ + "{{url}}exams" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Update exam info (3-1)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\",\"update_id\",\"exam_name\",\"random_exam_type_id\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Update exam info (3-2)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\",\"update_id\",\"exam_name\",\"random_exam_type_id\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Update exam info (3-3)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\",\"update_id\",\"exam_name\",\"random_exam_type_id\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Update exam info (3-4)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\",\"update_id\",\"exam_name\",\"random_exam_type_id\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Update exam info (3-5)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\",\"update_id\",\"exam_name\",\"random_exam_type_id\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Update exam info (3-6)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\",\"update_id\",\"exam_name\",\"random_exam_type_id\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Update exam info (3-7)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\",\"update_id\",\"exam_name\",\"random_exam_type_id\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "Update exam info (3-8)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\",\"update_id\",\"exam_name\",\"random_exam_type_id\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "List exams", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_office_number\",\"operator_token\",\"update_id\",\"exam_name\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite locatoin - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : \"6\",\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" + }, + "url": { + "raw": "{{url}}exams/?office_number={{current_office_number}}", + "host": [ + "{{url}}exams" + ], + "path": [ + "" + ], + "query": [ + { + "key": "office_number", + "value": "{{current_office_number}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Delete exam", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "0ec5c421-a4af-4424-8201-86864e291f0e", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}", + "type": "text" + } + ], + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Exam 1 test single update", + "item": [ + { + "name": "Create exam", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"event_id\",\"random_exam_type_id\",\"current_office_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Get exam type data and functions.", + "exam_array = JSON.parse(postman.getEnvironmentVariable(\"exam_array_data\"));", + "eval(environment.create_random_functions);", + "// Create an event number based on the time.", + "var ms = (new Date().getTime()).toString() + \"00\";", + "eventNumber = Number(ms.substring(ms.length-6, ms.len)) + 1;", + "postman.setEnvironmentVariable(\"event_number\", eventNumber);", + "// Update the next event ID.", + "var eventId = \"pm\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", 0);", + "postman.setEnvironmentVariable(\"event_id\", JSON.stringify(eventId));", + "postman.setEnvironmentVariable(\"event_delete\", eventId);", + "// Calculate a random exam type to use.", + "random_index = get_random_index(exam_array);", + "// Store for use.", + "random_exam_type_id = exam_array[random_index].id;", + "postman.setEnvironmentVariable(\"random_exam_type_id\", JSON.stringify(random_exam_type_id.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "if (jsonData.hasOwnProperty(\"exam\")) {", + "\tcurrentExamId = jsonData.exam.exam_id;", + " postman.setEnvironmentVariable(\"current_exam_id\", currentExamId);", + "};", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\n\t\"event_id\" : {{event_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : \"Postman Group Exam Name\",\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : \"Pm examinee name\",\n \"notes\" : \"Pm sample notes\",\n \"number_of_students\" : \"19\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : \"Pm test location\"\n}" + }, + "url": { + "raw": "{{url}}exams/", + "host": [ + "{{url}}exams" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Update exam info", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\",\"update_id\",\"exam_name\",\"random_exam_type_id\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "List exams", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_office_number\",\"operator_token\",\"update_id\",\"exam_name\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : \"6\",\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" + }, + "url": { + "raw": "{{url}}exams/?office_number={{current_office_number}}", + "host": [ + "{{url}}exams" + ], + "path": [ + "" + ], + "query": [ + { + "key": "office_number", + "value": "{{current_office_number}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Delete exam", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "0ec5c421-a4af-4424-8201-86864e291f0e", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}", + "type": "text" + } + ], + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Exam 2 test single update", + "item": [ + { + "name": "Create exam", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"event_id\",\"random_exam_type_id\",\"current_office_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Get exam type data and functions.", + "exam_array = JSON.parse(postman.getEnvironmentVariable(\"exam_array_data\"));", + "eval(environment.create_random_functions);", + "// Create an event number based on the time.", + "var ms = (new Date().getTime()).toString() + \"00\";", + "eventNumber = Number(ms.substring(ms.length-6, ms.len)) + 1;", + "postman.setEnvironmentVariable(\"event_number\", eventNumber);", + "// Update the next event ID.", + "var eventId = \"pm\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", 0);", + "postman.setEnvironmentVariable(\"event_id\", JSON.stringify(eventId));", + "postman.setEnvironmentVariable(\"event_delete\", eventId);", + "// Calculate a random exam type to use.", + "random_index = get_random_index(exam_array);", + "// Store for use.", + "random_exam_type_id = exam_array[random_index].id;", + "postman.setEnvironmentVariable(\"random_exam_type_id\", JSON.stringify(random_exam_type_id.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "if (jsonData.hasOwnProperty(\"exam\")) {", + "\tcurrentExamId = jsonData.exam.exam_id;", + " postman.setEnvironmentVariable(\"current_exam_id\", currentExamId);", + "};", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\n\t\"event_id\" : {{event_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : \"Postman Group Exam Name\",\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : \"Pm examinee name\",\n \"notes\" : \"Pm sample notes\",\n \"number_of_students\" : \"19\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : \"Pm test location\"\n}" + }, + "url": { + "raw": "{{url}}exams/", + "host": [ + "{{url}}exams" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Update exam info", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\",\"update_id\",\"exam_name\",\"random_exam_type_id\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "List exams", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_office_number\",\"operator_token\",\"update_id\",\"exam_name\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : \"6\",\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" + }, + "url": { + "raw": "{{url}}exams/?office_number={{current_office_number}}", + "host": [ + "{{url}}exams" + ], + "path": [ + "" + ], + "query": [ + { + "key": "office_number", + "value": "{{current_office_number}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Delete exam", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "0ec5c421-a4af-4424-8201-86864e291f0e", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}", + "type": "text" + } + ], + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Exam 3 test single update", + "item": [ + { + "name": "Create exam", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"event_id\",\"random_exam_type_id\",\"current_office_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Get exam type data and functions.", + "exam_array = JSON.parse(postman.getEnvironmentVariable(\"exam_array_data\"));", + "eval(environment.create_random_functions);", + "// Create an event number based on the time.", + "var ms = (new Date().getTime()).toString() + \"00\";", + "eventNumber = Number(ms.substring(ms.length-6, ms.len)) + 1;", + "postman.setEnvironmentVariable(\"event_number\", eventNumber);", + "// Update the next event ID.", + "var eventId = \"pm\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", 0);", + "postman.setEnvironmentVariable(\"event_id\", JSON.stringify(eventId));", + "postman.setEnvironmentVariable(\"event_delete\", eventId);", + "// Calculate a random exam type to use.", + "random_index = get_random_index(exam_array);", + "// Store for use.", + "random_exam_type_id = exam_array[random_index].id;", + "postman.setEnvironmentVariable(\"random_exam_type_id\", JSON.stringify(random_exam_type_id.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "if (jsonData.hasOwnProperty(\"exam\")) {", + "\tcurrentExamId = jsonData.exam.exam_id;", + " postman.setEnvironmentVariable(\"current_exam_id\", currentExamId);", + "};", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\n\t\"event_id\" : {{event_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : \"Postman Group Exam Name\",\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : \"Pm examinee name\",\n \"notes\" : \"Pm sample notes\",\n \"number_of_students\" : \"19\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : \"Pm test location\"\n}" + }, + "url": { + "raw": "{{url}}exams/", + "host": [ + "{{url}}exams" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Update exam info", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\",\"update_id\",\"exam_name\",\"random_exam_type_id\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : {{random_exam_type_id}},\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" + }, + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + }, + { + "name": "List exams", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_office_number\",\"operator_token\",\"update_id\",\"exam_name\",\"examinee_name\",\"notes\",\"current_office_id\",\"offsite_location\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// Update the next event ID.", + "var eventNumber = JSON.parse(postman.getEnvironmentVariable(\"event_number\"));", + "var updateNumber = JSON.parse(postman.getEnvironmentVariable(\"update_number\")) + 1;", + "var updateEventId = \"pm-up\" + updateNumber.toString() + \"-\" + eventNumber.toString();", + "postman.setEnvironmentVariable(\"update_number\", updateNumber);", + "postman.setEnvironmentVariable(\"update_id\", JSON.stringify(updateEventId));", + "postman.setEnvironmentVariable(\"exam_name\", JSON.stringify(\"PM exam name - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"examinee_name\", JSON.stringify(\"PM examinee - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"notes\", JSON.stringify(\"PM exam notes - Update \" + updateNumber.toString()));", + "postman.setEnvironmentVariable(\"offsite_location\", JSON.stringify(\"PM offsite location - Update \" + updateNumber.toString()));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"event_id\" : {{update_id}},\n \"exam_method\" : \"paper\",\n \"exam_name\" : {{exam_name}},\n \"exam_type_id\" : \"6\",\n \"exam_written_ind\" : \"0\",\n \"examinee_name\" : {{examinee_name}},\n \"notes\" : {{notes}},\n \"number_of_students\" : \"119\",\n \"office_id\" : {{current_office_id}},\n \"offsite_location\" : {{offsite_location}}\n}" + }, + "url": { + "raw": "{{url}}exams/?office_number={{current_office_number}}", + "host": [ + "{{url}}exams" + ], + "path": [ + "" + ], + "query": [ + { + "key": "office_number", + "value": "{{current_office_number}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Delete exam", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "0ec5c421-a4af-4424-8201-86864e291f0e", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_exam_id\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}", + "type": "text" + } + ], + "url": { + "raw": "{{url}}exams/{{current_exam_id}}/", + "host": [ + "{{url}}exams" + ], + "path": [ + "{{current_exam_id}}", + "" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + } + ], + "protocolProfileBehavior": {} +} diff --git a/api/postman/Load_Test_TheQ.json b/api/postman/Load_Test_TheQ.json index 395a0b3f8..60337af14 100644 --- a/api/postman/Load_Test_TheQ.json +++ b/api/postman/Load_Test_TheQ.json @@ -1,4817 +1,5202 @@ { - "info": { - "_postman_id": "cda6659f-7e26-412f-9a1c-979b54507ea2", - "name": "Load_Test_TheQ", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" - }, - "item": [ - { - "name": "Setup", - "item": [ - { - "name": "Setup-Variables", - "event": [ - { - "listen": "test", - "script": { - "id": "5409b66d-67a4-449b-8633-9aeca632b388", - "exec": [ - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "e9eed831-7955-4218-a400-ae6e1e7e2e10", - "exec": [ - "// See if the use-prefix global has been set. Use default if not.", - "let usePrefix = '';", - "if (pm.globals.get('use-prefix')) {", - " console.log(\"==> use-prefix exists\");", - " usePrefix = pm.globals.get('use-prefix');", - " console.log(\" --> Prefix is: \" + usePrefix);", - " ", - " // Set up all globals, using the correct prefix.", - " pm.globals.set('auth_url', pm.globals.get(usePrefix + 'auth_url'));", - " pm.globals.set('realm', pm.globals.get(usePrefix + 'realm'));", - " pm.globals.set('clientid', pm.globals.get(usePrefix + 'clientid'));", - " pm.globals.set('client_secret', pm.globals.get(usePrefix + 'client_secret'));", - " pm.globals.set('url', pm.globals.get(usePrefix + 'url'));", - "}", - "else {", - " console.log(\"==> use-prefix does not exist\");", - " console.log(\" --> No default globals set.\");", - "}", - "", - "// If no maximum load time defined, set a default.", - "if (!pm.globals.get('max_load_time')) {", - " console.log(\"==> max_load_time not present, default set.\");", - " pm.globals.set(\"max_load_time\", JSON.stringify(1503));", - "}", - "", - "// If no maximum response defined, set a default.", - "if (!pm.globals.get('max_response_time')) {", - " console.log(\"==> max_response_time not present, default set.\");", - " pm.globals.set(\"max_response_time\", JSON.stringify(15005));", - "}", - "", - "// Display the values of all globals.", - "console.log(\"\");", - "console.log(\"==> Globals are:\");", - "console.log(\" --> auth_url: \" + pm.globals.get(\"auth_url\"));", - "console.log(\" --> realm: \" + pm.globals.get(\"realm\"));", - "console.log(\" --> clientid: \" + pm.globals.get(\"clientid\"));", - "console.log(\" --> client_secret: \" + pm.globals.get(\"client_secret\"));", - "console.log(\" --> url: \" + pm.globals.get(\"url\"));", - "console.log(\" --> max_load_time: \" + pm.globals.get(\"max_load_time\"));", - "console.log(\" --> max_response_time: \" + pm.globals.get(\"max_response_time\"));", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Dummy data." - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Auth-First", - "event": [ - { - "listen": "test", - "script": { - "id": "5409b66d-67a4-449b-8633-9aeca632b388", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"auth_first\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "auth_url = globals.auth_url;\nrealm = globals.realm;\nclientid = globals.clientid;\nuserid = globals.userid;\npassword = globals.password;\nclient_secret = globals.client_secret;\n\nconst echoPostRequest = {\n url: auth_url + '/auth/realms/' + realm + '/protocol/openid-connect/token',\n method: 'POST',\n header: 'Content-Type:application/x-www-form-urlencoded',\n body: {\n mode: 'raw',\n raw: 'grant_type=password&client_id=' + clientid \n + '&username=' + userid \n + '&password=' + password\n + '&client_secret=' + client_secret\n }\n};\npm.sendRequest(echoPostRequest, function (err, res) {\n var jsonData = res.json();\n if (jsonData.hasOwnProperty('access_token')) {\n \tpm.globals.set(\"token\", jsonData.access_token);\n\t pm.globals.set(\"refresh_token\", jsonData.refresh_token);\n\t if (err) {\n\t console.log(err);\n\t }\n\t // console.log(err ? err : res.json());\n\t} else {\n\t pm.globals.set(\"token\", 0);\n\t pm.globals.set(\"refresh_token\", 0);\n\t pm.globals.set(\"token_expires\", 0);\n\t pm.globals.set(\"refresh_token_expires\", 0);\n\t}\n});" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Auth-Script", - "event": [ - { - "listen": "test", - "script": { - "id": "f386cf22-bb0f-47d9-9c22-cda162ed4375", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"auth_script\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "auth_url = globals.auth_url;\nrealm = globals.realm;\nclientid = globals.clientid;\nuserid = globals.userid;\npassword = globals.password;\nclient_secret = globals.client_secret;\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Basic-Response-Tests", - "event": [ - { - "listen": "test", - "script": { - "id": "a0d8e240-3b40-4654-a32b-bf2e676fdeb9", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"basic_response_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Get the maximum response time allowed.\r\nmax_response_time = JSON.parse(globals.max_response_time);\r\n\r\n// Check to make sure the response time was within the maximum allowed.\r\npm.test('Response time less than ' + max_response_time.toString() + 'ms', function(){\r\n pm.expect(pm.response.responseTime).to.be.below(max_response_time);\r\n});\r\n\r\n// Other tests.\r\npm.test(\"Response code for request is 200\", function(){\r\n pm.response.to.have.status(200);\r\n});\r\npm.test('Response header should have Content-Type of application/json', function() {\r\n pm.response.to.have.header('content-type', 'application/json');\r\n});\r\npm.test('Response body be in JSON format', function() {\r\n pm.response.to.be.json; \r\n});" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Complex-Response-Tests", - "event": [ - { - "listen": "test", - "script": { - "id": "f006b951-3205-4f21-a315-369f85591929", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"complex_response_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Get the maximum response time allowed.\nmax_response_time = JSON.parse(globals.max_response_time);\n\n// Check to make sure the response time was within the maximum allowed.\npm.test('Response time less than ' + max_response_time.toString() + 'ms', function(){\n pm.expect(pm.response.responseTime).to.be.below(max_response_time);\n});\n\n// Other tests.\npm.test(\"Response code for request is 200\", function(){\n pm.response.to.have.status(200);\n});\npm.test('Response header should have Content-Type of application/json', function() {\n pm.response.to.have.header('content-type', 'application/json');\n});\npm.test('Response body be in JSON format', function() {\n pm.response.to.be.json; \n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Create-Response-Tests", - "event": [ - { - "listen": "test", - "script": { - "id": "382b7b65-d736-4a03-a44a-3891f33b617d", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"create_response_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Get the maximum response time allowed.\nmax_response_time = JSON.parse(globals.max_response_time);\n\n// Check to make sure the response time was within the maximum allowed.\npm.test('Response time less than ' + max_response_time.toString() + 'ms', function(){\n pm.expect(pm.response.responseTime).to.be.below(max_response_time);\n});\n\n// Other tests.\npm.test(\"Response status code should be 201 CREATED\", function(){\n pm.response.to.have.status(201);\n});\npm.test('Response header should have Content-Type of application/json', function() {\n pm.response.to.have.header('content-type', 'application/json');\n});\npm.test('Response body be in JSON format', function() {\n pm.response.to.be.json; \n});\n" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Citizen-Response-Tests", - "event": [ - { - "listen": "test", - "script": { - "id": "8cebcf78-f5a2-4694-b108-60e146791a78", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"citizen_response_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "var schema = {\n \"properties\" : {\n \"start_time\" : {\n \"type\" : \"string\"\n },\n \"citizen_name\" : {\n \"type\" : [\"string\", \"null\"]\n },\n \"citizen_id\" : {\n \"type\" : [\"number\", \"object\"]\n },\n \"qt_xn_citizen_ind\" : {\n \"type\" : \"number\"\n },\n \"ticket_number\" : {\n \"type\" : [\"string\", \"null\"]\n },\n \"service_reqs\" : {\n \"type\" : \"array\"\n },\n \"office_id\" : {\n \"type\" : [\"object\", \"number\"]\n },\n \"cs\" : {\n \"type\" : \"object\"\n },\n \"citizen_comments\" : {\n \"type\" : [\"string\", \"null\"]\n },\n \n },\n \"required\" : [\"start_time\", \"citizen_name\", \"citizen_id\",\n \"qt_xn_citizen_ind\", \"ticket_number\", \"service_reqs\",\n \"office_id\", \"cs\", \"citizen_comments\"]\n};\n\n// Declare, initialize variables.\nvar allElements = null;\n\nif (jsonData.hasOwnProperty(\"citizens\")) {\n\tallElements = jsonData.citizens;\n};\n\nif (jsonData.hasOwnProperty(\"citizen\")) {\n\tallElements = [];\n\tallElements.push(jsonData.citizen);\n};\n\nvar elementCount = 0;\n\n// If there are some citizens, proceed with tests.\nif (allElements !== null) {\n\n // Loop to validate schema of each channel, create list of citizen ids.\n allElements.forEach(function(element) {\n elementCount ++;\n var testTitle = \"Citizen (\" + elementCount + \"): \" + element.citizen_id + \" - \";\n tests[testTitle + \"conforms to schema\"] = tv4.validate(element, schema);\n \n // Test the authenticate response.\n pm.test(testTitle + \"qt_xn_citizen_ind must be 0 or 1\", function() {\n pm.expect(element.qt_xn_citizen_ind).to.be.within(0,1);\n });\n });\n};" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Service-Response-Tests", - "event": [ - { - "listen": "test", - "script": { - "id": "0e6c4264-28b3-4a49-b6bb-1199aef2cb13", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"service_response_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "var schema = {\n \"properties\" : {\n \"sr_id\" : {\n \"type\" : [\"object\", \"number\"]\n },\n \"sr_state\" : {\n \"type\" : \"object\"\n },\n \"periods\" : {\n \"type\" : \"array\"\n },\n \"service\" : {\n \"type\" : \"object\"\n },\n \"citizen\" : {\n \"type\" : [\"object\", \"number\"]\n },\n \"quantity\" : {\n \"type\" : \"number\"\n },\n \"service_id\" : {\n \"type\" : [\"object\", \"number\"]\n },\n \"citizen_id\" : {\n \"type\" : [\"object\", \"number\"]\n },\n \"channel\" : {\n \t\"type\" : \"object\"\n },\n \"channel_id\" : {\n \t\"type\" : [\"object\", \"number\"]\n }\n \n },\n \"required\" : [\n \t\"sr_id\", \"sr_state\", \"periods\", \"service\", \"citizen\", \"quantity\",\n \t\"service_id\", \"citizen_id\", \"channel\", \"channel_id\"\n ]\n};\n\n// Declare, initialize variables.\nvar allElements = null;\n\nif (jsonData.hasOwnProperty(\"service_requests\")) {\n\tallElements = jsonData.service_requests;\n};\n\nif (jsonData.hasOwnProperty(\"service_request\")) {\n allElements = [];\n\tallElements.push(jsonData.service_request);\n}\n\nvar elementCount = 0;\n\n// If there are some service requests, proceed with tests.\nif (allElements !== null) {\n\n // Loop to validate schema of each service request.\n allElements.forEach(function(element) {\n elementCount ++;\n var testTitle = \"Service Request (\" + elementCount + \"): \" + element.sr_id + \" - \";\n tests[testTitle + \"conforms to schema\"] = tv4.validate(element, schema);\n });\n};" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - }, - { - "name": "CFMS-Install-Get-Active-Citizens-Tests", - "event": [ - { - "listen": "test", - "script": { - "id": "8856712d-73ca-4172-89ba-590e8b015c6b", - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"get_active_citizens_test\", jsonData.data);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "// Declare and initialize variables.\nvar elementCount = 0;\nvar srCount = 0;\nvar isFirstCitizen = true;\n\n\n// Loop to create list of active citizen ids.\nallElements.forEach(function(element) {\n srCount = element.service_reqs.length;\n\n // If citizen active, add to the list.\n if (element.cs.cs_state_name === \"Active\") {\n //console.log(\"Citizen (\" + elementCount + \") \" + element.citizen_id +\n // \" Active: SRCount = \" + srCount);\n citizenIds.push(element.citizen_id);\n\n // Save the first citizen.\n if (isFirstCitizen) {\n currentCitizen = element;\n isFirstCitizen = false;\n }\n }\n \n // Increment count.\n elementCount++;\n});" - }, - "url": { - "raw": "https://postman-echo.com/post", - "protocol": "https", - "host": [ - "postman-echo", - "com" - ], - "path": [ - "post" - ] - }, - "description": "Sets the authentication script" - }, - "response": [] - } - ], - "description": "This folder performs basic authentication features.", - "protocolProfileBehavior": {} - }, - { - "name": "Check app health", - "item": [ - { - "name": "Check healthz driver TheQ", - "event": [ - { - "listen": "test", - "script": { - "id": "74adc5ce-caa5-452a-bd96-8ac90a4c11d7", - "exec": [ - "// Get the maximum response time allowed.", - "max_load_time = JSON.parse(globals.max_load_time);", - "", - "// Set health response time variable.", - "health_tries = 15;", - "counter = 1;", - "postman.setEnvironmentVariable(\"health_tries\", JSON.stringify(health_tries));", - "postman.setEnvironmentVariable(\"health_counter\", JSON.stringify(counter));", - "", - "// Get the response.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Test the health response.", - "pm.test(\"Health Driver: Try \" + counter.toString() + \": Response should have 'message' property\", function() {", - " pm.expect(jsonData).to.have.property('message');", - "});", - "", - "pm.test(\"Response message should be 'api is healthy'\", function() {", - " pm.expect(jsonData.message).to.be.eql('api is healthy');", - "});", - "", - "// If response time is OK, proceed to the next test.", - "if (pm.response.responseTime < max_load_time) {", - " postman.setNextRequest(\"Check the readyz endpoint TheQ\");", - "}", - " ", - "// Response time is too long. Try again, give pod a chance to spin up.", - "else {", - " postman.setNextRequest(\"Check the healthz endpoint TheQ\");", - "}" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}healthz/", - "host": [ - "{{url}}healthz" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Check the healthz endpoint TheQ", - "event": [ - { - "listen": "test", - "script": { - "id": "74adc5ce-caa5-452a-bd96-8ac90a4c11d7", - "exec": [ - "// Get the maximum load time allowed.", - "max_load_time = JSON.parse(postman.getEnvironmentVariable(\"max_load_time\"));", - "", - "// Get and update variables.", - "health_tries = JSON.parse(postman.getEnvironmentVariable(\"health_tries\"));", - "counter = JSON.parse(postman.getEnvironmentVariable(\"health_counter\")) + 1;", - "postman.setEnvironmentVariable(\"health_counter\", JSON.stringify(counter));", - "", - "// Get the response.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Test the health response.", - "pm.test(\"Health Driver: Try \" + counter.toString() + \": Response should have 'message' property\", function() {", - " pm.expect(jsonData).to.have.property('message');", - "});", - "", - "pm.test(\"Response message should be 'api is healthy'\", function() {", - " pm.expect(jsonData.message).to.be.eql('api is healthy');", - "});", - "", - "// If response time is OK, proceed to the next test.", - "if (pm.response.responseTime < max_load_time) {", - " postman.setNextRequest(\"Check the readyz endpoint TheQ\");", - "}", - " ", - "// Response time is too long.", - "else {", - " ", - " // You haven't reached your maximum tries yet. Try again.", - " if (counter < health_tries) {", - " postman.setNextRequest(\"Check the healthz endpoint\");", - " }", - " ", - " // You have reached the maximum. An error, go to next test.", - " else {", - " pm.test(\"Response should be below \" + max_load_time.toString() + ' in ' + health_tries.toString() + ' tries.', function() {", - " pm.expect(counter).to.be.below(health_tries);", - " });", - " postman.setNextRequest(\"Check the readyz endpoint TheQ\");", - " }", - "}", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}healthz/", - "host": [ - "{{url}}healthz" - ], - "path": [ - "" - ] - } - }, - "response": [] - }, - { - "name": "Check the readyz endpoint TheQ", - "event": [ - { - "listen": "test", - "script": { - "id": "661c33c4-4a3d-4396-a549-9969edafbfa6", - "exec": [ - "// Perform the standard tests.", - "eval(environment.basic_response_test);", - "", - "var jsonData = JSON.parse(responseBody);", - "", - "// Test the health response.", - "pm.test(\"Response should have 'message' property\", function() {", - " pm.expect(jsonData).to.have.property('message');", - "});", - "", - "pm.test(\"Response message should be 'api is ready'\", function() {", - " pm.expect(jsonData.message).to.be.eql('api is ready');", - "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}readyz/", - "host": [ - "{{url}}readyz" - ], - "path": [ - "" - ] - } - }, - "response": [] - } - ], - "description": "Checks the application health by calling the healthz and readyz endpoints", - "protocolProfileBehavior": {} - }, - { - "name": "Check user login", - "item": [ - { - "name": "Authenticate default QTxn user", - "event": [ - { - "listen": "test", - "script": { - "id": "43df8e47-2b93-48b0-a5ff-bb3396d12537", - "exec": [ - "// Do the basic checks.", - "eval(environment.basic_response_test);", - "", - "// Get the response.", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to make sure that the access token field is not null", - "pm.test(\"Access Token is not null\", function(){", - " var access_token = jsonData.access_token;", - " pm.expect(access_token).not.eql(null);", - "});", - "", - "//Test to make sure that the refresh token response field is not null", - "pm.test(\"Refresh Token is not null\", function(){", - " var refresh_token = jsonData.refresh_token;", - " pm.expect(refresh_token).not.eql(null);", - "});", - "", - "//Test to make sure that expires in response field is not nullf", - "pm.test(\"Expires In is not null\", function(){", - " var expires_in = jsonData.expires_in;", - " pm.expect(expires_in).not.eql(null);", - "});", - "", - "//Test to make sure that refresh expires in response fiels is not null", - "pm.test(\"Refresh Expires In is not null\", function(){", - " var refresh_expires_in = jsonData.refresh_expires_in;", - " pm.expect(refresh_expires_in).not.eql(null);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/x-www-form-urlencoded" - } - ], - "body": { - "mode": "raw", - "raw": "grant_type=password&client_id={{clientid}}&username={{userid}}&password={{password}}&client_secret={{client_secret}}" - }, - "url": { - "raw": "{{auth_url}}/auth/realms/{{realm}}/protocol/openid-connect/token?Content-Type=application/x-www-form-urlencoded", - "host": [ - "{{auth_url}}" - ], - "path": [ - "auth", - "realms", - "{{realm}}", - "protocol", - "openid-connect", - "token" - ], - "query": [ - { - "key": "Content-Type", - "value": "application/x-www-form-urlencoded" - } - ] - }, - "description": "Make sure the operator ID can log in" - }, - "response": [] - }, - { - "name": "Who am I TheQ", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "if (jsonData.hasOwnProperty(\"csr\")) {", - "\tcurrentOfficeId = jsonData.csr.office_id;", - "\tcurrentOfficeNumber = jsonData.csr.office.office_number;", - "\tcurrentCsrId = jsonData.csr.csr_id;", - " postman.setEnvironmentVariable(\"current_office_id\", currentOfficeId);", - " postman.setEnvironmentVariable(\"current_office_number\", currentOfficeNumber);", - " postman.setEnvironmentVariable(\"current_csr_id\", currentCsrId);", - "};", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}csrs/me/", - "host": [ - "{{url}}csrs" - ], - "path": [ - "me", - "" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Check channels", - "item": [ - { - "name": "Get channels", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "2b71673c-4aa2-47b3-8594-15f02b390ee0", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "42742c4c-505d-472d-857b-fdba74cc49ac", - "exec": [ - "// Run basic tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "var schema = {", - " \"properties\" : {", - " \"channel_name\" : {", - " \"type\" : \"string\"", - " },", - " \"channel_id\" : {", - " \"type\" : [\"number\", \"object\"]", - " }", - " },", - " \"required\" : [\"channel_name\", \"channel_id\"]", - "};", - "", - "// Loop to validate schema of each channel.", - "var allChannels = jsonData.channels;", - "var channelCount = 0;", - "var phoneId = 0;", - "var emailId = 0;", - "var phoneText = \"Phone\";", - "var emailText = \"Email/Fax/Mail\";", - "allChannels.forEach(function(channel) {", - " channelCount ++;", - " var testTitle = \"Channel (\" + channelCount + \"): ID \" + channel.channel_id + \" Name \" + channel.channel_name + \" conforms to schema\";", - " tests[testTitle] = tv4.validate(channel, schema);", - " if (channel.channel_name === phoneText) {", - " phoneId = channel.channel_id;", - " }", - " if (channel.channel_name === emailText) {", - " emailId = channel.channel_id;", - " }", - "});", - "", - "// Check that you found the phone ID.", - "pm.test(phoneText + ' id was ' + phoneId.toString() + ' (should not equal 0)', function() {", - " pm.expect(phoneId).to.not.be.eql(0);", - "});", - "", - "// Check that you found the email ID.", - "pm.test(emailText + ' id was ' + emailId.toString() + ' (should not equal 0)', function() {", - " pm.expect(emailId).to.not.be.eql(0);", - "});", - "", - "// Store this ID for future use.", - "postman.setEnvironmentVariable(\"channel_telephone_id\", JSON.stringify(phoneId));", - "postman.setEnvironmentVariable(\"channel_email_id\", JSON.stringify(emailId));" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}channels/", - "host": [ - "{{url}}channels" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Check counters", - "item": [ - { - "name": "Store CSR and Office Info", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "c34723d3-c0d1-4504-97a2-373088309a5b", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", - "exec": [ - "// Define the JSON Schema expected in response", - "var CSRSSchema = {", - " \"type\": \"object\",", - " \"properties\": {", - " \"csr_id\": {\"type\": \"number\"},", - " \"csr_state\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"csr_state_desc\": {\"type\": \"string\"},", - " \"csr_state_id\": {\"type\": \"number\"},", - " \"csr_state_name\": {\"type\": \"string\"}", - " },", - " \"required\": [\"csr_state_desc\", \"csr_state_id\", \"csr_state_name\"]", - " },", - " \"csr_state_id\": {\"type\": \"number\"},", - " \"deleted\": {},", - " \"finance_designate\": {\"type\": \"number\"},", - " \"office_manager\": {\"type\": \"number\"},", - " \"ita2_designate\": {\"type\": \"number\"},", - " \"office\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"appointments_enabled_ind\": {\"type\": \"number\"},", - " \"exams_enabled_ind\": {\"type\": \"number\"},", - " \"office_id\": {\"type\": \"number\"},", - " \"office_name\": {\"type\": \"string\"},", - " \"office_number\": {\"type\": \"number\"},", - " \"sb\":{", - " \"type\": \"object\",", - " \"properties\": {", - " \"sb_id\": {\"type\": \"number\"},", - " \"sb_type\": {\"type\": \"string\"}", - " },", - " \"required\": [\"sb_id\", \"sb_type\"]", - " }", - " },", - " \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"sb\"]", - " },", - " \"office_name\": {\"type\": \"string\"},", - " \"pesticide_designate\": {\"type\": \"number\"},", - " \"qt_xn_csr_ind\": {\"type\": \"number\"},", - " \"receptionist_ind\": {\"type\": \"number\"},", - " \"role\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"role_code\": {\"type\": \"string\"},", - " \"role_desc\": {\"type\": \"string\"},", - " \"role_id\": {\"type\": \"number\"}", - " },", - " \"required\": [\"role_code\", \"role_desc\", \"role_id\"]", - " },", - " \"role_id\": {\"type\": \"number\"},", - " \"username\": {\"type\": \"string\"}", - " },", - " \"attention_needed\": {\"type\": \"boolean\"},", - " \"required\": [\"csr\", \"attention_needed\"]", - "};", - "", - "// Run basic response tests.", - "eval(environment.basic_response_test);", - "", - "// Parse response body", - "var jsonData = JSON.parse(responseBody);", - "", - "//Test to see if response schema is valid", - "pm.test(\"Validate Response CSRs Schema\", function(){", - " pm.expect(tv4.validate(jsonData, CSRSSchema)).to.be.true;", - "});", - "", - "// Make sure that jsonData has an csr property.", - "pm.test(\"Response should have csr property\", function(){", - " pm.expect(jsonData.hasOwnProperty(\"csr\")).to.be.true;", - "});", - "", - "var csr = 0;", - "var office = 0;", - "var counters = 0;", - "var counter_text = \"Counter\";", - "var counter_id = 0;", - "var qtxn_text = \"Quick Trans\";", - "var qtxn_id = 0;", - "", - "if (jsonData.hasOwnProperty(\"csr\")) {", - "\tcurrentOfficeId = jsonData.csr.office_id;", - "\tcurrentOfficeNumber = jsonData.csr.office.office_number;", - " postman.setEnvironmentVariable(\"current_office_id\", currentOfficeId);", - " postman.setEnvironmentVariable(\"current_office_number\", currentOfficeNumber);", - " postman.setEnvironmentVariable(\"current_csr_id\", jsonData.csr.csr_id);", - " ", - " csr = jsonData.csr;", - " counter_id = 0;", - " qtxn_id = 0;", - "", - " // Make sure that jsonData has an booking property.", - " pm.test(\"CSR should have office property\", function(){", - " pm.expect(csr.hasOwnProperty(\"office\")).to.be.true;", - " });", - " ", - " // Make sure office has counter property.", - " if (csr.hasOwnProperty(\"office\")) {", - " office = csr.office;", - " ", - " // Make sure that jsonData has an booking property.", - " pm.test(\"Office should have counters property\", function(){", - " pm.expect(office.hasOwnProperty(\"counters\")).to.be.true;", - " });", - "", - " // Make sure office has counter property.", - " if (office.hasOwnProperty(\"counters\")) {", - " counters = office.counters;", - " ", - " // Search for Counter and Quick Trans counters", - " counters.forEach(function(counter) {", - " if (counter.counter_name === counter_text) {", - " counter_id = counter.counter_id;", - " }", - " if (counter.counter_name === qtxn_text) {", - " qtxn_id = counter.counter_id;", - " }", - " });", - " ", - " // Make sure you found the right IDs.", - " pm.test(\"Counter ID (\" + counter_id.toString() + \") should not be 0\", function(){", - " pm.expect(counter_id).to.not.be.eql(0);", - " });", - " pm.test(\"Quick Transaction ID (\" + qtxn_id.toString() + \") should not be 0\", function(){", - " pm.expect(qtxn_id).to.not.be.eql(0);", - " });", - " ", - " // Store the ids for future use.", - " // postman.setEnvironmentVariable(\"counter_id\", counter_id);", - " // postman.setEnvironmentVariable(\"qtxn_id\", qtxn_id);", - " postman.setEnvironmentVariable(\"counter_id\", JSON.stringify(counter_id.toString()));", - " postman.setEnvironmentVariable(\"qtxn_id\", JSON.stringify(qtxn_id.toString()));", - " }", - "", - " ", - " }", - "", - "}", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}csrs/me/", - "host": [ - "{{url}}csrs" - ], - "path": [ - "me", - "" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Check categories", - "item": [ - { - "name": "Get categories", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "e99f23ee-5a03-43d9-9075-75dbf06aadcc", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "1a9c9ff5-8475-4dd2-a6c7-ffb5d4689145", - "exec": [ - "// Run basic tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "var schema = {", - " \"properties\" : {", - " \"display_dashboard_ind\" : {", - " \"type\" : \"number\"", - " },", - " \"deleted\" : {", - " \"type\" : [\"object\", \"null\"]", - " },", - " \"actual_service_ind\" : {", - " \"type\" : \"number\"", - " },", - " \"service_id\" : {", - " \"type\" : [\"number\", \"object\"]", - " },", - " \"service_code\" : {", - " \"type\" : \"string\"", - " },", - " \"prefix\" : {", - " \"type\" : \"string\"", - " },", - " \"service_name\" : {", - " \"type\" : \"string\"", - " },", - " \"parent_id\" : {", - " \"type\" : [\"object\", \"null\" ]", - " },", - " \"service_desc\" : {", - " \"type\" : \"string\"", - " }", - " },", - " \"required\" : [\"display_dashboard_ind\", \"deleted\", \"actual_service_ind\", \"service_id\", \"service_code\",", - " \"prefix\", \"service_name\", \"parent_id\", \"service_desc\"]", - "};", - "", - "// Loop to validate schema of each channel.", - "var allCategories = jsonData.categories;", - "var categoryCount = 0;", - "allCategories.forEach(function(category) {", - " categoryCount ++;", - " var testTitle = \"Category (\" + categoryCount + \"): \" + category.service_name + \" - \";", - " tests[testTitle + \"conforms to schema\"] = tv4.validate(category, schema);", - " var displayInd = category.display_dashboard_ind;", - " var serviceInd = category.actual_service_ind;", - "", - " // Test that returned data is valid.", - " pm.test(\"--> \" + testTitle + \"display_dashboard_ind must be 0 (is \" + displayInd.toString() + \")\", function(){", - " pm.expect(displayInd).to.be.eql(0);", - " });", - "", - " pm.test(\"--> \" + testTitle + \"actual_service_ind must be 0 (is \" + serviceInd.toString() + \")\", function(){", - " pm.expect(serviceInd).to.be.eql(0);", - " });", - " ", - " pm.test(\"--> \" + testTitle + \"parent_id must be null\", function(){", - " pm.expect(category.parent_id).to.be.null;", - " });", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}categories/", - "host": [ - "{{url}}categories" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Check services", - "item": [ - { - "name": "Get services", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "d01c3826-dc28-4cce-957b-ec70d0393e7e", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_first);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "3b11031e-4031-4569-91f2-49e23517ffee", - "exec": [ - "// Run basic tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "var schema = {", - " \"properties\" : {", - " \"display_dashboard_ind\" : {", - " \"type\" : \"number\"", - " },", - " \"deleted\" : {", - " \"type\" : [\"object\", \"null\"]", - " },", - " \"actual_service_ind\" : {", - " \"type\" : \"number\"", - " },", - " \"service_id\" : {", - " \"type\" : [\"number\", \"object\"]", - " },", - " \"service_code\" : {", - " \"type\" : \"string\"", - " },", - " \"prefix\" : {", - " \"type\" : \"string\"", - " },", - " \"service_name\" : {", - " \"type\" : \"string\"", - " },", - " \"parent_id\" : {", - " \"type\" : [\"object\", \"number\", \"null\" ]", - " },", - " \"service_desc\" : {", - " \"type\" : \"string\"", - " }", - " },", - " \"required\" : [\"display_dashboard_ind\", \"deleted\", \"actual_service_ind\", \"service_id\", \"service_code\",", - " \"prefix\", \"service_name\", \"parent_id\", \"service_desc\"]", - "};", - "", - "// Loop to validate schema of each channel.", - "var allElements = jsonData.services;", - "var elementCount = 0;", - "var elementMax = Math.min(10, allElements.length);", - "//allElements.forEach(function(element) {", - "for (var currentElement = 0; currentElement < elementMax; currentElement++) {", - " element = allElements[currentElement];", - " elementCount ++;", - " var testTitle = \"Service (\" + elementCount + \"): \" + element.service_name + \" - \";", - " tests[testTitle + \"conforms to schema\"] = tv4.validate(element, schema);", - " displayInd = element.display_dashboard_ind;", - " serviceInd = element.actual_service_ind;", - "", - " // Test that returned data is valid.", - " pm.test(\"--> \" + testTitle + \"display_dashboard_ind must be 0 or 1 (is \" + displayInd.toString() + \")\", function(){", - " pm.expect(displayInd).to.be.within(0, 1);", - " });", - "", - " // Test that returned data is valid.", - " pm.test(\"--> \" + testTitle + \"actual_service_ind must be 1 (is \" + serviceInd.toString() + \")\", function(){", - " pm.expect(serviceInd).to.be.eql(1);", - " });", - " ", - " // Test that returned data is valid.", - " pm.test(\"--> \" + testTitle + \"parent_id must not be null\", function(){", - " pm.expect(element.parent_id).to.not.be.null;", - " });", - "}", - "", - "// Declare and initialize variables.", - "var mspId = 0;", - "var taxId = 0;", - "var mspText = \"Payment - MSP\";", - "var propTaxText = \"Other - PTAX\";", - "", - "// Look for the MSP and Property Tax IDs.", - "allElements.forEach(function(element) {", - " if (element.service_name === mspText) {", - " mspId = element.service_id;", - " }", - " if (element.service_name === propTaxText) {", - " taxId = element.service_id;", - " }", - "});", - "", - "// Check that you found the MSP service.", - "pm.test(mspText + ' id was ' + mspId.toString() + ' (should not equal 0)', function() {", - " pm.expect(mspId).to.not.be.eql(0);", - "});", - "", - "// Check that you found the Property Tax service.", - "pm.test(propTaxText + ' id was ' + taxId.toString() + ' (should not equal 0)', function() {", - " pm.expect(taxId).to.not.be.eql(0);", - "});", - "", - "// Store these IDs for future use.", - "postman.setEnvironmentVariable(\"service_MSP_id\", JSON.stringify(mspId));", - "postman.setEnvironmentVariable(\"service_PropTax_id\", JSON.stringify(taxId));" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - } - ], - "url": { - "raw": "{{url}}services/", - "host": [ - "{{url}}services" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Check citizen through queue (QT1)", - "item": [ - { - "name": "Create citizen (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "7896261d-7d88-4eba-860b-98472655c4a7", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " pm.test(\"Only one citizen should be in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - " ", - " // Store the ID of the citizen just created.", - " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{}" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Edit specific citizen (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "b72e7756-5de1-4a13-9609-8917ea63dee7", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "73110fdd-6476-403d-b6c9-c108032fbd66", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - "", - " // Perform tests.", - " pm.test(\"Must be one active citizen in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}}\n}" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Add property tax via phone service request (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "fa6f6a3b-e4e7-42b6-a8d3-ecda3840418a", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" - }, - "url": { - "raw": "{{url}}service_requests/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "List specific citizen (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "66ca9683-be00-478b-92c0-6ac698d9088b", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request must have one period', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", - " });", - " pm.test('Service request period channel must be ' + citizenChannel, function() {", - " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", - " });", - " pm.test('Service request period state must be \"Ticket Creation\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/{{current_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Add citizen to queue (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "8a294876-edfa-4d5b-ada4-399f5339cd8f", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Pending\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (now two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Waiting\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/add_to_queue/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "add_to_queue", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Invite specific citizen (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "8e9cd1ef-a5d9-4f81-b061-f818d4fc5603", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 3 (now three periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(3);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Invited\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Invited\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/invite/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "invite", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Begin serving citizen (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "1b1f7f66-04cd-4f10-bfa2-c4f3fffe8715", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 4 (now four periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(4);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Being Served\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/begin_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "begin_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Finish serving citizen (QT1)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "818713b9-18a0-4fef-9c16-f71b43dd2ad0", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be no active citizens in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Complete\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 4 (still four periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(4);", - " });", - " pm.test('There must be no open periods', function() {", - " pm.expect(openPeriodCount).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/finish_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "finish_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Check citizen begin-hold-finish (QT2)", - "item": [ - { - "name": "Create citizen (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e77d15de-91e2-4528-87bd-5734405b4def", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Perform tests.", - " pm.test(\"Only one citizen should be in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - " ", - " // Store the ID of the citizen just created.", - " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", - "} ", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{}" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Edit specific citizen (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "ce732be5-38a3-4825-90d1-4d52babf8917", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "", - "// // Get data, create JSON body.", - "// var citizenName = postman.getEnvironmentVariable(\"citizen_name\");", - "// var citizenComments = postman.getEnvironmentVariable(\"citizen_comment\");", - "// var bodyData = {", - "// \"citizen_name\" : citizenName,", - "// \"citizen_comments\" : citizenComments", - "// }", - "", - "// // Store the data in an environment variable.", - "// postman.setEnvironmentVariable(\"putBody\", JSON.stringify(bodyData));" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "13828662-748d-4b3f-9ead-454e795f1f01", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - "", - " // Perform tests.", - " pm.test(\"Must be one active citizen in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}}\n}" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Add property tax via phone service request (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "fa6f6a3b-e4e7-42b6-a8d3-ecda3840418a", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" - }, - "url": { - "raw": "{{url}}service_requests/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "List specific citizen (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "2a57d1b2-9d0c-4e07-ad20-d4dde457f9d1", - "exec": [ - "// Install postmanBDD, json-bigint parse and stringify.", - "eval(globals.postmanBDD);", - "eval(globals.json_bigint_parse);", - "", - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request must have one period', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", - " });", - " pm.test('Service request period channel must be ' + citizenChannel, function() {", - " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", - " });", - " pm.test('Service request period state must be \"Ticket Creation\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/{{current_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Begin serving citizen (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "4550a6b7-560d-48bf-bfc9-41453a8defec", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (now two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Being Served\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/begin_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "begin_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Place citizen on hold (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "dd51a48d-2e1e-47fd-978f-507b77a7901f", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 3 (now three periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(3);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"On hold\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"On hold\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/place_on_hold/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "place_on_hold", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Get service requests (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "f4809d17-b59d-47fc-861e-5edaf421bddc", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.service_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - "var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - "var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get periods for the first service request.", - " var allPeriods = allElements[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " var allPeriodCount = 0;", - "", - " // Find how many periods there are with null end time.", - " // Also, check schema.", - " allPeriods.forEach(function(onePeriod) {", - " ", - " // Find the open period.", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " ", - " });", - "} ", - "", - "// If there are some service requests, proceed with tests.", - "if (allElements !== null) {", - "", - " // Perform tests.", - " pm.test('There must be only one service request', function() {", - " pm.expect(allElements.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(allElements[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(allElements[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(allElements[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request must have three periods', function() {", - " pm.expect(allPeriods.length).to.be.eql(3);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('Service request period state must be \"On hold\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"On hold\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/{{current_client}}/service_requests/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "service_requests", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Call citizen from hold (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "66563797-2a92-4dbd-946e-7232dcac8260", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 4 (now four periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(4);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Being Served\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/begin_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "begin_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Finish serving citizen (QT2)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "ec865f9c-a4b6-421f-956e-783972df2ad3", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - " ", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = allElements[0].service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be no active citizens in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Complete\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 4 (still four periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(4);", - " });", - " pm.test('There must be no open periods', function() {", - " pm.expect(openPeriodCount).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/finish_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "finish_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Check citizen leave after create (QT3)", - "item": [ - { - "name": "Create citizen (QT3)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "061a479c-37b4-4707-b8c6-c31cacadecec", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Perform tests.", - " pm.test(\"Only one citizen should be in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "", - " // Store the ID of the citizen just created.", - " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{}" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Citizen left (QT3)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "16eaefc2-0d16-405e-9e70-e85314da841b", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get environment variables.", - " var citizenName = postman.getEnvironmentVariable(\"citizen_name\");", - " var citizenComment = postman.getEnvironmentVariable(\"citizen_comment\");", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = null;", - " if (currentCitizen.service_reqs.length !== 0) {", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " }", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " if (allPeriods !== null) {", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - " }", - "", - " // Perform tests.", - " pm.test(\"Must be no active citizens in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/citizen_left/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "citizen_left", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Check citizen leave after waiting (QT4)", - "item": [ - { - "name": "Create citizen (QT4)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "fcc1415c-0861-4516-8843-bfc3717a76d9", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Perform tests.", - " pm.test(\"Only one citizen should be in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "", - " // Store the ID of the citizen just created.", - " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{}" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Edit specific citizen (QT4)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "f26eaedb-5d41-4dcc-b856-aec599440601", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "", - "// // Get data, create JSON body.", - "// var citizenName = postman.getEnvironmentVariable(\"citizen_name\");", - "// var citizenComments = postman.getEnvironmentVariable(\"citizen_comment\");", - "// var bodyData = {", - "// \"citizen_name\" : citizenName,", - "// \"citizen_comments\" : citizenComments", - "// }", - "", - "// // Store the data in an environment variable.", - "// postman.setEnvironmentVariable(\"putBody\", JSON.stringify(bodyData));" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "e0b48324-0ca2-4b2e-88ef-cbfbe10b5fb7", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - "", - " // Perform tests.", - " pm.test(\"Must be one active citizen in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}}\n}" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Add property tax via phone service request (QT4)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "fa6f6a3b-e4e7-42b6-a8d3-ecda3840418a", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" - }, - "url": { - "raw": "{{url}}service_requests/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "List specific citizen (QT4)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "1176fcca-52ff-4e13-b4a4-775ad324a4c6", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request must have one period', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", - " });", - " pm.test('Service request period channel must be ' + citizenChannel, function() {", - " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", - " });", - " pm.test('Service request period state must be \"Ticket Creation\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/{{current_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Add citizen to queue (QT4)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "f0aacc69-ff0e-4ed3-9ef7-f131bbf3a5bd", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Pending\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (now two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Waiting\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/add_to_queue/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "add_to_queue", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Citizen left (QT4)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "4ee90115-54c2-4b44-b6f1-d739e8a385b1", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test(\"Must be no active citizens in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test(\"Citizen should have one service request\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Complete\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (now two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must be no open periods', function() {", - " pm.expect(openPeriodCount).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/citizen_left/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "citizen_left", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - }, - { - "name": "Check update service information (QT5)", - "item": [ - { - "name": "Create citizen (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "d3bbd88a-25fd-4fe6-ae7e-359373df02ac", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - "", - " // Perform tests.", - " pm.test(\"Only one citizen should be in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test(\"Current citizen name should be null\", function() {", - " pm.expect(currentCitizen.citizen_name).to.be.null;", - " });", - - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "", - " // Store the ID of the citizen just created.", - " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{}" - }, - "url": { - "raw": "{{url}}citizens/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Edit specific citizen (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "2be395b2-e14c-4ff8-8753-42ea1fe2010d", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "", - "// // Get data, create JSON body.", - "// var citizenName = postman.getEnvironmentVariable(\"citizen_name\");", - "// var citizenComments = postman.getEnvironmentVariable(\"citizen_comment\");", - "// var bodyData = {", - "// \"citizen_name\" : citizenName,", - "// \"citizen_comments\" : citizenComments", - "// };", - "", - "// // Store the data in an environment variable.", - "// postman.setEnvironmentVariable(\"putBody\", JSON.stringify(bodyData));" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "2e7878d3-653e-479e-850f-c454b378217e", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - " ", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - "", - " // Perform tests.", - " pm.test(\"Must be one active citizen in the office\", function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test(\"Citizen should have no service requests\", function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}}\n}" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Add property tax via phone service request (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "fa6f6a3b-e4e7-42b6-a8d3-ecda3840418a", - "exec": [ - "// Run complex tests.", - "eval(environment.create_response_test);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" - }, - "url": { - "raw": "{{url}}service_requests/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "List specific citizen (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "3d906a10-51fe-4329-bac0-e69e6847e852", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - " ", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request must have one period', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", - " });", - " pm.test('Service request period channel must be ' + citizenChannel, function() {", - " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", - " });", - " pm.test('Service request period state must be \"Ticket Creation\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", - " });", - "", - " // Save the service request ID for later.", - " var mySRId = allElements[0].service_reqs[0].sr_id;", - " postman.setEnvironmentVariable(\"current_sr_id\", JSON.stringify(mySRId));", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "url": { - "raw": "{{url}}citizens/{{current_client}}/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Begin serving citizen (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "ff3a25ca-0df2-40f2-b7a1-9e9b4bde2aab", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = null;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Run citizen tests.", - " eval(environment.get_active_citizens_test);", - " ", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be one active citizen in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(1);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", - " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", - " });", - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Active\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (now two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must only be one open period', function() {", - " pm.expect(openPeriodCount).to.be.eql(1);", - " });", - " pm.test('The open period state must be \"Being Served\"', function() {", - " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/begin_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "begin_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Update quantity from 3 to 5 (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "153a139d-0daa-4031-ba0a-e7204ade2648", - "exec": [ - "// Run complex tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.service_response_test);", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Only check for an updated quantity. Get environment variables.", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", - "", - " // Perform tests.", - " pm.test('Updated service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(allElements[0].quantity).to.be.eql(citizenQuantity);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"quantity\" : {{citizen_quantity_update}}\n}" - }, - "url": { - "raw": "{{url}}service_requests/{{current_sr_id}}/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "{{current_sr_id}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Update service from PropTax to MSP (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "8faaa693-a7a4-45ed-9318-325a498a98af", - "exec": [ - "// Run complex tests.", - "eval(environment.basic_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.service_response_test);", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Only check for an updated quantity. Get environment variables.", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", - "", - " // Perform tests.", - " pm.test('Updated service request service must be ' + citizenService, function() {", - " pm.expect(allElements[0].service_id).to.be.eql(citizenService);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"service_id\" : {{service_MSP_id}}\n}" - }, - "url": { - "raw": "{{url}}service_requests/{{current_sr_id}}/", - "host": [ - "{{url}}service_requests" - ], - "path": [ - "{{current_sr_id}}", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - }, - { - "name": "Finish serving citizen (QT5)", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", - "exec": [ - "// Ensure the client is logged in.", - "eval(environment.auth_script);", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "id": "7a831dcf-ff2c-4907-95c5-bf042cdd967a", - "exec": [ - "// Run complex tests.", - "eval(environment.complex_response_test);", - "", - "// Get json return data.", - "var jsonData = JSON.parse(responseBody);", - "", - "// Run citizen tests.", - "eval(environment.citizen_response_test);", - "", - "// Declare, initialize variables.", - "var citizenIds = [];", - "var currentCitizen = jsonData.citizen;", - "", - "// If there are some citizens, proceed with tests.", - "if (allElements !== null) {", - "", - " // Get environment variables.", - " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", - " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", - " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", - " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", - " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", - " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", - " var allPeriods = currentCitizen.service_reqs[0].periods;", - " var openPeriod = null;", - " var openPeriodCount = 0;", - " ", - " // Find how many periods there are with null end time.", - " allPeriods.forEach(function(onePeriod) {", - " if (!onePeriod.time_end) {", - " openPeriod = onePeriod;", - " openPeriodCount++;", - " }", - " });", - "", - " // Perform tests.", - " pm.test('Must be no active citizens in the office', function() {", - " pm.expect(citizenIds.length).to.be.eql(0);", - " });", - " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", - " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", - " });", - " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", - " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", - " });", - - " pm.test('There must be only one service request', function() {", - " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", - " });", - " pm.test('Service request state must be \"Complete\"', function() {", - " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", - " });", - " pm.test('Service request service must be ' + citizenService, function() {", - " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", - " });", - " pm.test('Service request quantity must be ' + citizenQuantity, function() {", - " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", - " });", - " pm.test('Service request periods length must be 2 (should be two periods)', function() {", - " pm.expect(allPeriods.length).to.be.eql(2);", - " });", - " pm.test('There must be no open periods', function() {", - " pm.expect(openPeriodCount).to.be.eql(0);", - " });", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{token}}" - }, - { - "key": "Accept", - "value": "application/json, text/plain, */*" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}citizens/{{current_client}}/finish_service/", - "host": [ - "{{url}}citizens" - ], - "path": [ - "{{current_client}}", - "finish_service", - "" - ] - }, - "description": "Get a list of clients in the queue" - }, - "response": [] - } - ], - "protocolProfileBehavior": {} - } - ], - "protocolProfileBehavior": {} -} \ No newline at end of file + "info": { + "_postman_id": "cda6659f-7e26-412f-9a1c-979b54507ea2", + "name": "Load_Test_TheQ", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "Setup", + "item": [ + { + "name": "Setup-Variables", + "event": [ + { + "listen": "test", + "script": { + "id": "5409b66d-67a4-449b-8633-9aeca632b388", + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "e9eed831-7955-4218-a400-ae6e1e7e2e10", + "exec": [ + "// See if the use-prefix global has been set. Use default if not.", + "let usePrefix = '';", + "if (pm.globals.get('use-prefix')) {", + " console.log(\"==> use-prefix exists\");", + " usePrefix = pm.globals.get('use-prefix');", + " console.log(\" --> Prefix is: \" + usePrefix);", + " ", + " // Set up all globals, using the correct prefix.", + " pm.globals.set('auth_url', pm.globals.get(usePrefix + 'auth_url'));", + " pm.globals.set('realm', pm.globals.get(usePrefix + 'realm'));", + " pm.globals.set('clientid', pm.globals.get(usePrefix + 'clientid'));", + " pm.globals.set('client_secret', pm.globals.get(usePrefix + 'client_secret'));", + " pm.globals.set('url', pm.globals.get(usePrefix + 'url'));", + "}", + "else {", + " console.log(\"==> use-prefix does not exist\");", + " console.log(\" --> No default globals set.\");", + "}", + "", + "// If no maximum load time defined, set a default.", + "if (!pm.globals.get('max_load_time')) {", + " console.log(\"==> max_load_time not present, default set.\");", + " pm.globals.set(\"max_load_time\", JSON.stringify(1503));", + "}", + "", + "// If no maximum response defined, set a default.", + "if (!pm.globals.get('max_response_time')) {", + " console.log(\"==> max_response_time not present, default set.\");", + " pm.globals.set(\"max_response_time\", JSON.stringify(15005));", + "}", + "", + "// Display the values of all globals.", + "console.log(\"\");", + "console.log(\"==> Globals are:\");", + "console.log(\" --> auth_url: \" + pm.globals.get(\"auth_url\"));", + "console.log(\" --> realm: \" + pm.globals.get(\"realm\"));", + "console.log(\" --> clientid: \" + pm.globals.get(\"clientid\"));", + "console.log(\" --> client_secret: \" + pm.globals.get(\"client_secret\"));", + "console.log(\" --> url: \" + pm.globals.get(\"url\"));", + "console.log(\" --> max_load_time: \" + pm.globals.get(\"max_load_time\"));", + "console.log(\" --> max_response_time: \" + pm.globals.get(\"max_response_time\"));", + "", + "", + "// Clear run-scoped variables so reruns do not inherit stale state.", + "pm.globals.unset(\"auth_failure_reason\");", + "pm.globals.unset(\"operator_token\");", + "pm.globals.unset(\"operator_refresh_token\");", + "pm.globals.unset(\"nonqtxn_token\");", + "pm.globals.unset(\"nonqtxn_refresh_token\");", + "pm.globals.unset(\"public_user_token\");", + "pm.globals.unset(\"public_user_refresh_token\");", + "pm.globals.unset(\"token\");", + "pm.globals.unset(\"refresh_token\");", + "pm.globals.unset(\"token_expires\");", + "pm.globals.unset(\"refresh_token_expires\");", + "pm.globals.unset(\"expires_in\");", + "pm.globals.unset(\"refresh_expires_in\");", + "pm.environment.unset(\"current_client\");", + "pm.environment.unset(\"first_sr_id\");", + "pm.environment.unset(\"second_sr_id\");", + "pm.environment.unset(\"current_csr_id\");", + "pm.environment.unset(\"current_office_id\");", + "pm.environment.unset(\"current_office_number\");", + "pm.environment.unset(\"counter_id\");", + "pm.environment.unset(\"qtxn_id\");", + "pm.environment.unset(\"channel_telephone_id\");", + "pm.environment.unset(\"channel_email_id\");", + "pm.environment.unset(\"service_PropTax_id\");", + "pm.environment.unset(\"service_MSP_id\");", + "pm.environment.unset(\"user_id\");", + "pm.environment.unset(\"user_phone\");", + "pm.environment.unset(\"appointment_id\");", + "pm.environment.unset(\"public_office_id\");", + "pm.environment.unset(\"public_office_timezone\");", + "pm.environment.unset(\"public_service_id\");" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Dummy data." + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Basic-Response-Tests", + "event": [ + { + "listen": "test", + "script": { + "id": "a0d8e240-3b40-4654-a32b-bf2e676fdeb9", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"basic_response_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Get the maximum response time allowed.\nmax_response_time = JSON.parse(globals.max_response_time);\n\npm.test('Response time less than ' + max_response_time.toString() + 'ms', function(){\n pm.expect(pm.response.responseTime).to.be.below(max_response_time);\n});\n\nvar contentType = pm.response.headers.get(\"content-type\") || \"\";\n\npm.test(\"Response code for request is 200\", function(){\n pm.expect(pm.response.code).to.eql(200);\n});\npm.test(\"Response header should include Content-Type application/json\", function() {\n pm.expect(contentType.toLowerCase()).to.include(\"application/json\");\n});\npm.test(\"Response body should be valid JSON\", function() {\n pm.expect(function () { pm.response.json(); }).to.not.throw();\n});\n\nif (pm.response.code !== 200) {\n console.log(\"Unexpected status for \" + pm.info.requestName + \": \" + pm.response.code);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected HTTP 200 but received \" + pm.response.code);\n}\n\nif (contentType.toLowerCase().indexOf(\"application/json\") === -1) {\n console.log(\"Unexpected content-type for \" + pm.info.requestName + \": \" + contentType);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected application/json response\");\n}\n\ntry {\n pm.response.json();\n} catch (parseErr) {\n console.log(\"Response body was not valid JSON for \" + pm.info.requestName + \".\");\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw parseErr;\n}" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Complex-Response-Tests", + "event": [ + { + "listen": "test", + "script": { + "id": "f006b951-3205-4f21-a315-369f85591929", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"complex_response_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Get the maximum response time allowed.\nmax_response_time = JSON.parse(globals.max_response_time);\n\npm.test('Response time less than ' + max_response_time.toString() + 'ms', function(){\n pm.expect(pm.response.responseTime).to.be.below(max_response_time);\n});\n\nvar contentType = pm.response.headers.get(\"content-type\") || \"\";\n\npm.test(\"Response code for request is 200\", function(){\n pm.expect(pm.response.code).to.eql(200);\n});\npm.test(\"Response header should include Content-Type application/json\", function() {\n pm.expect(contentType.toLowerCase()).to.include(\"application/json\");\n});\npm.test(\"Response body should be valid JSON\", function() {\n pm.expect(function () { pm.response.json(); }).to.not.throw();\n});\n\nif (pm.response.code !== 200) {\n console.log(\"Unexpected status for \" + pm.info.requestName + \": \" + pm.response.code);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected HTTP 200 but received \" + pm.response.code);\n}\n\nif (contentType.toLowerCase().indexOf(\"application/json\") === -1) {\n console.log(\"Unexpected content-type for \" + pm.info.requestName + \": \" + contentType);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected application/json response\");\n}\n\ntry {\n pm.response.json();\n} catch (parseErr) {\n console.log(\"Response body was not valid JSON for \" + pm.info.requestName + \".\");\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw parseErr;\n}" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Create-Response-Tests", + "event": [ + { + "listen": "test", + "script": { + "id": "382b7b65-d736-4a03-a44a-3891f33b617d", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"create_response_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Get the maximum response time allowed.\nmax_response_time = JSON.parse(globals.max_response_time);\n\npm.test('Response time less than ' + max_response_time.toString() + 'ms', function(){\n pm.expect(pm.response.responseTime).to.be.below(max_response_time);\n});\n\nvar contentType = pm.response.headers.get(\"content-type\") || \"\";\n\npm.test(\"Response status code should be 201 CREATED\", function(){\n pm.expect(pm.response.code).to.eql(201);\n});\npm.test(\"Response header should include Content-Type application/json\", function() {\n pm.expect(contentType.toLowerCase()).to.include(\"application/json\");\n});\npm.test(\"Response body should be valid JSON\", function() {\n pm.expect(function () { pm.response.json(); }).to.not.throw();\n});\n\nif (pm.response.code !== 201) {\n console.log(\"Unexpected status for \" + pm.info.requestName + \": \" + pm.response.code);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected HTTP 201 but received \" + pm.response.code);\n}\n\nif (contentType.toLowerCase().indexOf(\"application/json\") === -1) {\n console.log(\"Unexpected content-type for \" + pm.info.requestName + \": \" + contentType);\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw new Error(\"Expected application/json response\");\n}\n\ntry {\n pm.response.json();\n} catch (parseErr) {\n console.log(\"Response body was not valid JSON for \" + pm.info.requestName + \".\");\n console.log(responseBody);\n pm.execution.setNextRequest(null);\n throw parseErr;\n}" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Citizen-Response-Tests", + "event": [ + { + "listen": "test", + "script": { + "id": "8cebcf78-f5a2-4694-b108-60e146791a78", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"citizen_response_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "var schema = {\n \"properties\" : {\n \"start_time\" : {\n \"type\" : \"string\"\n },\n \"citizen_name\" : {\n \"type\" : [\"string\", \"null\"]\n },\n \"citizen_id\" : {\n \"type\" : [\"number\", \"object\"]\n },\n \"qt_xn_citizen_ind\" : {\n \"type\" : \"number\"\n },\n \"ticket_number\" : {\n \"type\" : [\"string\", \"null\"]\n },\n \"service_reqs\" : {\n \"type\" : \"array\"\n },\n \"office_id\" : {\n \"type\" : [\"object\", \"number\"]\n },\n \"cs\" : {\n \"type\" : \"object\"\n },\n \"citizen_comments\" : {\n \"type\" : [\"string\", \"null\"]\n },\n \n },\n \"required\" : [\"start_time\", \"citizen_name\", \"citizen_id\",\n \"qt_xn_citizen_ind\", \"ticket_number\", \"service_reqs\",\n \"office_id\", \"cs\", \"citizen_comments\"]\n};\n\n// Declare, initialize variables.\nvar allElements = null;\n\nif (jsonData.hasOwnProperty(\"citizens\")) {\n\tallElements = jsonData.citizens;\n};\n\nif (jsonData.hasOwnProperty(\"citizen\")) {\n\tallElements = [];\n\tallElements.push(jsonData.citizen);\n};\n\nvar elementCount = 0;\n\n// If there are some citizens, proceed with tests.\nif (allElements !== null) {\n\n // Loop to validate schema of each channel, create list of citizen ids.\n allElements.forEach(function(element) {\n elementCount ++;\n var testTitle = \"Citizen (\" + elementCount + \"): \" + element.citizen_id + \" - \";\n tests[testTitle + \"conforms to schema\"] = tv4.validate(element, schema);\n \n // Test the authenticate response.\n pm.test(testTitle + \"qt_xn_citizen_ind must be 0 or 1\", function() {\n pm.expect(element.qt_xn_citizen_ind).to.be.within(0,1);\n });\n });\n};" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Service-Response-Tests", + "event": [ + { + "listen": "test", + "script": { + "id": "0e6c4264-28b3-4a49-b6bb-1199aef2cb13", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"service_response_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "var schema = {\n \"properties\" : {\n \"sr_id\" : {\n \"type\" : [\"object\", \"number\"]\n },\n \"sr_state\" : {\n \"type\" : \"object\"\n },\n \"periods\" : {\n \"type\" : \"array\"\n },\n \"service\" : {\n \"type\" : \"object\"\n },\n \"citizen\" : {\n \"type\" : [\"object\", \"number\"]\n },\n \"quantity\" : {\n \"type\" : \"number\"\n },\n \"service_id\" : {\n \"type\" : [\"object\", \"number\"]\n },\n \"citizen_id\" : {\n \"type\" : [\"object\", \"number\"]\n },\n \"channel\" : {\n \t\"type\" : \"object\"\n },\n \"channel_id\" : {\n \t\"type\" : [\"object\", \"number\"]\n }\n \n },\n \"required\" : [\n \t\"sr_id\", \"sr_state\", \"periods\", \"service\", \"citizen\", \"quantity\",\n \t\"service_id\", \"citizen_id\", \"channel\", \"channel_id\"\n ]\n};\n\n// Declare, initialize variables.\nvar allElements = null;\n\nif (jsonData.hasOwnProperty(\"service_requests\")) {\n\tallElements = jsonData.service_requests;\n};\n\nif (jsonData.hasOwnProperty(\"service_request\")) {\n allElements = [];\n\tallElements.push(jsonData.service_request);\n}\n\nvar elementCount = 0;\n\n// If there are some service requests, proceed with tests.\nif (allElements !== null) {\n\n // Loop to validate schema of each service request.\n allElements.forEach(function(element) {\n elementCount ++;\n var testTitle = \"Service Request (\" + elementCount + \"): \" + element.sr_id + \" - \";\n tests[testTitle + \"conforms to schema\"] = tv4.validate(element, schema);\n });\n};" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + }, + { + "name": "CFMS-Install-Get-Active-Citizens-Tests", + "event": [ + { + "listen": "test", + "script": { + "id": "8856712d-73ca-4172-89ba-590e8b015c6b", + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"get_active_citizens_test\", jsonData.data);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "// Declare and initialize variables.\nvar elementCount = 0;\nvar srCount = 0;\nvar isFirstCitizen = true;\n\n\n// Loop to create list of active citizen ids.\nallElements.forEach(function(element) {\n srCount = element.service_reqs.length;\n\n // If citizen active, add to the list.\n if (element.cs.cs_state_name === \"Active\") {\n //console.log(\"Citizen (\" + elementCount + \") \" + element.citizen_id +\n // \" Active: SRCount = \" + srCount);\n citizenIds.push(element.citizen_id);\n\n // Save the first citizen.\n if (isFirstCitizen) {\n currentCitizen = element;\n isFirstCitizen = false;\n }\n }\n \n // Increment count.\n elementCount++;\n});" + }, + "url": { + "raw": "https://postman-echo.com/post", + "protocol": "https", + "host": [ + "postman-echo", + "com" + ], + "path": [ + "post" + ] + }, + "description": "Sets the authentication script" + }, + "response": [] + } + ], + "description": "This folder performs basic authentication features.", + "protocolProfileBehavior": {} + }, + { + "name": "Check app health", + "item": [ + { + "name": "Check healthz driver TheQ", + "event": [ + { + "listen": "test", + "script": { + "id": "74adc5ce-caa5-452a-bd96-8ac90a4c11d7", + "exec": [ + "// Get the maximum response time allowed.", + "max_load_time = JSON.parse(globals.max_load_time);", + "", + "// Set health response time variable.", + "health_tries = 15;", + "counter = 1;", + "postman.setEnvironmentVariable(\"health_tries\", JSON.stringify(health_tries));", + "postman.setEnvironmentVariable(\"health_counter\", JSON.stringify(counter));", + "", + "// Get the response.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Test the health response.", + "pm.test(\"Health Driver: Try \" + counter.toString() + \": Response should have 'message' property\", function() {", + " pm.expect(jsonData).to.have.property('message');", + "});", + "", + "pm.test(\"Response message should be 'api is healthy'\", function() {", + " pm.expect(jsonData.message).to.be.eql('api is healthy');", + "});", + "", + "// If response time is OK, proceed to the next test.", + "if (pm.response.responseTime < max_load_time) {", + " postman.setNextRequest(\"Check the readyz endpoint TheQ\");", + "}", + " ", + "// Response time is too long. Try again, give pod a chance to spin up.", + "else {", + " postman.setNextRequest(\"Check the healthz endpoint TheQ\");", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}healthz/", + "host": [ + "{{url}}healthz" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Check the healthz endpoint TheQ", + "event": [ + { + "listen": "test", + "script": { + "id": "74adc5ce-caa5-452a-bd96-8ac90a4c11d7", + "exec": [ + "// Get the maximum load time allowed.", + "max_load_time = JSON.parse(postman.getEnvironmentVariable(\"max_load_time\"));", + "", + "// Get and update variables.", + "health_tries = JSON.parse(postman.getEnvironmentVariable(\"health_tries\"));", + "counter = JSON.parse(postman.getEnvironmentVariable(\"health_counter\")) + 1;", + "postman.setEnvironmentVariable(\"health_counter\", JSON.stringify(counter));", + "", + "// Get the response.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Test the health response.", + "pm.test(\"Health Driver: Try \" + counter.toString() + \": Response should have 'message' property\", function() {", + " pm.expect(jsonData).to.have.property('message');", + "});", + "", + "pm.test(\"Response message should be 'api is healthy'\", function() {", + " pm.expect(jsonData.message).to.be.eql('api is healthy');", + "});", + "", + "// If response time is OK, proceed to the next test.", + "if (pm.response.responseTime < max_load_time) {", + " postman.setNextRequest(\"Check the readyz endpoint TheQ\");", + "}", + " ", + "// Response time is too long.", + "else {", + " ", + " // You haven't reached your maximum tries yet. Try again.", + " if (counter < health_tries) {", + " postman.setNextRequest(\"Check the healthz endpoint\");", + " }", + " ", + " // You have reached the maximum. An error, go to next test.", + " else {", + " pm.test(\"Response should be below \" + max_load_time.toString() + ' in ' + health_tries.toString() + ' tries.', function() {", + " pm.expect(counter).to.be.below(health_tries);", + " });", + " postman.setNextRequest(\"Check the readyz endpoint TheQ\");", + " }", + "}", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}healthz/", + "host": [ + "{{url}}healthz" + ], + "path": [ + "" + ] + } + }, + "response": [] + }, + { + "name": "Check the readyz endpoint TheQ", + "event": [ + { + "listen": "test", + "script": { + "id": "661c33c4-4a3d-4396-a549-9969edafbfa6", + "exec": [ + "// Perform the standard tests.", + "eval(environment.basic_response_test);", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "// Test the health response.", + "pm.test(\"Response should have 'message' property\", function() {", + " pm.expect(jsonData).to.have.property('message');", + "});", + "", + "pm.test(\"Response message should be 'api is ready'\", function() {", + " pm.expect(jsonData.message).to.be.eql('api is ready');", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "9e00b481-ef9a-440b-8e83-025fc49026c4", + "exec": [ + "(function () {", + " var requiredVars = [\"url\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}readyz/", + "host": [ + "{{url}}readyz" + ], + "path": [ + "" + ] + } + }, + "response": [] + } + ], + "description": "Checks the application health by calling the healthz and readyz endpoints", + "protocolProfileBehavior": {} + }, + { + "name": "Check user login", + "item": [ + { + "name": "Authenticate default QTxn user", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "(function () {", + " var requiredVars = [\"auth_url\",\"realm\",\"clientid\",\"userid\",\"password\",\"client_secret\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "43df8e47-2b93-48b0-a5ff-bb3396d12537", + "exec": [ + "// Parse response body", + "var jsonData = {};", + "try {", + " jsonData = JSON.parse(responseBody);", + "} catch (parseErr) {", + " console.log(\"Authentication response body was not JSON.\");", + " console.log(responseBody);", + " pm.globals.set(\"auth_failure_reason\", \"Non-JSON auth response\");", + " pm.execution.setNextRequest(null);", + " throw parseErr;", + "}", + "", + "var authFailureReason = jsonData.error_description || jsonData.error || (\"HTTP \" + pm.response.code);", + "if (pm.response.code !== 200 || !jsonData.access_token) {", + " console.log(\"Authentication failed for \" + pm.info.requestName + \".\");", + " console.log(responseBody);", + " pm.globals.set(\"auth_failure_reason\", authFailureReason);", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Authentication failed: \" + authFailureReason);", + "}", + "", + "pm.test(\"Response code for request is 200\", function(){", + " pm.expect(pm.response.code).to.eql(200);", + "});", + "pm.test(\"Access token exists\", function(){", + " pm.expect(jsonData).to.have.property(\"access_token\");", + " pm.expect(jsonData.access_token).to.be.a(\"string\").and.not.empty;", + "});", + "pm.test(\"Refresh token exists\", function(){", + " pm.expect(jsonData).to.have.property(\"refresh_token\");", + " pm.expect(jsonData.refresh_token).to.be.a(\"string\").and.not.empty;", + "});", + "pm.test(\"Expires In is present\", function(){", + " pm.expect(jsonData).to.have.property(\"expires_in\");", + " pm.expect(jsonData.expires_in).to.not.eql(null);", + "});", + "pm.test(\"Refresh Expires In is present\", function(){", + " pm.expect(jsonData).to.have.property(\"refresh_expires_in\");", + " pm.expect(jsonData.refresh_expires_in).to.not.eql(null);", + "});", + "", + "pm.globals.unset(\"auth_failure_reason\");", + "pm.globals.set(\"operator_token\", jsonData.access_token);", + "pm.globals.set(\"operator_refresh_token\", jsonData.refresh_token);", + "pm.globals.set(\"token_expires\", Date.now() + (jsonData.expires_in * 1000));", + "pm.globals.set(\"refresh_token_expires\", Date.now() + (jsonData.refresh_expires_in * 1000));", + "pm.globals.set(\"expires_in\", jsonData.expires_in);", + "pm.globals.set(\"refresh_expires_in\", jsonData.refresh_expires_in);", + "pm.globals.set(\"token\", jsonData.access_token);", + "pm.globals.set(\"refresh_token\", jsonData.refresh_token);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/x-www-form-urlencoded" + } + ], + "body": { + "mode": "raw", + "raw": "grant_type=password&client_id={{clientid}}&username={{userid}}&password={{password}}&client_secret={{client_secret}}" + }, + "url": { + "raw": "{{auth_url}}/auth/realms/{{realm}}/protocol/openid-connect/token?Content-Type=application/x-www-form-urlencoded", + "host": [ + "{{auth_url}}" + ], + "path": [ + "auth", + "realms", + "{{realm}}", + "protocol", + "openid-connect", + "token" + ], + "query": [ + { + "key": "Content-Type", + "value": "application/x-www-form-urlencoded" + } + ] + }, + "description": "Make sure the operator ID can log in" + }, + "response": [] + }, + { + "name": "Who am I TheQ", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "if (jsonData.hasOwnProperty(\"csr\")) {", + "\tcurrentOfficeId = jsonData.csr.office_id;", + "\tcurrentOfficeNumber = jsonData.csr.office.office_number;", + "\tcurrentCsrId = jsonData.csr.csr_id;", + " postman.setEnvironmentVariable(\"current_office_id\", currentOfficeId);", + " postman.setEnvironmentVariable(\"current_office_number\", currentOfficeNumber);", + " postman.setEnvironmentVariable(\"current_csr_id\", currentCsrId);", + "};", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}csrs/me/", + "host": [ + "{{url}}csrs" + ], + "path": [ + "me", + "" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Check channels", + "item": [ + { + "name": "Get channels", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "2b71673c-4aa2-47b3-8594-15f02b390ee0", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "42742c4c-505d-472d-857b-fdba74cc49ac", + "exec": [ + "// Run basic tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "var schema = {", + " \"properties\" : {", + " \"channel_name\" : {", + " \"type\" : \"string\"", + " },", + " \"channel_id\" : {", + " \"type\" : [\"number\", \"object\"]", + " }", + " },", + " \"required\" : [\"channel_name\", \"channel_id\"]", + "};", + "", + "// Loop to validate schema of each channel.", + "var allChannels = jsonData.channels;", + "var channelCount = 0;", + "var phoneId = 0;", + "var emailId = 0;", + "var phoneText = \"Phone\";", + "var emailText = \"Email/Fax/Mail\";", + "allChannels.forEach(function(channel) {", + " channelCount ++;", + " var testTitle = \"Channel (\" + channelCount + \"): ID \" + channel.channel_id + \" Name \" + channel.channel_name + \" conforms to schema\";", + " tests[testTitle] = tv4.validate(channel, schema);", + " if (channel.channel_name === phoneText) {", + " phoneId = channel.channel_id;", + " }", + " if (channel.channel_name === emailText) {", + " emailId = channel.channel_id;", + " }", + "});", + "", + "// Check that you found the phone ID.", + "pm.test(phoneText + ' id was ' + phoneId.toString() + ' (should not equal 0)', function() {", + " pm.expect(phoneId).to.not.be.eql(0);", + "});", + "", + "// Check that you found the email ID.", + "pm.test(emailText + ' id was ' + emailId.toString() + ' (should not equal 0)', function() {", + " pm.expect(emailId).to.not.be.eql(0);", + "});", + "", + "// Store this ID for future use.", + "postman.setEnvironmentVariable(\"channel_telephone_id\", JSON.stringify(phoneId));", + "postman.setEnvironmentVariable(\"channel_email_id\", JSON.stringify(emailId));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + } + ], + "url": { + "raw": "{{url}}channels/", + "host": [ + "{{url}}channels" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Check counters", + "item": [ + { + "name": "Store CSR and Office Info", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c34723d3-c0d1-4504-97a2-373088309a5b", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77f0ca3-62cf-49ba-8e17-67a16e8f8a5f", + "exec": [ + "// Define the JSON Schema expected in response", + "var CSRSSchema = {", + " \"type\": \"object\",", + " \"properties\": {", + " \"csr_id\": {\"type\": \"number\"},", + " \"csr_state\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"csr_state_desc\": {\"type\": \"string\"},", + " \"csr_state_id\": {\"type\": \"number\"},", + " \"csr_state_name\": {\"type\": \"string\"}", + " },", + " \"required\": [\"csr_state_desc\", \"csr_state_id\", \"csr_state_name\"]", + " },", + " \"csr_state_id\": {\"type\": \"number\"},", + " \"deleted\": {},", + " \"finance_designate\": {\"type\": \"number\"},", + " \"office_manager\": {\"type\": \"number\"},", + " \"ita2_designate\": {\"type\": \"number\"},", + " \"office\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"appointments_enabled_ind\": {\"type\": \"number\"},", + " \"exams_enabled_ind\": {\"type\": \"number\"},", + " \"office_id\": {\"type\": \"number\"},", + " \"office_name\": {\"type\": \"string\"},", + " \"office_number\": {\"type\": \"number\"},", + " \"sb\":{", + " \"type\": \"object\",", + " \"properties\": {", + " \"sb_id\": {\"type\": \"number\"},", + " \"sb_type\": {\"type\": \"string\"}", + " },", + " \"required\": [\"sb_id\", \"sb_type\"]", + " }", + " },", + " \"required\": [\"appointments_enabled_ind\", \"exams_enabled_ind\", \"office_id\", \"office_name\", \"office_number\", \"sb\"]", + " },", + " \"office_name\": {\"type\": \"string\"},", + " \"pesticide_designate\": {\"type\": \"number\"},", + " \"qt_xn_csr_ind\": {\"type\": \"number\"},", + " \"receptionist_ind\": {\"type\": \"number\"},", + " \"role\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"role_code\": {\"type\": \"string\"},", + " \"role_desc\": {\"type\": \"string\"},", + " \"role_id\": {\"type\": \"number\"}", + " },", + " \"required\": [\"role_code\", \"role_desc\", \"role_id\"]", + " },", + " \"role_id\": {\"type\": \"number\"},", + " \"username\": {\"type\": \"string\"}", + " },", + " \"attention_needed\": {\"type\": \"boolean\"},", + " \"required\": [\"csr\", \"attention_needed\"]", + "};", + "", + "// Run basic response tests.", + "eval(environment.basic_response_test);", + "", + "// Parse response body", + "var jsonData = JSON.parse(responseBody);", + "", + "//Test to see if response schema is valid", + "pm.test(\"Validate Response CSRs Schema\", function(){", + " pm.expect(tv4.validate(jsonData, CSRSSchema)).to.be.true;", + "});", + "", + "// Make sure that jsonData has an csr property.", + "pm.test(\"Response should have csr property\", function(){", + " pm.expect(jsonData.hasOwnProperty(\"csr\")).to.be.true;", + "});", + "", + "var csr = 0;", + "var office = 0;", + "var counters = 0;", + "var counter_text = \"Counter\";", + "var counter_id = 0;", + "var qtxn_text = \"Quick Trans\";", + "var qtxn_id = 0;", + "", + "if (jsonData.hasOwnProperty(\"csr\")) {", + "\tcurrentOfficeId = jsonData.csr.office_id;", + "\tcurrentOfficeNumber = jsonData.csr.office.office_number;", + " postman.setEnvironmentVariable(\"current_office_id\", currentOfficeId);", + " postman.setEnvironmentVariable(\"current_office_number\", currentOfficeNumber);", + " postman.setEnvironmentVariable(\"current_csr_id\", jsonData.csr.csr_id);", + " ", + " csr = jsonData.csr;", + " counter_id = 0;", + " qtxn_id = 0;", + "", + " // Make sure that jsonData has an booking property.", + " pm.test(\"CSR should have office property\", function(){", + " pm.expect(csr.hasOwnProperty(\"office\")).to.be.true;", + " });", + " ", + " // Make sure office has counter property.", + " if (csr.hasOwnProperty(\"office\")) {", + " office = csr.office;", + " ", + " // Make sure that jsonData has an booking property.", + " pm.test(\"Office should have counters property\", function(){", + " pm.expect(office.hasOwnProperty(\"counters\")).to.be.true;", + " });", + "", + " // Make sure office has counter property.", + " if (office.hasOwnProperty(\"counters\")) {", + " counters = office.counters;", + " ", + " // Search for Counter and Quick Trans counters", + " counters.forEach(function(counter) {", + " if (counter.counter_name === counter_text) {", + " counter_id = counter.counter_id;", + " }", + " if (counter.counter_name === qtxn_text) {", + " qtxn_id = counter.counter_id;", + " }", + " });", + " ", + " // Make sure you found the right IDs.", + " pm.test(\"Counter ID (\" + counter_id.toString() + \") should not be 0\", function(){", + " pm.expect(counter_id).to.not.be.eql(0);", + " });", + " pm.test(\"Quick Transaction ID (\" + qtxn_id.toString() + \") should not be 0\", function(){", + " pm.expect(qtxn_id).to.not.be.eql(0);", + " });", + " ", + " // Store the ids for future use.", + " // postman.setEnvironmentVariable(\"counter_id\", counter_id);", + " // postman.setEnvironmentVariable(\"qtxn_id\", qtxn_id);", + " postman.setEnvironmentVariable(\"counter_id\", JSON.stringify(counter_id.toString()));", + " postman.setEnvironmentVariable(\"qtxn_id\", JSON.stringify(qtxn_id.toString()));", + " }", + "", + " ", + " }", + "", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}csrs/me/", + "host": [ + "{{url}}csrs" + ], + "path": [ + "me", + "" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Check categories", + "item": [ + { + "name": "Get categories", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "e99f23ee-5a03-43d9-9075-75dbf06aadcc", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "1a9c9ff5-8475-4dd2-a6c7-ffb5d4689145", + "exec": [ + "// Run basic tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "var schema = {", + " \"properties\" : {", + " \"display_dashboard_ind\" : {", + " \"type\" : \"number\"", + " },", + " \"deleted\" : {", + " \"type\" : [\"object\", \"null\"]", + " },", + " \"actual_service_ind\" : {", + " \"type\" : \"number\"", + " },", + " \"service_id\" : {", + " \"type\" : [\"number\", \"object\"]", + " },", + " \"service_code\" : {", + " \"type\" : \"string\"", + " },", + " \"prefix\" : {", + " \"type\" : \"string\"", + " },", + " \"service_name\" : {", + " \"type\" : \"string\"", + " },", + " \"parent_id\" : {", + " \"type\" : [\"object\", \"null\" ]", + " },", + " \"service_desc\" : {", + " \"type\" : \"string\"", + " }", + " },", + " \"required\" : [\"display_dashboard_ind\", \"deleted\", \"actual_service_ind\", \"service_id\", \"service_code\",", + " \"prefix\", \"service_name\", \"parent_id\", \"service_desc\"]", + "};", + "", + "// Loop to validate schema of each channel.", + "var allCategories = jsonData.categories;", + "var categoryCount = 0;", + "allCategories.forEach(function(category) {", + " categoryCount ++;", + " var testTitle = \"Category (\" + categoryCount + \"): \" + category.service_name + \" - \";", + " tests[testTitle + \"conforms to schema\"] = tv4.validate(category, schema);", + " var displayInd = category.display_dashboard_ind;", + " var serviceInd = category.actual_service_ind;", + "", + " // Test that returned data is valid.", + " pm.test(\"--> \" + testTitle + \"display_dashboard_ind must be 0 (is \" + displayInd.toString() + \")\", function(){", + " pm.expect(displayInd).to.be.eql(0);", + " });", + "", + " pm.test(\"--> \" + testTitle + \"actual_service_ind must be 0 (is \" + serviceInd.toString() + \")\", function(){", + " pm.expect(serviceInd).to.be.eql(0);", + " });", + " ", + " pm.test(\"--> \" + testTitle + \"parent_id must be null\", function(){", + " pm.expect(category.parent_id).to.be.null;", + " });", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + } + ], + "url": { + "raw": "{{url}}categories/", + "host": [ + "{{url}}categories" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Check services", + "item": [ + { + "name": "Get services", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "d01c3826-dc28-4cce-957b-ec70d0393e7e", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "3b11031e-4031-4569-91f2-49e23517ffee", + "exec": [ + "// Run basic tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "var schema = {", + " \"properties\" : {", + " \"display_dashboard_ind\" : {", + " \"type\" : \"number\"", + " },", + " \"deleted\" : {", + " \"type\" : [\"object\", \"null\"]", + " },", + " \"actual_service_ind\" : {", + " \"type\" : \"number\"", + " },", + " \"service_id\" : {", + " \"type\" : [\"number\", \"object\"]", + " },", + " \"service_code\" : {", + " \"type\" : \"string\"", + " },", + " \"prefix\" : {", + " \"type\" : \"string\"", + " },", + " \"service_name\" : {", + " \"type\" : \"string\"", + " },", + " \"parent_id\" : {", + " \"type\" : [\"object\", \"number\", \"null\" ]", + " },", + " \"service_desc\" : {", + " \"type\" : \"string\"", + " }", + " },", + " \"required\" : [\"display_dashboard_ind\", \"deleted\", \"actual_service_ind\", \"service_id\", \"service_code\",", + " \"prefix\", \"service_name\", \"parent_id\", \"service_desc\"]", + "};", + "", + "// Loop to validate schema of each channel.", + "var allElements = jsonData.services;", + "var elementCount = 0;", + "var elementMax = Math.min(10, allElements.length);", + "//allElements.forEach(function(element) {", + "for (var currentElement = 0; currentElement < elementMax; currentElement++) {", + " element = allElements[currentElement];", + " elementCount ++;", + " var testTitle = \"Service (\" + elementCount + \"): \" + element.service_name + \" - \";", + " tests[testTitle + \"conforms to schema\"] = tv4.validate(element, schema);", + " displayInd = element.display_dashboard_ind;", + " serviceInd = element.actual_service_ind;", + "", + " // Test that returned data is valid.", + " pm.test(\"--> \" + testTitle + \"display_dashboard_ind must be 0 or 1 (is \" + displayInd.toString() + \")\", function(){", + " pm.expect(displayInd).to.be.within(0, 1);", + " });", + "", + " // Test that returned data is valid.", + " pm.test(\"--> \" + testTitle + \"actual_service_ind must be 1 (is \" + serviceInd.toString() + \")\", function(){", + " pm.expect(serviceInd).to.be.eql(1);", + " });", + " ", + " // Test that returned data is valid.", + " pm.test(\"--> \" + testTitle + \"parent_id must not be null\", function(){", + " pm.expect(element.parent_id).to.not.be.null;", + " });", + "}", + "", + "// Declare and initialize variables.", + "var mspId = 0;", + "var taxId = 0;", + "var mspText = \"Payment - MSP\";", + "var propTaxText = \"Other - PTAX\";", + "", + "// Look for the MSP and Property Tax IDs.", + "allElements.forEach(function(element) {", + " if (element.service_name === mspText) {", + " mspId = element.service_id;", + " }", + " if (element.service_name === propTaxText) {", + " taxId = element.service_id;", + " }", + "});", + "", + "// Check that you found the MSP service.", + "pm.test(mspText + ' id was ' + mspId.toString() + ' (should not equal 0)', function() {", + " pm.expect(mspId).to.not.be.eql(0);", + "});", + "", + "// Check that you found the Property Tax service.", + "pm.test(propTaxText + ' id was ' + taxId.toString() + ' (should not equal 0)', function() {", + " pm.expect(taxId).to.not.be.eql(0);", + "});", + "", + "// Store these IDs for future use.", + "postman.setEnvironmentVariable(\"service_MSP_id\", JSON.stringify(mspId));", + "postman.setEnvironmentVariable(\"service_PropTax_id\", JSON.stringify(taxId));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + } + ], + "url": { + "raw": "{{url}}services/", + "host": [ + "{{url}}services" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Check citizen through queue (QT1)", + "item": [ + { + "name": "Create citizen (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "7896261d-7d88-4eba-860b-98472655c4a7", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " pm.test(\"Only one citizen should be in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + " ", + " // Store the ID of the citizen just created.", + " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{}" + }, + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Edit specific citizen (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "b72e7756-5de1-4a13-9609-8917ea63dee7", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\",\"citizen_name\",\"citizen_comment\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "73110fdd-6476-403d-b6c9-c108032fbd66", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + "", + " // Perform tests.", + " pm.test(\"Must be one active citizen in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}}\n}" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Add property tax via phone service request (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"service_PropTax_id\",\"current_client\",\"citizen_quantity\",\"channel_telephone_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "fa6f6a3b-e4e7-42b6-a8d3-ecda3840418a", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" + }, + "url": { + "raw": "{{url}}service_requests/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "List specific citizen (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "66ca9683-be00-478b-92c0-6ac698d9088b", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request must have one period', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", + " });", + " pm.test('Service request period channel must be ' + citizenChannel, function() {", + " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", + " });", + " pm.test('Service request period state must be \"Ticket Creation\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/{{current_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Add citizen to queue (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "8a294876-edfa-4d5b-ada4-399f5339cd8f", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Pending\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (now two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Waiting\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/add_to_queue/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "add_to_queue", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Invite specific citizen (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "8e9cd1ef-a5d9-4f81-b061-f818d4fc5603", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 3 (now three periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(3);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Invited\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Invited\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/invite/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "invite", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Begin serving citizen (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "1b1f7f66-04cd-4f10-bfa2-c4f3fffe8715", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 4 (now four periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(4);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Being Served\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/begin_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "begin_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Finish serving citizen (QT1)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "818713b9-18a0-4fef-9c16-f71b43dd2ad0", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be no active citizens in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Complete\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 4 (still four periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(4);", + " });", + " pm.test('There must be no open periods', function() {", + " pm.expect(openPeriodCount).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/finish_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "finish_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Check citizen begin-hold-finish (QT2)", + "item": [ + { + "name": "Create citizen (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e77d15de-91e2-4528-87bd-5734405b4def", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Perform tests.", + " pm.test(\"Only one citizen should be in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + " ", + " // Store the ID of the citizen just created.", + " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", + "} ", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{}" + }, + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Edit specific citizen (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "ce732be5-38a3-4825-90d1-4d52babf8917", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\",\"citizen_name\",\"citizen_comment\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// // Get data, create JSON body.", + "// var citizenName = postman.getEnvironmentVariable(\"citizen_name\");", + "// var citizenComments = postman.getEnvironmentVariable(\"citizen_comment\");", + "// var bodyData = {", + "// \"citizen_name\" : citizenName,", + "// \"citizen_comments\" : citizenComments", + "// }", + "// // Store the data in an environment variable.", + "// postman.setEnvironmentVariable(\"putBody\", JSON.stringify(bodyData));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "13828662-748d-4b3f-9ead-454e795f1f01", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + "", + " // Perform tests.", + " pm.test(\"Must be one active citizen in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}}\n}" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Add property tax via phone service request (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"service_PropTax_id\",\"current_client\",\"citizen_quantity\",\"channel_telephone_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "fa6f6a3b-e4e7-42b6-a8d3-ecda3840418a", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" + }, + "url": { + "raw": "{{url}}service_requests/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "List specific citizen (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "2a57d1b2-9d0c-4e07-ad20-d4dde457f9d1", + "exec": [ + "// Install postmanBDD, json-bigint parse and stringify.", + "eval(globals.postmanBDD);", + "eval(globals.json_bigint_parse);", + "", + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request must have one period', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", + " });", + " pm.test('Service request period channel must be ' + citizenChannel, function() {", + " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", + " });", + " pm.test('Service request period state must be \"Ticket Creation\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/{{current_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Begin serving citizen (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "4550a6b7-560d-48bf-bfc9-41453a8defec", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (now two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Being Served\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/begin_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "begin_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Place citizen on hold (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "dd51a48d-2e1e-47fd-978f-507b77a7901f", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 3 (now three periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(3);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"On hold\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"On hold\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/place_on_hold/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "place_on_hold", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Get service requests (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "f4809d17-b59d-47fc-861e-5edaf421bddc", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.service_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + "var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + "var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get periods for the first service request.", + " var allPeriods = allElements[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " var allPeriodCount = 0;", + "", + " // Find how many periods there are with null end time.", + " // Also, check schema.", + " allPeriods.forEach(function(onePeriod) {", + " ", + " // Find the open period.", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " ", + " });", + "} ", + "", + "// If there are some service requests, proceed with tests.", + "if (allElements !== null) {", + "", + " // Perform tests.", + " pm.test('There must be only one service request', function() {", + " pm.expect(allElements.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(allElements[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(allElements[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(allElements[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request must have three periods', function() {", + " pm.expect(allPeriods.length).to.be.eql(3);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('Service request period state must be \"On hold\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"On hold\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/{{current_client}}/service_requests/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "service_requests", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Call citizen from hold (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "66563797-2a92-4dbd-946e-7232dcac8260", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 4 (now four periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(4);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Being Served\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/begin_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "begin_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Finish serving citizen (QT2)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "ec865f9c-a4b6-421f-956e-783972df2ad3", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + " ", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = allElements[0].service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be no active citizens in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Complete\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 4 (still four periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(4);", + " });", + " pm.test('There must be no open periods', function() {", + " pm.expect(openPeriodCount).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/finish_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "finish_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Check citizen leave after create (QT3)", + "item": [ + { + "name": "Create citizen (QT3)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "061a479c-37b4-4707-b8c6-c31cacadecec", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Perform tests.", + " pm.test(\"Only one citizen should be in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "", + " // Store the ID of the citizen just created.", + " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{}" + }, + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Citizen left (QT3)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "16eaefc2-0d16-405e-9e70-e85314da841b", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get environment variables.", + " var citizenName = postman.getEnvironmentVariable(\"citizen_name\");", + " var citizenComment = postman.getEnvironmentVariable(\"citizen_comment\");", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = null;", + " if (currentCitizen.service_reqs.length !== 0) {", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " }", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " if (allPeriods !== null) {", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + " }", + "", + " // Perform tests.", + " pm.test(\"Must be no active citizens in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/citizen_left/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "citizen_left", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Check citizen leave after waiting (QT4)", + "item": [ + { + "name": "Create citizen (QT4)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "fcc1415c-0861-4516-8843-bfc3717a76d9", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Perform tests.", + " pm.test(\"Only one citizen should be in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "", + " // Store the ID of the citizen just created.", + " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{}" + }, + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Edit specific citizen (QT4)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "f26eaedb-5d41-4dcc-b856-aec599440601", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\",\"citizen_name\",\"citizen_comment\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// // Get data, create JSON body.", + "// var citizenName = postman.getEnvironmentVariable(\"citizen_name\");", + "// var citizenComments = postman.getEnvironmentVariable(\"citizen_comment\");", + "// var bodyData = {", + "// \"citizen_name\" : citizenName,", + "// \"citizen_comments\" : citizenComments", + "// }", + "// // Store the data in an environment variable.", + "// postman.setEnvironmentVariable(\"putBody\", JSON.stringify(bodyData));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "e0b48324-0ca2-4b2e-88ef-cbfbe10b5fb7", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + "", + " // Perform tests.", + " pm.test(\"Must be one active citizen in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}}\n}" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Add property tax via phone service request (QT4)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"service_PropTax_id\",\"current_client\",\"citizen_quantity\",\"channel_telephone_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "fa6f6a3b-e4e7-42b6-a8d3-ecda3840418a", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" + }, + "url": { + "raw": "{{url}}service_requests/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "List specific citizen (QT4)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "1176fcca-52ff-4e13-b4a4-775ad324a4c6", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request must have one period', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", + " });", + " pm.test('Service request period channel must be ' + citizenChannel, function() {", + " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", + " });", + " pm.test('Service request period state must be \"Ticket Creation\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/{{current_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Add citizen to queue (QT4)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "f0aacc69-ff0e-4ed3-9ef7-f131bbf3a5bd", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Pending\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Pending\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (now two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Waiting\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Waiting\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/add_to_queue/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "add_to_queue", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Citizen left (QT4)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "4ee90115-54c2-4b44-b6f1-d739e8a385b1", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test(\"Must be no active citizens in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test(\"Citizen should have one service request\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Complete\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (now two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must be no open periods', function() {", + " pm.expect(openPeriodCount).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/citizen_left/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "citizen_left", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "Check update service information (QT5)", + "item": [ + { + "name": "Create citizen (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "d3bbd88a-25fd-4fe6-ae7e-359373df02ac", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + "", + " // Perform tests.", + " pm.test(\"Only one citizen should be in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test(\"Current citizen name should be null\", function() {", + " pm.expect(currentCitizen.citizen_name).to.be.null;", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "", + " // Store the ID of the citizen just created.", + " postman.setEnvironmentVariable(\"current_client\", JSON.stringify(citizenIds.shift()));", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{}" + }, + "url": { + "raw": "{{url}}citizens/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Edit specific citizen (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "2be395b2-e14c-4ff8-8753-42ea1fe2010d", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\",\"citizen_name\",\"citizen_comment\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in.", + "// // Get data, create JSON body.", + "// var citizenName = postman.getEnvironmentVariable(\"citizen_name\");", + "// var citizenComments = postman.getEnvironmentVariable(\"citizen_comment\");", + "// var bodyData = {", + "// \"citizen_name\" : citizenName,", + "// \"citizen_comments\" : citizenComments", + "// };", + "// // Store the data in an environment variable.", + "// postman.setEnvironmentVariable(\"putBody\", JSON.stringify(bodyData));" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "2e7878d3-653e-479e-850f-c454b378217e", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + " ", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + "", + " // Perform tests.", + " pm.test(\"Must be one active citizen in the office\", function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test(\"Citizen should have no service requests\", function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"citizen_name\" : {{citizen_name}},\n \"citizen_comments\" : {{citizen_comment}}\n}" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Add property tax via phone service request (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"operator_token\",\"service_PropTax_id\",\"current_client\",\"citizen_quantity\",\"channel_telephone_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "fa6f6a3b-e4e7-42b6-a8d3-ecda3840418a", + "exec": [ + "// Run complex tests.", + "eval(environment.create_response_test);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_request\" : {\n\t\t\"service_id\" : {{service_PropTax_id}},\n\t\t\"citizen_id\" : {{current_client}},\n\t\t\"quantity\" : {{citizen_quantity}},\n\t\t\"channel_id\" : {{channel_telephone_id}}\n\t}\n}" + }, + "url": { + "raw": "{{url}}service_requests/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "List specific citizen (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "3d906a10-51fe-4329-bac0-e69e6847e852", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + " ", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request must have one period', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods.length).to.be.eql(1);", + " });", + " pm.test('Service request period channel must be ' + citizenChannel, function() {", + " pm.expect(currentCitizen.service_reqs[0].channel_id).to.be.eql(citizenChannel);", + " });", + " pm.test('Service request period state must be \"Ticket Creation\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].periods[0].ps.ps_name).to.be.eql(\"Ticket Creation\");", + " });", + "", + " // Save the service request ID for later.", + " var mySRId = allElements[0].service_reqs[0].sr_id;", + " postman.setEnvironmentVariable(\"current_sr_id\", JSON.stringify(mySRId));", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "url": { + "raw": "{{url}}citizens/{{current_client}}/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Begin serving citizen (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "ff3a25ca-0df2-40f2-b7a1-9e9b4bde2aab", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = null;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Run citizen tests.", + " eval(environment.get_active_citizens_test);", + " ", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_PropTax_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be one active citizen in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(1);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('Citizen comment must equal \"' + citizenComment + '\"', function() {", + " pm.expect(currentCitizen.citizen_comments).to.be.eql(citizenComment);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Active\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Active\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (now two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must only be one open period', function() {", + " pm.expect(openPeriodCount).to.be.eql(1);", + " });", + " pm.test('The open period state must be \"Being Served\"', function() {", + " pm.expect(openPeriod.ps.ps_name).to.be.eql(\"Being Served\");", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/begin_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "begin_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Update quantity from 3 to 5 (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_sr_id\",\"operator_token\",\"citizen_quantity_update\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "153a139d-0daa-4031-ba0a-e7204ade2648", + "exec": [ + "// Run complex tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.service_response_test);", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Only check for an updated quantity. Get environment variables.", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", + "", + " // Perform tests.", + " pm.test('Updated service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(allElements[0].quantity).to.be.eql(citizenQuantity);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"quantity\" : {{citizen_quantity_update}}\n}" + }, + "url": { + "raw": "{{url}}service_requests/{{current_sr_id}}/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "{{current_sr_id}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Update service from PropTax to MSP (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_sr_id\",\"operator_token\",\"service_MSP_id\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "8faaa693-a7a4-45ed-9318-325a498a98af", + "exec": [ + "// Run complex tests.", + "eval(environment.basic_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.service_response_test);", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Only check for an updated quantity. Get environment variables.", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", + "", + " // Perform tests.", + " pm.test('Updated service request service must be ' + citizenService, function() {", + " pm.expect(allElements[0].service_id).to.be.eql(citizenService);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"service_id\" : {{service_MSP_id}}\n}" + }, + "url": { + "raw": "{{url}}service_requests/{{current_sr_id}}/", + "host": [ + "{{url}}service_requests" + ], + "path": [ + "{{current_sr_id}}", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + }, + { + "name": "Finish serving citizen (QT5)", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "becda71c-71d6-4d2f-bad5-1a7a17da6128", + "exec": [ + "(function () {", + " var requiredVars = [\"url\",\"current_client\",\"operator_token\"];", + " var missingVars = requiredVars.filter(function (name) {", + " var value = pm.variables.get(name);", + " return value === undefined || value === null || value === \"\";", + " });", + " if (missingVars.length) {", + " console.log(\"Missing prerequisite variables for \" + pm.info.requestName + \": \" + missingVars.join(\", \"));", + " pm.execution.setNextRequest(null);", + " throw new Error(\"Missing prerequisite variables: \" + missingVars.join(\", \"));", + " }", + "})();", + "// Ensure the client is logged in." + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "id": "7a831dcf-ff2c-4907-95c5-bf042cdd967a", + "exec": [ + "// Run complex tests.", + "eval(environment.complex_response_test);", + "", + "// Get json return data.", + "var jsonData = JSON.parse(responseBody);", + "", + "// Run citizen tests.", + "eval(environment.citizen_response_test);", + "", + "// Declare, initialize variables.", + "var citizenIds = [];", + "var currentCitizen = jsonData.citizen;", + "", + "// If there are some citizens, proceed with tests.", + "if (allElements !== null) {", + "", + " // Get environment variables.", + " var citizenName = JSON.parse(postman.getEnvironmentVariable(\"citizen_name\"));", + " var citizenComment = JSON.parse(postman.getEnvironmentVariable(\"citizen_comment\"));", + " var citizenService = JSON.parse(postman.getEnvironmentVariable(\"service_MSP_id\"));", + " var citizenQuantity = JSON.parse(postman.getEnvironmentVariable(\"citizen_quantity_update\"));", + " var citizenChannel = JSON.parse(postman.getEnvironmentVariable(\"channel_telephone_id\"));", + " var currentCitizenId = JSON.parse(postman.getEnvironmentVariable(\"current_client\"));", + " var allPeriods = currentCitizen.service_reqs[0].periods;", + " var openPeriod = null;", + " var openPeriodCount = 0;", + " ", + " // Find how many periods there are with null end time.", + " allPeriods.forEach(function(onePeriod) {", + " if (!onePeriod.time_end) {", + " openPeriod = onePeriod;", + " openPeriodCount++;", + " }", + " });", + "", + " // Perform tests.", + " pm.test('Must be no active citizens in the office', function() {", + " pm.expect(citizenIds.length).to.be.eql(0);", + " });", + " pm.test('Citizen Id must equal \"' + currentCitizenId + '\"', function() {", + " pm.expect(currentCitizen.citizen_id).to.be.eql(currentCitizenId);", + " });", + " pm.test('Citizen name must equal \"' + citizenName + '\"', function() {", + " pm.expect(currentCitizen.citizen_name).to.be.eql(citizenName);", + " });", + " pm.test('There must be only one service request', function() {", + " pm.expect(currentCitizen.service_reqs.length).to.be.eql(1);", + " });", + " pm.test('Service request state must be \"Complete\"', function() {", + " pm.expect(currentCitizen.service_reqs[0].sr_state.sr_code).to.be.eql(\"Complete\");", + " });", + " pm.test('Service request service must be ' + citizenService, function() {", + " pm.expect(currentCitizen.service_reqs[0].service_id).to.be.eql(citizenService);", + " });", + " pm.test('Service request quantity must be ' + citizenQuantity, function() {", + " pm.expect(currentCitizen.service_reqs[0].quantity).to.be.eql(citizenQuantity);", + " });", + " pm.test('Service request periods length must be 2 (should be two periods)', function() {", + " pm.expect(allPeriods.length).to.be.eql(2);", + " });", + " pm.test('There must be no open periods', function() {", + " pm.expect(openPeriodCount).to.be.eql(0);", + " });", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{operator_token}}" + }, + { + "key": "Accept", + "value": "application/json, text/plain, */*" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}citizens/{{current_client}}/finish_service/", + "host": [ + "{{url}}citizens" + ], + "path": [ + "{{current_client}}", + "finish_service", + "" + ] + }, + "description": "Get a list of clients in the queue" + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + } + ], + "protocolProfileBehavior": {} +} diff --git a/api/postman/README-local-auth.md b/api/postman/README-local-auth.md new file mode 100644 index 000000000..11c27f1dc --- /dev/null +++ b/api/postman/README-local-auth.md @@ -0,0 +1,55 @@ +# Local Newman Auth Notes + +Use the current local Keycloak realm and client when running the Postman collections with Newman: + +- Realm: `servicebc-local` +- Client ID: `theq-queue-management-api` +- Client secret: `theq-local-dev-secret` +- Auth base URL: `http://localhost:8085/auth` +- API base URL: `http://localhost:5000/api/v1/` + +The checked-in local realm now gives the Newman client both local service audiences: + +- `theq-queue-management-api` +- `theq-notifications-api` + +That matters because appointment creation forwards the caller bearer token to `notifications-api` for email/SMS side effects. Without the notifications audience on the Newman token, the booking request can still pass while the local API logs a downstream `401` from `http://localhost:5002`. + +Before running the collections, seed the local API database so the expected CSR records exist: + +```bash +cd /Users/csampson/Developer/Repositories/queue-management/api +uv run python manage.py db upgrade +uv run python manage.py bootstrap +``` + +The legacy `account` client and `registry` realm values in older examples are not valid for the checked-in local stack. + +The Postman users in `keycloak-local/servicebc-local-realm.json` need claims that match the current API token parsing: + +- Internal users need `theq_username` and `identity_provider=idir` +- Public users need `theq_username`, `identity_provider=bceid`, and `display_name` +- The public user also needs non-empty `email` and `lastName` so `/users/` schema checks pass + +If you already imported the local realm before pulling this change, re-import `keycloak-local/servicebc-local-realm.json` or add the `audience-theq-notifications-api` protocol mapper to client `theq-queue-management-api` manually. The Newman command does not change. + +The checked-in collections now authenticate explicitly during setup and fail fast if auth or a prerequisite variable is missing. For local and CI runs, prefer `--bail failure` so one auth/setup issue does not cascade into misleading `404`, `422`, or schema failures. + +Example Newman command: + +```bash +cd /Users/csampson/Developer/Repositories/queue-management/api/postman +./node_modules/newman/bin/newman.js run API_Test_TheQ_Booking.json -e postman_env.json --bail failure \ + --global-var userid=cfms-postman-operator \ + --global-var password=password \ + --global-var userid_nonqtxn=cfms-postman-non-operator \ + --global-var password_nonqtxn=password \ + --global-var client_secret=theq-local-dev-secret \ + --global-var url=http://localhost:5000/api/v1/ \ + --global-var auth_url=http://localhost:8085 \ + --global-var clientid=theq-queue-management-api \ + --global-var realm=servicebc-local \ + --global-var public_url=http://localhost:5000/api/v1/ \ + --global-var public_user_id=cfms-postman-public-user \ + --global-var public_user_password=password +``` diff --git a/api/postman/package.json b/api/postman/package.json new file mode 100644 index 000000000..49276a76f --- /dev/null +++ b/api/postman/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "newman": "^6.2.2" + } +} diff --git a/api/pyproject.toml b/api/pyproject.toml new file mode 100644 index 000000000..d50c5c66b --- /dev/null +++ b/api/pyproject.toml @@ -0,0 +1,60 @@ +[build-system] +requires = ["setuptools>=69", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "queue_api" +version = "0.0.0" +description = "Queue management API" +requires-python = ">=3.14.0, <3.15" +dependencies = [ + "alembic>=1.18,<1.19", + "amqp>=5.3,<5.4", + "click>=8.3,<8.4", + "filelock>=3.25,<3.26", + "Flask>=3.1,<3.2", + "Flask-Admin>=2.0,<2.1", + "Flask-Caching>=2.3,<2.4", + "Flask-Compress>=1.23,<1.24", + "Flask-Cors>=6.0,<6.1", + "flask-jwt-oidc>=0.9,<0.10", + "Flask-Login>=0.6,<0.7", + "flask-marshmallow>=1.4,<1.5", + "Flask-Migrate>=4.1,<4.2", + "flask-restx>=1.3,<1.4", + "Flask-SocketIO>=5.6,<5.7", + "Flask-SQLAlchemy>=3.1,<3.2", + "gevent>=25.9,<25.10", + "gunicorn>=25.2,<25.3", + "Jinja2>=3.1,<3.2", + "kombu>=5.6,<5.7", + "MarkupSafe>=3.0,<3.1", + "marshmallow>=4.2,<4.3", + "marshmallow-sqlalchemy>=1.4,<1.5", + "minio>=7.2,<7.3", + "psycopg2-binary>=2.9,<2.10", + "python-dateutil>=2.9,<2.10", + "python-dotenv>=1.2,<1.3", + "python-jose[cryptography]>=3.5,<3.6", + "redis>=7.4,<7.5", + "requests>=2.33,<2.34", + "snowplow-tracker>=1.1,<1.2", + "SQLAlchemy>=2.0,<2.1", + "WTForms>=3.2,<3.3", +] + +[dependency-groups] +dev = [ + "isort>=8.0,<8.1", + "pylint>=4.0,<4.1", + "pytest>=9.0,<9.1", + "pytest-cov>=7.1,<7.2", + "ruff>=0.15.8", +] + +[tool.setuptools] +include-package-data = true +py-modules = ["config", "manage", "qsystem", "sqlalchemy_utc", "version", "wsgi"] + +[tool.setuptools.packages.find] +include = ["app*"] diff --git a/api/qsystem.py b/api/qsystem.py index a3cb4a72a..d7f7c3af6 100644 --- a/api/qsystem.py +++ b/api/qsystem.py @@ -4,10 +4,12 @@ import traceback import os import datetime +from urllib.error import URLError from config import configure_app, configure_logging, debug_level_to_debug_string from flask import Flask from flask_admin import Admin +from flask_admin.theme import Bootstrap4Theme from flask_caching import Cache from flask_compress import Compress from flask_cors import CORS @@ -17,13 +19,14 @@ from flask_sqlalchemy import SQLAlchemy from flask_socketio import SocketIO from functools import wraps +from marshmallow import ValidationError from sqlalchemy.exc import SQLAlchemyError from app.exceptions import AuthError -from flask_jwt_oidc.exceptions import AuthError as JwtAuthError +from app.utilities.flask_admin_compat import apply_wtforms_compat +from flask_jwt_oidc import AuthError as JwtAuthError from jose.exceptions import JOSEError from sqlalchemy import event from sqlalchemy.engine import Engine -from sqlalchemy_continuum import make_versioned from flask_migrate import Migrate @@ -47,10 +50,16 @@ def time_string(): ms = now.strftime("%f")[:3] now_string = now.strftime("%Y-%m-%d %H:%M:%S,") return "[" + now_string + ms + "] " + + migrate = Migrate() +db = SQLAlchemy() +cache = Cache() +ma = Marshmallow() application = Flask(__name__, instance_relative_config=True) +apply_wtforms_compat() # Make sure we 404 when the trailing slash is not present on ALL routes application.url_map.strict_slashes = True @@ -64,7 +73,6 @@ def time_string(): appt_limit = application.config['APPOINTMENT_LIMIT_DAYS'] # Set up SQL Alchemy, caching, marshmallow -db = SQLAlchemy(application) db.init_app(application) query_limit = application.config['DB_LONG_RUNNING_QUERY'] ping_timeout_seconds = application.config['SOCKETIO_PING_TIMEOUT'] @@ -73,54 +81,31 @@ def time_string(): logging.info(" --> ping_timeout_seconds: " + str(ping_timeout_seconds)) logging.info(" --> ping_interval_seconds: " + str(ping_interval_seconds)) -cache = Cache(config={'CACHE_TYPE': 'simple', 'CACHE_DEFAULT_TIMEOUT': application.config['CACHE_DEFAULT_TIMEOUT']}) +cache = Cache(config={'CACHE_TYPE': 'SimpleCache', 'CACHE_DEFAULT_TIMEOUT': application.config['CACHE_DEFAULT_TIMEOUT']}) cache.init_app(application) -ma = Marshmallow(application) +ma.init_app(application) migrate.init_app(application, db) -make_versioned(user_cls=None, plugins=[]) - # Set up socket io and rabbit mq. socketio = SocketIO(logger=socket_flag, engineio_logger=engine_flag,ping_timeout=ping_timeout_seconds,ping_interval=ping_interval_seconds, cors_allowed_origins=application.config['CORS_ALLOWED_ORIGINS']) if application.config['ACTIVE_MQ_URL'] is not None: - socketio.init_app(application, async_mode='eventlet', + socketio.init_app(application, async_mode='gevent', message_queue=application.config['ACTIVE_MQ_URL'], redis_options={'REDIS_OPTIONS'}, path='/api/v1/socket.io') else: - socketio.init_app(application, path='/api/v1/socket.io') + socketio.init_app(application, async_mode='gevent',path='/api/v1/socket.io') if application.config['CORS_ALLOWED_ORIGINS'] is not None: CORS(application, supports_credentials=True, origins=application.config['CORS_ALLOWED_ORIGINS']) api = Api(application, prefix='/api/v1', doc='/api/v1/') - -# Set up Flask Admin. -from app import admin -flask_admin = Admin(application, name='Admin Console', template_mode='bootstrap3', index_view=admin.HomeView()) -flask_admin.add_view(admin.ChannelModelView) -flask_admin.add_view(admin.CounterModelView) -flask_admin.add_view(admin.CSRModelView) -flask_admin.add_view(admin.CSRGAModelView) -flask_admin.add_view(admin.InvigilatorModelView) -flask_admin.add_view(admin.OfficeModelView) -flask_admin.add_view(admin.OfficeGAModelView) -flask_admin.add_view(admin.RoleModelView) -flask_admin.add_view(admin.ServiceModelView) -flask_admin.add_view(admin.SmartBoardModelView) -flask_admin.add_view(admin.RoomModelView) -flask_admin.add_view(admin.ExamTypeModelView) -flask_admin.add_view(admin.TimeslotModelView) -flask_admin.add_link(admin.LoginMenuLink(name='Login', category='', url="/api/v1/login/")) -flask_admin.add_link(admin.LogoutMenuLink(name='Logout', category='', url="/api/v1/logout/")) - login_manager = LoginManager() login_manager.init_app(application) -import app.auth compress = Compress() compress.init_app(application) @@ -141,32 +126,24 @@ def time_string(): # mail.init_app(application) # application.extensions['mail'].debug = 0 +def log_startup_state(): + if not print_flag: + return + + logging.info("==> DB Engine options") + logging.info(" --> db options: " + str(db.engine)) + logging.info(" --> pool size: " + str(db.engine.pool.size())) + logging.info(" --> max overflow: " + str(db.engine.pool._max_overflow)) + logging.info(" --> echo: " + str(db.engine.echo)) + logging.info(" --> pre ping: " + str(db.engine.pool._pre_ping)) + logging.info(" --> Database URI: " + application.config['SQLALCHEMY_DATABASE_URI_DISPLAY']) + logging.info("") + + logging.info("==> Socket/Engine options") + logging.info(" --> socket: " + os.getenv('LOG_SOCKETIO', '') + '; flag: ' + str(socket_flag)) + logging.info(" --> engine: " + os.getenv('LOG_ENGINEIO', '') + '; flag: ' + str(engine_flag)) + logging.info("") -# Code to determine all db.engine properties and sub-properties, as necessary. -if print_flag: - logging.info("==> All DB Engine options") - for attr in dir(db._engine_options.keys): - logging.info(" --> db._engine_options.keys." + attr + " = " + str(getattr(db._engine_options.keys, attr))) - # print("db.engine.%s = %s") % (attr, getattr(db.engine, attr)) - -# See whether options took. -if print_flag: - logging.info("==> DB Engine options") - logging.info(" --> db options: " + str(db.engine)) - logging.info(" --> pool size: " + str(db.engine.pool.size())) - logging.info(" --> max overflow: " + str(db.engine.pool._max_overflow)) - logging.info(" --> echo: " + str(db.engine.echo)) - logging.info(" --> pre ping: " + str(db.engine.pool._pre_ping)) - logging.info(" --> Database URI: " + application.config['SQLALCHEMY_DATABASE_URI_DISPLAY']) - logging.info("") - - logging.info("==> Socket/Engine options") - logging.info(" --> socket: " + os.getenv('LOG_SOCKETIO', '') + '; flag: ' + str(socket_flag)) - logging.info(" --> engine: " + os.getenv('LOG_ENGINEIO', '') + '; flag: ' + str(engine_flag)) - logging.info("") - -# Get list of available loggers. -if print_flag: logging.info("==> List of available loggers and associated information:") for name in logging.root.manager.loggerDict: temp_logger = logging.getLogger(name) @@ -270,76 +247,105 @@ def get_key(): char_ms = str(time_now.microsecond)[:2] return char_year + char_month + char_day + char_hour + char_minute + char_ms -import app.resources.theq.categories -import app.resources.theq.upload -import app.resources.theq.channels -import app.resources.theq.citizen.citizen_add_to_queue -import app.resources.theq.citizen.citizen_remove_from_queue -import app.resources.theq.citizen.citizen_begin_service -import app.resources.theq.citizen.citizen_detail -import app.resources.theq.citizen.citizen_finish_service -import app.resources.theq.citizen.citizen_generic_invite -import app.resources.theq.citizen.citizen_left -import app.resources.theq.citizen.citizen_list -import app.resources.theq.citizen.citizen_place_on_hold -import app.resources.theq.citizen.citizen_service_requests -import app.resources.theq.citizen.citizen_specific_invite -import app.resources.theq.csrs -import app.resources.theq.csr_states -import app.resources.theq.csr_detail -import app.resources.theq.feedback -import app.resources.theq.health -import app.resources.theq.login -import app.resources.theq.offices -import app.resources.theq.services -import app.resources.theq.service_requests_list -import app.resources.theq.service_requests_detail -import app.resources.theq.smartboard -import app.resources.theq.videofiles -import app.resources.theq.websocket -import app.resources.theq.user.user -import app.resources.theq.user.user_appointments - -import app.resources.bookings.appointment.all_recurring_stat_delete -import app.resources.bookings.appointment.appointment_availability -import app.resources.bookings.appointment.appointment_detail -import app.resources.bookings.appointment.appointment_list -import app.resources.bookings.appointment.appointment_post -import app.resources.bookings.appointment.appointment_draft_post -import app.resources.bookings.appointment.appointment_draft_delete -import app.resources.bookings.appointment.appointment_draft_flush -import app.resources.bookings.appointment.appointment_put -import app.resources.bookings.appointment.appointment_delete -import app.resources.bookings.appointment.appointment_recurring_delete -import app.resources.bookings.appointment.appointment_recurring_put -import app.resources.bookings.booking.booking_delete -import app.resources.bookings.booking.booking_detail -import app.resources.bookings.booking.booking_list -import app.resources.bookings.booking.booking_post -import app.resources.bookings.booking.booking_put -import app.resources.bookings.booking.booking_recurring_delete -import app.resources.bookings.booking.booking_recurring_put -import app.resources.bookings.booking.booking_recurring_stat_delete -import app.resources.bookings.exam.exam_bcmp -import app.resources.bookings.exam.exam_bulk_status -import app.resources.bookings.exam.exam_delete -import app.resources.bookings.exam.exam_detail -import app.resources.bookings.exam.exam_email_invigilator -import app.resources.bookings.exam.exam_list -import app.resources.bookings.exam.exam_post -import app.resources.bookings.exam.exam_put -import app.resources.bookings.exam.exam_export_list -import app.resources.bookings.exam.exam_event_id_detail -import app.resources.bookings.exam.exam_download -import app.resources.bookings.exam.exam_transfer -import app.resources.bookings.exam.exam_upload -import app.resources.bookings.invigilator.invigilator_list -import app.resources.bookings.invigilator.invigilator_list_offsite -import app.resources.bookings.invigilator.invigilator_put -import app.resources.bookings.room.room_list -import app.resources.bookings.exam_type.exam_type_list -import app.resources.bookings.appointment.appointment_reminder_get -import app.resources.bookings.walkin.walkin +with application.app_context(): + log_startup_state() + + from app import admin + + flask_admin = Admin( + application, + name='Admin Console', + theme=Bootstrap4Theme(), + index_view=admin.HomeView(), + ) + flask_admin.add_view(admin.ChannelModelView) + flask_admin.add_view(admin.CounterModelView) + flask_admin.add_view(admin.CSRModelView) + flask_admin.add_view(admin.CSRGAModelView) + flask_admin.add_view(admin.InvigilatorModelView) + flask_admin.add_view(admin.OfficeModelView) + flask_admin.add_view(admin.OfficeGAModelView) + flask_admin.add_view(admin.RoleModelView) + flask_admin.add_view(admin.ServiceModelView) + flask_admin.add_view(admin.SmartBoardModelView) + flask_admin.add_view(admin.RoomModelView) + flask_admin.add_view(admin.ExamTypeModelView) + flask_admin.add_view(admin.TimeslotModelView) + flask_admin.add_link(admin.LoginMenuLink(name='Login', category='', url="/api/v1/login/")) + flask_admin.add_link(admin.LogoutMenuLink(name='Logout', category='', url="/api/v1/logout/")) + + import app.auth + + import app.resources.theq.categories + import app.resources.theq.upload + import app.resources.theq.channels + import app.resources.theq.citizen.citizen_add_to_queue + import app.resources.theq.citizen.citizen_remove_from_queue + import app.resources.theq.citizen.citizen_begin_service + import app.resources.theq.citizen.citizen_detail + import app.resources.theq.citizen.citizen_finish_service + import app.resources.theq.citizen.citizen_generic_invite + import app.resources.theq.citizen.citizen_left + import app.resources.theq.citizen.citizen_list + import app.resources.theq.citizen.citizen_place_on_hold + import app.resources.theq.citizen.citizen_service_requests + import app.resources.theq.citizen.citizen_specific_invite + import app.resources.theq.csrs + import app.resources.theq.csr_states + import app.resources.theq.csr_detail + import app.resources.theq.feedback + import app.resources.theq.health + import app.resources.theq.login + import app.resources.theq.offices + import app.resources.theq.services + import app.resources.theq.service_requests_list + import app.resources.theq.service_requests_detail + import app.resources.theq.smartboard + import app.resources.theq.videofiles + import app.resources.theq.websocket + import app.resources.theq.user.user + import app.resources.theq.user.user_appointments + + import app.resources.bookings.appointment.all_recurring_stat_delete + import app.resources.bookings.appointment.appointment_availability + import app.resources.bookings.appointment.appointment_detail + import app.resources.bookings.appointment.appointment_list + import app.resources.bookings.appointment.appointment_post + import app.resources.bookings.appointment.appointment_draft_post + import app.resources.bookings.appointment.appointment_draft_delete + import app.resources.bookings.appointment.appointment_draft_flush + import app.resources.bookings.appointment.appointment_put + import app.resources.bookings.appointment.appointment_delete + import app.resources.bookings.appointment.appointment_recurring_delete + import app.resources.bookings.appointment.appointment_recurring_put + import app.resources.bookings.booking.booking_delete + import app.resources.bookings.booking.booking_detail + import app.resources.bookings.booking.booking_list + import app.resources.bookings.booking.booking_post + import app.resources.bookings.booking.booking_put + import app.resources.bookings.booking.booking_recurring_delete + import app.resources.bookings.booking.booking_recurring_put + import app.resources.bookings.booking.booking_recurring_stat_delete + import app.resources.bookings.exam.exam_bcmp + import app.resources.bookings.exam.exam_bulk_status + import app.resources.bookings.exam.exam_delete + import app.resources.bookings.exam.exam_detail + import app.resources.bookings.exam.exam_email_invigilator + import app.resources.bookings.exam.exam_list + import app.resources.bookings.exam.exam_post + import app.resources.bookings.exam.exam_put + import app.resources.bookings.exam.exam_export_list + import app.resources.bookings.exam.exam_event_id_detail + import app.resources.bookings.exam.exam_download + import app.resources.bookings.exam.exam_transfer + import app.resources.bookings.exam.exam_upload + import app.resources.bookings.invigilator.invigilator_list + import app.resources.bookings.invigilator.invigilator_list_offsite + import app.resources.bookings.invigilator.invigilator_put + import app.resources.bookings.room.room_list + import app.resources.bookings.exam_type.exam_type_list + import app.resources.bookings.appointment.appointment_reminder_get + import app.resources.bookings.walkin.walkin # Hostname for debug purposes @@ -360,6 +366,15 @@ def error_handler(e): return "error" +@application.errorhandler(ValidationError) +@api.errorhandler(ValidationError) +def handle_validation_error(error): + logging.warning("Validation error: %s", error.messages) + response = {"message": error.messages} + error.data = response + return response, 422 + + @application.errorhandler(AuthError) @api.errorhandler(AuthError) def handle_auth_error(ex): @@ -428,7 +443,22 @@ def get_roles(a_dict): app.config['JWT_ROLE_CALLBACK'] = get_roles - jwt_manager.init_app(app) + try: + jwt_manager.init_app(app) + except URLError: + well_known_config = app.config.get('JWT_OIDC_WELL_KNOWN_CONFIG') + jwks_uri = app.config.get('JWT_OIDC_JWKS_URI') + issuer = app.config.get('JWT_OIDC_ISSUER') + + if not (well_known_config and jwks_uri and issuer): + raise + + app.logger.warning( + 'JWT well-known config could not be reached; retrying with direct JWKS and issuer settings.' + ) + app.config['JWT_OIDC_WELL_KNOWN_CONFIG'] = None + jwt_manager.init_app(app) + app.config['JWT_OIDC_WELL_KNOWN_CONFIG'] = well_known_config setup_jwt_manager(application) diff --git a/api/requirements.txt b/api/requirements.txt old mode 100755 new mode 100644 index a6568b19c..6664325fb --- a/api/requirements.txt +++ b/api/requirements.txt @@ -1,103 +1,736 @@ -alembic==1.5.2 -amqp==5.2.0 -aniso8601==9.0.1 -astroid==2.5.8 -async-timeout==4.0.3 -attrs==23.2.0 -bidict==0.23.1 -blinker==1.8.2 -Brotli==1.1.0 -cachelib==0.13.0 -certifi==2024.7.4 -charset-normalizer==3.3.2 -click==7.1.2 -decorator==5.0.9 -dnspython==2.6.1 -ecdsa==0.19.0 -eventlet==0.35.2 -filelock==3.0.12 -Flask==1.1.4 -Flask-Admin==1.5.8 -Flask-Cache==0.13.1 -Flask-Caching==1.11.1 -Flask-Compress==1.9.0 -Flask-Cors==5.0.0 -flask-jwt-oidc==0.3.0 -Flask-Login==0.5.0 -flask-marshmallow==0.14.0 -Flask-Migrate==2.7.0 -Flask-Moment==0.11.0 -flask-restx==0.5.1 -Flask-Script==2.0.6 -Flask-SocketIO==5.1.0 -Flask-SQLAlchemy==2.5.1 -future==0.18.2 -gevent==24.2.1 -greenlet==3.0.3 -gunicorn==22.0.0 -h11==0.14.0 -idna==3.7 -ijson==2.6.1 -importlib_metadata==7.1.0 -importlib_resources==6.4.0 -iniconfig==2.0.0 -isort==5.13.2 -itsdangerous==1.1.0 -Jinja2==2.11.3 -jsonschema==4.22.0 -jsonschema-specifications==2023.12.1 -kombu==5.1.0 -lazy-object-proxy==1.10.0 -Mako==1.3.3 -MarkupSafe==2.0.1 -marshmallow==3.21.2 -marshmallow-sqlalchemy==0.26.1 -mccabe==0.6.1 -minio==7.0.4 -numpy==1.21.0 -oauthlib==3.2.2 -packaging==24.0 -pip==24.0 -pkgutil_resolve_name==1.3.10 -pluggy==0.13.1 -psycopg2-binary==2.9.1 -py==1.11.0 -pyasn1==0.6.0 -pycontracts3==7.2 -pylint==2.7.2 -pyparsing==3.0.7 -pysnow==0.7.17 -pytest==6.2.4 -python-dateutil==2.9.0.post0 -python-dotenv==0.17.1 -python-editor==1.0.4 -python-engineio==4.9.0 -python-jose==3.3.0 -python-magic==0.4.27 -python-socketio==5.11.2 -pytz==2019.3 -redis==4.5.3 -referencing==0.35.1 -requests==2.32.2 -requests-oauthlib==1.3.1 -rpds-py==0.18.1 -rsa==4.9 -setuptools==70.0.0 -simple-websocket==1.0.0 -six==1.16.0 -snowplow-tracker==0.9.1 -SQLAlchemy==1.3.24 -SQLAlchemy-Continuum==1.3.11 -SQLAlchemy-Utc==0.12.0 -SQLAlchemy-Utils==0.41.2 -toml==0.10.2 -urllib3==1.26.19 -vine==5.1.0 -Werkzeug==1.0.1 -wheel==0.41.2 -wrapt==1.12.1 -wsproto==1.2.0 -WTForms==3.0.0 -zipp==3.19.1 -zope.event==5.0 -zope.interface==6.3 +# This file was autogenerated by uv via the following command: +# uv export --frozen --format requirements-txt --no-emit-project --output-file requirements.txt +alembic==1.18.4 \ + --hash=sha256:a5ed4adcf6d8a4cb575f3d759f071b03cd6e5c7618eb796cb52497be25bfe19a \ + --hash=sha256:cb6e1fd84b6174ab8dbb2329f86d631ba9559dd78df550b57804d607672cedbc + # via + # flask-migrate + # queue-api +amqp==5.3.1 \ + --hash=sha256:43b3319e1b4e7d1251833a93d672b4af1e40f3d632d479b98661a95f117880a2 \ + --hash=sha256:cddc00c725449522023bad949f70fff7b48f0b1ade74d170a6f10ab044739432 + # via + # kombu + # queue-api +aniso8601==10.0.1 \ + --hash=sha256:25488f8663dd1528ae1f54f94ac1ea51ae25b4d531539b8bc707fed184d16845 \ + --hash=sha256:eb19717fd4e0db6de1aab06f12450ab92144246b257423fe020af5748c0cb89e + # via flask-restx +argon2-cffi==25.1.0 \ + --hash=sha256:694ae5cc8a42f4c4e2bf2ca0e64e51e23a040c6a517a85074683d3959e1346c1 \ + --hash=sha256:fdc8b074db390fccb6eb4a3604ae7231f219aa669a2652e0f20e16ba513d5741 + # via minio +argon2-cffi-bindings==25.1.0 \ + --hash=sha256:1db89609c06afa1a214a69a462ea741cf735b29a57530478c06eb81dd403de99 \ + --hash=sha256:1e021e87faa76ae0d413b619fe2b65ab9a037f24c60a1e6cc43457ae20de6dc6 \ + --hash=sha256:2630b6240b495dfab90aebe159ff784d08ea999aa4b0d17efa734055a07d2f44 \ + --hash=sha256:3c6702abc36bf3ccba3f802b799505def420a1b7039862014a65db3205967f5a \ + --hash=sha256:3d3f05610594151994ca9ccb3c771115bdb4daef161976a266f0dd8aa9996b8f \ + --hash=sha256:473bcb5f82924b1becbb637b63303ec8d10e84c8d241119419897a26116515d2 \ + --hash=sha256:7aef0c91e2c0fbca6fc68e7555aa60ef7008a739cbe045541e438373bc54d2b0 \ + --hash=sha256:84a461d4d84ae1295871329b346a97f68eade8c53b6ed9a7ca2d7467f3c8ff6f \ + --hash=sha256:87c33a52407e4c41f3b70a9c2d3f6056d88b10dad7695be708c5021673f55623 \ + --hash=sha256:8b8efee945193e667a396cbc7b4fb7d357297d6234d30a489905d96caabde56b \ + --hash=sha256:a1c70058c6ab1e352304ac7e3b52554daadacd8d453c1752e547c76e9c99ac44 \ + --hash=sha256:a98cd7d17e9f7ce244c0803cad3c23a7d379c301ba618a5fa76a67d116618b98 \ + --hash=sha256:aecba1723ae35330a008418a91ea6cfcedf6d31e5fbaa056a166462ff066d500 \ + --hash=sha256:b0fdbcf513833809c882823f98dc2f931cf659d9a1429616ac3adebb49f5db94 \ + --hash=sha256:b55aec3565b65f56455eebc9b9f34130440404f27fe21c3b375bf1ea4d8fbae6 \ + --hash=sha256:b957f3e6ea4d55d820e40ff76f450952807013d361a65d7f28acc0acbf29229d \ + --hash=sha256:ba92837e4a9aa6a508c8d2d7883ed5a8f6c308c89a4790e1e447a220deb79a85 \ + --hash=sha256:c4f9665de60b1b0e99bcd6be4f17d90339698ce954cfd8d9cf4f91c995165a92 \ + --hash=sha256:c87b72589133f0346a1cb8d5ecca4b933e3c9b64656c9d175270a000e73b288d \ + --hash=sha256:d3e924cfc503018a714f94a49a149fdc0b644eaead5d1f089330399134fa028a \ + --hash=sha256:e2fd3bfbff3c5d74fef31a722f729bf93500910db650c925c2d6ef879a7e51cb + # via argon2-cffi +astroid==4.0.4 \ + --hash=sha256:52f39653876c7dec3e3afd4c2696920e05c83832b9737afc21928f2d2eb7a753 \ + --hash=sha256:986fed8bcf79fb82c78b18a53352a0b287a73817d6dbcfba3162da36667c49a0 + # via pylint +attrs==26.1.0 \ + --hash=sha256:c647aa4a12dfbad9333ca4e71fe62ddc36f4e63b2d260a37a8b83d2f043ac309 \ + --hash=sha256:d03ceb89cb322a8fd706d4fb91940737b6642aa36998fe130a9bc96c985eff32 + # via + # jsonschema + # referencing +bidict==0.23.1 \ + --hash=sha256:03069d763bc387bbd20e7d49914e75fc4132a41937fa3405417e1a5a2d006d71 \ + --hash=sha256:5dae8d4d79b552a71cbabc7deb25dfe8ce710b17ff41711e13010ead2abfc3e5 + # via python-socketio +blinker==1.9.0 \ + --hash=sha256:b4ce2265a7abece45e7cc896e98dbebe6cead56bcf805a3d23136d145f5445bf \ + --hash=sha256:ba0efaa9080b619ff2f3459d1d500c57bddea4a6b424b60a91141db6fd2f08bc + # via + # flask + # flask-socketio +brotli==1.2.0 ; platform_python_implementation != 'PyPy' \ + --hash=sha256:3219bd9e69868e57183316ee19c84e03e8f8b5a1d1f2667e1aa8c2f91cb061ac \ + --hash=sha256:6c12dad5cd04530323e723787ff762bac749a7b256a5bece32b2243dd5c27b21 \ + --hash=sha256:7547369c4392b47d30a3467fe8c3330b4f2e0f7730e45e3103d7d636678a808b \ + --hash=sha256:832c115a020e463c2f67664560449a7bea26b0c1fdd690352addad6d0a08714d \ + --hash=sha256:9322b9f8656782414b37e6af884146869d46ab85158201d82bab9abbcb971dc7 \ + --hash=sha256:963a08f3bebd8b75ac57661045402da15991468a621f014be54e50f53a58d19e \ + --hash=sha256:cf9cba6f5b78a2071ec6fb1e7bd39acf35071d90a81231d67e92d637776a6a63 \ + --hash=sha256:d2d085ded05278d1c7f65560aae97b3160aeb2ea2c0b3e26204856beccb60888 \ + --hash=sha256:e310f77e41941c13340a95976fe66a8a95b01e783d430eeaf7a2f87e0a57dd0a \ + --hash=sha256:e7c0af964e0b4e3412a0ebf341ea26ec767fa0b4cf81abb5e897c9338b5ad6a3 \ + --hash=sha256:fc1530af5c3c275b8524f2e24841cbe2599d74462455e9bae5109e9ff42e9361 + # via flask-compress +brotlicffi==1.2.0.1 ; platform_python_implementation == 'PyPy' \ + --hash=sha256:2c85e65913cf2b79c57a3fdd05b98d9731d9255dc0cb696b09376cc091b9cddd \ + --hash=sha256:3c9544f83cb715d95d7eab3af4adbbef8b2093ad6382288a83b3a25feb1a57ec \ + --hash=sha256:535f2d05d0273408abc13fc0eebb467afac17b0ad85090c8913690d40207dac5 \ + --hash=sha256:625f8115d32ae9c0740d01ea51518437c3fbaa3e78d41cb18459f6f7ac326000 \ + --hash=sha256:6f3314a3476f59e5443f9f72a6dff16edc0c3463c9b318feaef04ae3e4683f5a \ + --hash=sha256:82ea52e2b5d3145b6c406ebd3efb0d55db718b7ad996bd70c62cec0439de1187 \ + --hash=sha256:91ba5f0ccc040f6ff8f7efaf839f797723d03ed46acb8ae9408f99ffd2572cf4 \ + --hash=sha256:be9a670c6811af30a4bd42d7116dc5895d3b41beaa8ed8a89050447a0181f5ce \ + --hash=sha256:c20d5c596278307ad06414a6d95a892377ea274a5c6b790c2548c009385d621c \ + --hash=sha256:ce17eb798ca59ecec67a9bb3fd7a4304e120d1cd02953ce522d959b9a84d58ac \ + --hash=sha256:da2e82a08e7778b8bc539d27ca03cdd684113e81394bfaaad8d0dfc6a17ddede + # via flask-compress +cachelib==0.13.0 \ + --hash=sha256:209d8996e3c57595bee274ff97116d1d73c4980b2fd9a34c7846cd07fd2e1a48 \ + --hash=sha256:8c8019e53b6302967d4e8329a504acf75e7bc46130291d30188a6e4e58162516 + # via + # flask-caching + # flask-jwt-oidc +certifi==2026.2.25 \ + --hash=sha256:027692e4402ad994f1c42e52a4997a9763c646b73e4096e4d5d6db8af1d6f0fa \ + --hash=sha256:e887ab5cee78ea814d3472169153c2d12cd43b14bd03329a39a9c6e2e80bfba7 + # via + # minio + # requests +cffi==2.0.0 \ + --hash=sha256:087067fa8953339c723661eda6b54bc98c5625757ea62e95eb4898ad5e776e9f \ + --hash=sha256:0a1527a803f0a659de1af2e1fd700213caba79377e27e4693648c2923da066f9 \ + --hash=sha256:12873ca6cb9b0f0d3a0da705d6086fe911591737a59f28b7936bdfed27c0d47c \ + --hash=sha256:1fc9ea04857caf665289b7a75923f2c6ed559b8298a1b8c49e59f7dd95c8481e \ + --hash=sha256:203a48d1fb583fc7d78a4c6655692963b860a417c0528492a6bc21f1aaefab25 \ + --hash=sha256:24b6f81f1983e6df8db3adc38562c83f7d4a0c36162885ec7f7b77c7dcbec97b \ + --hash=sha256:28a3a209b96630bca57cce802da70c266eb08c6e97e5afd61a75611ee6c64592 \ + --hash=sha256:38100abb9d1b1435bc4cc340bb4489635dc2f0da7456590877030c9b3d40b0c1 \ + --hash=sha256:44d1b5909021139fe36001ae048dbdde8214afa20200eda0f64c068cac5d5529 \ + --hash=sha256:6c6c373cfc5c83a975506110d17457138c8c63016b563cc9ed6e056a82f13ce4 \ + --hash=sha256:737fe7d37e1a1bffe70bd5754ea763a62a066dc5913ca57e957824b72a85e205 \ + --hash=sha256:7553fb2090d71822f02c629afe6042c299edf91ba1bf94951165613553984512 \ + --hash=sha256:7a66c7204d8869299919db4d5069a82f1561581af12b11b3c9f48c584eb8743d \ + --hash=sha256:7cc09976e8b56f8cebd752f7113ad07752461f48a58cbba644139015ac24954c \ + --hash=sha256:92b68146a71df78564e4ef48af17551a5ddd142e5190cdf2c5624d0c3ff5b2e8 \ + --hash=sha256:9a67fc9e8eb39039280526379fb3a70023d77caec1852002b4da7e8b270c4dd9 \ + --hash=sha256:afb8db5439b81cf9c9d0c80404b60c3cc9c3add93e114dcae767f1477cb53775 \ + --hash=sha256:b1e74d11748e7e98e2f426ab176d4ed720a64412b6a15054378afdb71e0f37dc \ + --hash=sha256:c654de545946e0db659b3400168c9ad31b5d29593291482c43e3564effbcee13 \ + --hash=sha256:d68b6cef7827e8641e8ef16f4494edda8b36104d79773a334beaa1e3521430f6 \ + --hash=sha256:d9b97165e8aed9272a6bb17c01e3cc5871a594a446ebedc996e2397a1c1ea8ef \ + --hash=sha256:dbd5c7a25a7cb98f5ca55d258b103a2054f859a46ae11aaf23134f9cc0d356ad \ + --hash=sha256:fc33c5141b55ed366cfaad382df24fe7dcbc686de5be719b207bb248e3053dc5 + # via + # argon2-cffi-bindings + # brotlicffi + # cryptography + # gevent +charset-normalizer==3.4.6 \ + --hash=sha256:06a7e86163334edfc5d20fe104db92fcd666e5a5df0977cb5680a506fe26cc8e \ + --hash=sha256:0e901eb1049fdb80f5bd11ed5ea1e498ec423102f7a9b9e4645d5b8204ff2815 \ + --hash=sha256:172985e4ff804a7ad08eebec0a1640ece87ba5041d565fff23c8f99c1f389484 \ + --hash=sha256:197c1a244a274bb016dd8b79204850144ef77fe81c5b797dc389327adb552407 \ + --hash=sha256:1ae6b62897110aa7c79ea2f5dd38d1abca6db663687c0b1ad9aed6f6bae3d9d6 \ + --hash=sha256:22c6f0c2fbc31e76c3b8a86fba1a56eda6166e238c29cdd3d14befdb4a4e4815 \ + --hash=sha256:2a24157fa36980478dd1770b585c0f30d19e18f4fb0c47c13aa568f871718579 \ + --hash=sha256:419a9d91bd238052642a51938af8ac05da5b3343becde08d5cdeab9046df9ee1 \ + --hash=sha256:47955475ac79cc504ef2704b192364e51d0d473ad452caedd0002605f780101c \ + --hash=sha256:4be9f4830ba8741527693848403e2c457c16e499100963ec711b1c6f2049b7c7 \ + --hash=sha256:5273b9f0b5835ff0350c0828faea623c68bfa65b792720c453e22b25cc72930f \ + --hash=sha256:58c948d0d086229efc484fe2f30c2d382c86720f55cd9bc33591774348ad44e0 \ + --hash=sha256:5d11595abf8dd942a77883a39d81433739b287b6aa71620f15164f8096221b30 \ + --hash=sha256:74119174722c4349af9708993118581686f343adc1c8c9c007d59be90d077f3f \ + --hash=sha256:7504e9b7dc05f99a9bbb4525c67a2c155073b44d720470a148b34166a69c054e \ + --hash=sha256:79090741d842f564b1b2827c0b82d846405b744d31e84f18d7a7b41c20e473ff \ + --hash=sha256:7bda6eebafd42133efdca535b04ccb338ab29467b3f7bf79569883676fc628db \ + --hash=sha256:7edbed096e4a4798710ed6bc75dcaa2a21b68b6c356553ac4823c3658d53743a \ + --hash=sha256:7f9019c9cb613f084481bd6a100b12e1547cf2efe362d873c2e31e4035a6fa43 \ + --hash=sha256:87725cfb1a4f1f8c2fc9890ae2f42094120f4b44db9360be5d99a4c6b0e03a9e \ + --hash=sha256:947cf925bc916d90adba35a64c82aace04fa39b46b52d4630ece166655905a69 \ + --hash=sha256:95b52c68d64c1878818687a473a10547b3292e82b6f6fe483808fb1468e2f52f \ + --hash=sha256:9cc6e6d9e571d2f863fa77700701dae73ed5f78881efc8b3f9a4398772ff53e8 \ + --hash=sha256:ad8faf8df23f0378c6d527d8b0b15ea4a2e23c89376877c598c4870d1b2c7866 \ + --hash=sha256:b3694e3f87f8ac7ce279d4355645b3c878d24d1424581b46282f24b92f5a4ae2 \ + --hash=sha256:b4ff1d35e8c5bd078be89349b6f3a845128e685e751b6ea1169cf2160b344c4d \ + --hash=sha256:bbc8c8650c6e51041ad1be191742b8b421d05bbd3410f43fa2a00c8db87678e8 \ + --hash=sha256:ca0276464d148c72defa8bb4390cce01b4a0e425f3b50d1435aa6d7a18107602 \ + --hash=sha256:cd5e2801c89992ed8c0a3f0293ae83c159a60d9a5d685005383ef4caca77f2c4 \ + --hash=sha256:e1f6e2f00a6b8edb562826e4632e26d063ac10307e80f7461f7de3ad8ef3f077 \ + --hash=sha256:e5bcc1a1ae744e0bb59641171ae53743760130600da8db48cbb6e4918e186e4e \ + --hash=sha256:ef5960d965e67165d75b7c7ffc60a83ec5abfc5c11b764ec13ea54fbef8b4421 \ + --hash=sha256:f5ea69428fa1b49573eef0cc44a1d43bebd45ad0c611eb7d7eac760c7ae771bc \ + --hash=sha256:fcce033e4021347d80ed9c66dcf1e7b1546319834b74445f561d2e2221de5659 + # via requests +click==8.3.1 \ + --hash=sha256:12ff4785d337a1bb490bb7e9c2b1ee5da3112e94a8622f26a6c77f5d2fc6842a \ + --hash=sha256:981153a64e25f12d547d3426c367a4857371575ee7ad18df2a6183ab0545b2a6 + # via + # flask + # flask-socketio + # queue-api +colorama==0.4.6 ; sys_platform == 'win32' \ + --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ + --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 + # via + # click + # pylint + # pytest +coverage==7.13.5 \ + --hash=sha256:0b67af5492adb31940ee418a5a655c28e48165da5afab8c7fa6fd72a142f8740 \ + --hash=sha256:0cd9ed7a8b181775459296e402ca4fb27db1279740a24e93b3b41942ebe4b215 \ + --hash=sha256:10a0c37f0b646eaff7cce1874c31d1f1ccb297688d4c747291f4f4c70741cc8b \ + --hash=sha256:1b11eef33edeae9d142f9b4358edb76273b3bfd30bc3df9a4f95d0e49caf94e8 \ + --hash=sha256:2aa055ae1857258f9e0045be26a6d62bdb47a72448b62d7b55f4820f361a2633 \ + --hash=sha256:301e3b7dfefecaca37c9f1aa6f0049b7d4ab8dd933742b607765d757aca77d43 \ + --hash=sha256:32ca0c0114c9834a43f045a87dcebd69d108d8ffb666957ea65aa132f50332e2 \ + --hash=sha256:34b02417cf070e173989b3db962f7ed56d2f644307b2cf9d5a0f258e13084a61 \ + --hash=sha256:35a31f2b1578185fbe6aa2e74cea1b1d0bbf4c552774247d9160d29b80ed56cc \ + --hash=sha256:380e8e9084d8eb38db3a9176a1a4f3c0082c3806fa0dc882d1d87abc3c789247 \ + --hash=sha256:6697e29b93707167687543480a40f0db8f356e86d9f67ddf2e37e2dfd91a9dab \ + --hash=sha256:68a4953be99b17ac3c23b6efbc8a38330d99680c9458927491d18700ef23ded0 \ + --hash=sha256:6c36ddb64ed9d7e496028d1d00dfec3e428e0aabf4006583bb1839958d280510 \ + --hash=sha256:750db93a81e3e5a9831b534be7b1229df848b2e125a604fe6651e48aa070e5f9 \ + --hash=sha256:777c4d1eff1b67876139d24288aaf1817f6c03d6bae9c5cc8d27b83bcfe38fe3 \ + --hash=sha256:800bc829053c80d240a687ceeb927a94fd108bbdc68dfbe505d0d75ab578a882 \ + --hash=sha256:8769751c10f339021e2638cd354e13adeac54004d1941119b2c96fe5276d45ea \ + --hash=sha256:8fdf453a942c3e4d99bd80088141c4c6960bb232c409d9c3558e2dbaa3998562 \ + --hash=sha256:9bb2a28101a443669a423b665939381084412b81c3f8c0fcfbac57f4e30b5b8e \ + --hash=sha256:9dacc2ad679b292709e0f5fc1ac74a6d4d5562e424058962c7bb0c658ad25e45 \ + --hash=sha256:9ddb4f4a5479f2539644be484da179b653273bca1a323947d48ab107b3ed1f29 \ + --hash=sha256:b5db73ba3c41c7008037fa731ad5459fc3944cb7452fc0aa9f822ad3533c583c \ + --hash=sha256:bd3a2fbc1c6cccb3c5106140d87cc6a8715110373ef42b63cf5aea29df8c217a \ + --hash=sha256:c81f6515c4c40141f83f502b07bbfa5c240ba25bbe73da7b33f1e5b6120ff179 \ + --hash=sha256:c9136ff29c3a91e25b1d1552b5308e53a1e0653a23e53b6366d7c2dcbbaf8a16 \ + --hash=sha256:cec2d83125531bd153175354055cdb7a09987af08a9430bd173c937c6d0fba2a \ + --hash=sha256:cff784eef7f0b8f6cb28804fbddcfa99f89efe4cc35fb5627e3ac58f91ed3ac0 \ + --hash=sha256:d8a7a2049c14f413163e2bdabd37e41179b1d1ccb10ffc6ccc4b7a718429c607 \ + --hash=sha256:e1c85e0b6c05c592ea6d8768a66a254bfb3874b53774b12d4c89c481eb78cb90 \ + --hash=sha256:e301d30dd7e95ae068671d746ba8c34e945a82682e62918e41b2679acd2051a0 \ + --hash=sha256:e808af52a0513762df4d945ea164a24b37f2f518cbe97e03deaa0ee66139b4d6 \ + --hash=sha256:fbabfaceaeb587e16f7008f7795cd80d20ec548dc7f94fbb0d4ec2e038ce563f + # via pytest-cov +cryptography==46.0.6 \ + --hash=sha256:02fad249cb0e090b574e30b276a3da6a149e04ee2f049725b1f69e7b8351ec70 \ + --hash=sha256:063b67749f338ca9c5a0b7fe438a52c25f9526b851e24e6c9310e7195aad3b4d \ + --hash=sha256:12cae594e9473bca1a7aceb90536060643128bb274fcea0fc459ab90f7d1ae7a \ + --hash=sha256:22259338084d6ae497a19bae5d4c66b7ca1387d3264d1c2c0e72d9e9b6a77b97 \ + --hash=sha256:26031f1e5ca62fcb9d1fcb34b2b60b390d1aacaa15dc8b895a9ed00968b97b30 \ + --hash=sha256:27550628a518c5c6c903d84f637fbecf287f6cb9ced3804838a1295dc1fd0759 \ + --hash=sha256:2b417edbe8877cda9022dde3a008e2deb50be9c407eef034aeeb3a8b11d9db3c \ + --hash=sha256:2ef9e69886cbb137c2aef9772c2e7138dc581fad4fcbcf13cc181eb5a3ab6275 \ + --hash=sha256:341359d6c9e68834e204ceaf25936dffeafea3829ab80e9503860dcc4f4dac58 \ + --hash=sha256:380343e0653b1c9d7e1f55b52aaa2dbb2fdf2730088d48c43ca1c7c0abb7cc2f \ + --hash=sha256:3c21d92ed15e9cfc6eb64c1f5a0326db22ca9c2566ca46d845119b45b4400361 \ + --hash=sha256:3dfa6567f2e9e4c5dceb8ccb5a708158a2a871052fa75c8b78cb0977063f1507 \ + --hash=sha256:456b3215172aeefb9284550b162801d62f5f264a081049a3e94307fe20792cfa \ + --hash=sha256:4668298aef7cddeaf5c6ecc244c2302a2b8e40f384255505c22875eebb47888b \ + --hash=sha256:639301950939d844a9e1c4464d7e07f902fe9a7f6b215bb0d4f28584729935d8 \ + --hash=sha256:64235194bad039a10bb6d2d930ab3323baaec67e2ce36215fd0952fad0930ca8 \ + --hash=sha256:6617f67b1606dfd9fe4dbfa354a9508d4a6d37afe30306fe6c101b7ce3274b72 \ + --hash=sha256:67177e8a9f421aa2d3a170c3e56eca4e0128883cf52a071a7cbf53297f18b175 \ + --hash=sha256:6739d56300662c468fddb0e5e291f9b4d084bead381667b9e654c7dd81705124 \ + --hash=sha256:69cf0056d6947edc6e6760e5f17afe4bea06b56a9ac8a06de9d2bd6b532d4f3a \ + --hash=sha256:760997a4b950ff00d418398ad73fbc91aa2894b5c1db7ccb45b4f68b42a63b3c \ + --hash=sha256:79e865c642cfc5c0b3eb12af83c35c5aeff4fa5c672dc28c43721c2c9fdd2f0f \ + --hash=sha256:7e6142674f2a9291463e5e150090b95a8519b2fb6e6aaec8917dd8d094ce750d \ + --hash=sha256:7f417f034f91dcec1cb6c5c35b07cdbb2ef262557f701b4ecd803ee8cefed4f4 \ + --hash=sha256:7f6690b6c55e9c5332c0b59b9c8a3fb232ebf059094c17f9019a51e9827df91c \ + --hash=sha256:8927ccfbe967c7df312ade694f987e7e9e22b2425976ddbf28271d7e58845290 \ + --hash=sha256:8ce35b77aaf02f3b59c90b2c8a05c73bac12cea5b4e8f3fbece1f5fddea5f0ca \ + --hash=sha256:8e7304c4f4e9490e11efe56af6713983460ee0780f16c63f219984dab3af9d2d \ + --hash=sha256:97c8115b27e19e592a05c45d0dd89c57f81f841cc9880e353e0d3bf25b2139ed \ + --hash=sha256:9a693028b9cbe51b5a1136232ee8f2bc242e4e19d456ded3fa7c86e43c713b4a \ + --hash=sha256:9a9c42a2723999a710445bc0d974e345c32adfd8d2fac6d8a251fa829ad31cfb \ + --hash=sha256:aad75154a7ac9039936d50cf431719a2f8d4ed3d3c277ac03f3339ded1a5e707 \ + --hash=sha256:b12c6b1e1651e42ab5de8b1e00dc3b6354fdfd778e7fa60541ddacc27cd21410 \ + --hash=sha256:b928a3ca837c77a10e81a814a693f2295200adb3352395fad024559b7be7a736 \ + --hash=sha256:bcb87663e1f7b075e48c3be3ecb5f0b46c8fc50b50a97cf264e7f60242dca3f2 \ + --hash=sha256:c797e2517cb7880f8297e2c0f43bb910e91381339336f75d2c1c2cbf811b70b4 \ + --hash=sha256:c89eb37fae9216985d8734c1afd172ba4927f5a05cfd9bf0e4863c6d5465b013 \ + --hash=sha256:cdcd3edcbc5d55757e5f5f3d330dd00007ae463a7e7aa5bf132d1f22a4b62b19 \ + --hash=sha256:d24c13369e856b94892a89ddf70b332e0b70ad4a5c43cf3e9cb71d6d7ffa1f7b \ + --hash=sha256:d4e4aadb7fc1f88687f47ca20bb7227981b03afaae69287029da08096853b738 \ + --hash=sha256:d9528b535a6c4f8ff37847144b8986a9a143585f0540fbcb1a98115b543aa463 \ + --hash=sha256:ed3775295fb91f70b4027aeba878d79b3e55c0b3e97eaa4de71f8f23a9f2eb77 \ + --hash=sha256:ed418c37d095aeddf5336898a132fba01091f0ac5844e3e8018506f014b6d2c4 + # via + # flask-jwt-oidc + # python-jose +dill==0.4.1 \ + --hash=sha256:1e1ce33e978ae97fcfcff5638477032b801c46c7c65cf717f95fbc2248f79a9d \ + --hash=sha256:423092df4182177d4d8ba8290c8a5b640c66ab35ec7da59ccfa00f6fa3eea5fa + # via pylint +ecdsa==0.19.2 \ + --hash=sha256:62635b0ac1ca2e027f82122b5b81cb706edc38cd91c63dda28e4f3455a2bf930 \ + --hash=sha256:840f5dc5e375c68f36c1a7a5b9caad28f95daa65185c9253c0c08dd952bb7399 + # via python-jose +filelock==3.25.2 \ + --hash=sha256:b64ece2b38f4ca29dd3e810287aa8c48182bbecd1ae6e9ae126c9b35f1382694 \ + --hash=sha256:ca8afb0da15f229774c9ad1b455ed96e85a81373065fb10446672f64444ddf70 + # via queue-api +flask==3.1.3 \ + --hash=sha256:0ef0e52b8a9cd932855379197dd8f94047b359ca0a78695144304cb45f87c9eb \ + --hash=sha256:f4bcbefc124291925f1a26446da31a5178f9483862233b23c0c96a20701f670c + # via + # flask-admin + # flask-caching + # flask-compress + # flask-cors + # flask-jwt-oidc + # flask-login + # flask-marshmallow + # flask-migrate + # flask-restx + # flask-socketio + # flask-sqlalchemy + # queue-api +flask-admin==2.0.2 \ + --hash=sha256:1d06aec7efee957972b43f6b08a0bd08d5f4cf9a337d4ece2f17c98abc2a214e \ + --hash=sha256:4b3c44068de0fe4630dfcd190cc11231cbbdd7bac315c74c55d1764087b8b273 + # via queue-api +flask-caching==2.3.1 \ + --hash=sha256:65d7fd1b4eebf810f844de7de6258254b3248296ee429bdcb3f741bcbf7b98c9 \ + --hash=sha256:d3efcf600e5925ea5a2fcb810f13b341ae984f5b52c00e9d9070392f3ca10761 + # via queue-api +flask-compress==1.23 \ + --hash=sha256:52108afb4d133a5aab9809e6ac3c085ed7b9c788c75c6846c129faa28468f08c \ + --hash=sha256:5580935b422e3f136b9a90909e4b1015ac2b29c9aebe0f8733b790fde461c545 + # via queue-api +flask-cors==6.0.2 \ + --hash=sha256:6e118f3698249ae33e429760db98ce032a8bf9913638d085ca0f4c5534ad2423 \ + --hash=sha256:e57544d415dfd7da89a9564e1e3a9e515042df76e12130641ca6f3f2f03b699a + # via queue-api +flask-jwt-oidc==0.9.0 \ + --hash=sha256:6c6169b52b73dbdc06f2e11b9481f382c4125a1b181f88f7270992200cda69a3 \ + --hash=sha256:7ce75f002e7a1ef3639366bf03f62b86e9a3afbd2d1818cbcb71a196b027e55c + # via queue-api +flask-login==0.6.3 \ + --hash=sha256:5e23d14a607ef12806c699590b89d0f0e0d67baeec599d75947bf9c147330333 \ + --hash=sha256:849b25b82a436bf830a054e74214074af59097171562ab10bfa999e6b78aae5d + # via queue-api +flask-marshmallow==1.4.0 \ + --hash=sha256:98c90a253052c72d2ddddc925539ac33bbd780c6fba86478ffe18e3b89d8b471 \ + --hash=sha256:b758fc2c428d0cbee6fd0ccf0d55524fe9e426a86a177dcc0fc8cd71ad4b7c59 + # via queue-api +flask-migrate==4.1.0 \ + --hash=sha256:1a336b06eb2c3ace005f5f2ded8641d534c18798d64061f6ff11f79e1434126d \ + --hash=sha256:24d8051af161782e0743af1b04a152d007bad9772b2bca67b7ec1e8ceeb3910d + # via queue-api +flask-restx==1.3.2 \ + --hash=sha256:0ae13d77e7d7e4dce513970cfa9db45364aef210e99022de26d2b73eb4dbced5 \ + --hash=sha256:6e035496e8223668044fc45bf769e526352fd648d9e159bd631d94fd645a687b + # via queue-api +flask-socketio==5.6.1 \ + --hash=sha256:51a3f71b28b4476c650829607e3a993e076034db6c3cc31f718f0a4b45939d42 \ + --hash=sha256:fe5bd995c3ed4da9a98f335d0d830fa1a19d84a64789f6265642a671fdacaeac + # via queue-api +flask-sqlalchemy==3.1.1 \ + --hash=sha256:4ba4be7f419dc72f4efd8802d69974803c37259dd42f3913b0dcf75c9447e0a0 \ + --hash=sha256:e4b68bb881802dda1a7d878b2fc84c06d1ee57fb40b874d3dc97dabfa36b8312 + # via + # flask-migrate + # queue-api +gevent==25.9.1 \ + --hash=sha256:0adb937f13e5fb90cca2edf66d8d7e99d62a299687400ce2edee3f3504009356 \ + --hash=sha256:1a3fe4ea1c312dbf6b375b416925036fe79a40054e6bf6248ee46526ea628be1 \ + --hash=sha256:1d0f5d8d73f97e24ea8d24d8be0f51e0cf7c54b8021c1fddb580bf239474690f \ + --hash=sha256:427f869a2050a4202d93cf7fd6ab5cffb06d3e9113c10c967b6e2a0d45237cb8 \ + --hash=sha256:adf9cd552de44a4e6754c51ff2e78d9193b7fa6eab123db9578a210e657235dd \ + --hash=sha256:b5a67a0974ad9f24721034d1e008856111e0535f1541499f72a733a73d658d1c \ + --hash=sha256:bb63c0d6cb9950cc94036a4995b9cc4667b8915366613449236970f4394f94d7 \ + --hash=sha256:c049880175e8c93124188f9d926af0a62826a3b81aa6d3074928345f8238279e \ + --hash=sha256:ddd3ff26e5c4240d3fbf5516c2d9d5f2a998ef87cfb73e1429cfaeaaec860fa6 + # via queue-api +greenlet==3.3.2 ; platform_machine == 'AMD64' or platform_machine == 'WIN32' or platform_machine == 'aarch64' or platform_machine == 'amd64' or platform_machine == 'ppc64le' or platform_machine == 'win32' or platform_machine == 'x86_64' or platform_python_implementation == 'CPython' \ + --hash=sha256:18cb1b7337bca281915b3c5d5ae19f4e76d35e1df80f4ad3c1a7be91fadf1082 \ + --hash=sha256:1fb39a11ee2e4d94be9a76671482be9398560955c9e568550de0224e41104727 \ + --hash=sha256:20154044d9085151bc309e7689d6f7ba10027f8f5a8c0676ad398b951913d89e \ + --hash=sha256:2eaf067fc6d886931c7962e8c6bede15d2f01965560f3359b27c80bde2d151f2 \ + --hash=sha256:59b3e2c40f6706b05a9cd299c836c6aa2378cabe25d021acd80f13abf81181cf \ + --hash=sha256:63d10328839d1973e5ba35e98cccbca71b232b14051fd957b6f8b6e8e80d0506 \ + --hash=sha256:8b466dff7a4ffda6ca975979bab80bdadde979e29fc947ac3be4451428d8b0e4 \ + --hash=sha256:8c4dd0f3997cf2512f7601563cc90dfb8957c0cff1e3a1b23991d4ea1776c492 \ + --hash=sha256:8d1658d7291f9859beed69a776c10822a0a799bc4bfe1bd4272bb60e62507dab \ + --hash=sha256:8e4ab3cfb02993c8cc248ea73d7dae6cec0253e9afa311c9b37e603ca9fad2ce \ + --hash=sha256:94ad81f0fd3c0c0681a018a976e5c2bd2ca2d9d94895f23e7bb1af4e8af4e2d5 \ + --hash=sha256:b26b0f4428b871a751968285a1ac9648944cea09807177ac639b030bddebcea4 \ + --hash=sha256:b8bddc5b73c9720bea487b3bffdb1840fe4e3656fba3bd40aa1489e9f37877ff \ + --hash=sha256:c04c5e06ec3e022cbfe2cd4a846e1d4e50087444f875ff6d2c2ad8445495cf1a \ + --hash=sha256:c2e47408e8ce1c6f1ceea0dffcdf6ebb85cc09e55c7af407c99f1112016e45e9 \ + --hash=sha256:cd6f9e2bbd46321ba3bbb4c8a15794d32960e3b0ae2cc4d49a1a53d314805d71 \ + --hash=sha256:e26e72bec7ab387ac80caa7496e0f908ff954f31065b0ffc1f8ecb1338b11b54 \ + --hash=sha256:e3cb43ce200f59483eb82949bf1835a99cf43d7571e900d7c8d5c62cdf25d2f9 + # via + # gevent + # sqlalchemy +gunicorn==25.2.0 \ + --hash=sha256:10bd7adb36d44945d97d0a1fdf9a0fb086ae9c7b39e56b4dece8555a6bf4a09c \ + --hash=sha256:88f5b444d0055bf298435384af7294f325e2273fd37ba9f9ff7b98e0a1e5dfdc + # via queue-api +h11==0.16.0 \ + --hash=sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1 \ + --hash=sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86 + # via wsproto +idna==3.11 \ + --hash=sha256:771a87f49d9defaf64091e6e6fe9c18d4833f140bd19464795bc32d966ca37ea \ + --hash=sha256:795dafcc9c04ed0c1fb032c2aa73654d8e8c5023a7df64a53f39190ada629902 + # via requests +importlib-resources==6.5.2 \ + --hash=sha256:185f87adef5bcc288449d98fb4fba07cea78bc036455dd44c5fc4a2fe78fed2c \ + --hash=sha256:789cfdc3ed28c78b67a06acb8126751ced69a3d5f79c095a98298cd8a760ccec + # via flask-restx +iniconfig==2.3.0 \ + --hash=sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730 \ + --hash=sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12 + # via pytest +isort==8.0.1 \ + --hash=sha256:171ac4ff559cdc060bcfff550bc8404a486fee0caab245679c2abe7cb253c78d \ + --hash=sha256:28b89bc70f751b559aeca209e6120393d43fbe2490de0559662be7a9787e3d75 + # via pylint +itsdangerous==2.2.0 \ + --hash=sha256:c6242fc49e35958c8b15141343aa660db5fc54d4f13a1db01a3f5891b98700ef \ + --hash=sha256:e0050c0b7da1eea53ffaf149c0cfbb5c6e2e2b69c4bef22c81fa6eb73e5f6173 + # via flask +jinja2==3.1.6 \ + --hash=sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d \ + --hash=sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67 + # via + # flask + # flask-admin + # flask-socketio + # queue-api +jsonschema==4.26.0 \ + --hash=sha256:0c26707e2efad8aa1bfc5b7ce170f3fccc2e4918ff85989ba9ffa9facb2be326 \ + --hash=sha256:d489f15263b8d200f8387e64b4c3a75f06629559fb73deb8fdfb525f2dab50ce + # via flask-restx +jsonschema-specifications==2025.9.1 \ + --hash=sha256:98802fee3a11ee76ecaca44429fda8a41bff98b00a0f2838151b113f210cc6fe \ + --hash=sha256:b540987f239e745613c7a9176f3edb72b832a4ac465cf02712288397832b5e8d + # via jsonschema +kombu==5.6.2 \ + --hash=sha256:8060497058066c6f5aed7c26d7cd0d3b574990b09de842a8c5aaed0b92cc5a55 \ + --hash=sha256:efcfc559da324d41d61ca311b0c64965ea35b4c55cc04ee36e55386145dace93 + # via queue-api +mako==1.3.10 \ + --hash=sha256:99579a6f39583fa7e5630a28c3c1f440e4e97a414b80372649c0ce338da2ea28 \ + --hash=sha256:baef24a52fc4fc514a0887ac600f9f1cff3d82c61d4d700a1fa84d597b88db59 + # via alembic +markupsafe==3.0.3 \ + --hash=sha256:0eb9ff8191e8498cca014656ae6b8d61f39da5f95b488805da4bb029cccbfbaf \ + --hash=sha256:1085e7fbddd3be5f89cc898938f42c0b3c711fdcb37d75221de2666af647c175 \ + --hash=sha256:1353ef0c1b138e1907ae78e2f6c63ff67501122006b0f9abad68fda5f4ffc6ab \ + --hash=sha256:1b52b4fb9df4eb9ae465f8d0c228a00624de2334f216f178a995ccdcf82c4634 \ + --hash=sha256:2713baf880df847f2bece4230d4d094280f4e67b1e813eec43b4c0e144a34ffe \ + --hash=sha256:32001d6a8fc98c8cb5c947787c5d08b0a50663d139f1305bac5885d98d9b40fa \ + --hash=sha256:457a69a9577064c05a97c41f4e65148652db078a3a509039e64d3467b9e7ef97 \ + --hash=sha256:4faffd047e07c38848ce017e8725090413cd80cbc23d86e55c587bf979e579c9 \ + --hash=sha256:5678211cb9333a6468fb8d8be0305520aa073f50d17f089b5b4b477ea6e67fdc \ + --hash=sha256:5a7d5dc5140555cf21a6fefbdbf8723f06fcd2f63ef108f2854de715e4422cb4 \ + --hash=sha256:722695808f4b6457b320fdc131280796bdceb04ab50fe1795cd540799ebe1698 \ + --hash=sha256:729586769a26dbceff69f7a7dbbf59ab6572b99d94576a5592625d5b411576b9 \ + --hash=sha256:915c04ba3851909ce68ccc2b8e2cd691618c4dc4c4232fb7982bca3f41fd8c3d \ + --hash=sha256:bdc919ead48f234740ad807933cdf545180bfbe9342c2bb451556db2ed958581 \ + --hash=sha256:c47a551199eb8eb2121d4f0f15ae0f923d31350ab9280078d1e5f12b249e0026 \ + --hash=sha256:e56b7d45a839a697b5eb268c82a71bd8c7f6c94d6fd50c3d577fa39a9f1409f5 \ + --hash=sha256:e8afc3f2ccfa24215f8cb28dcf43f0113ac3c37c2f0f0806d8c70e4228c5cf4d \ + --hash=sha256:eaa9599de571d72e2daf60164784109f19978b327a3910d3e9de8c97b5b70cfe \ + --hash=sha256:ec15a59cf5af7be74194f7ab02d0f59a62bdcf1a537677ce67a2537c9b87fcda \ + --hash=sha256:f190daf01f13c72eac4efd5c430a8de82489d9cff23c364c3ea822545032993e \ + --hash=sha256:f34c41761022dd093b4b6896d4810782ffbabe30f2d443ff5f083e0cbbb8c737 \ + --hash=sha256:f3e98bb3798ead92273dc0e5fd0f31ade220f59a266ffd8a4f6065e0a3ce0523 \ + --hash=sha256:fed51ac40f757d41b7c48425901843666a6677e3e8eb0abcff09e4ba6e664f50 + # via + # flask + # flask-admin + # jinja2 + # mako + # queue-api + # werkzeug + # wtforms +marshmallow==4.2.3 \ + --hash=sha256:3e3fef6b3603721a25a723b8caedfa488369bddaf9bc03b40b9442c90aebd22b \ + --hash=sha256:c84fd89817ecea690bde1eb925036070e5e9883148217585adc56d5cfbc082b8 + # via + # flask-marshmallow + # marshmallow-sqlalchemy + # queue-api +marshmallow-sqlalchemy==1.4.2 \ + --hash=sha256:6410304bf98ec26ea35f3f9d3cee82e51fd093c434612add32a0bdcdb5668f7c \ + --hash=sha256:65aee301c4601e76a2fdb02764a65c18913afba2a3506a326c625d13ab405b40 + # via queue-api +mccabe==0.7.0 \ + --hash=sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325 \ + --hash=sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e + # via pylint +minio==7.2.20 \ + --hash=sha256:95898b7a023fbbfde375985aa77e2cd6a0762268db79cf886f002a9ea8e68598 \ + --hash=sha256:eb33dd2fb80e04c3726a76b13241c6be3c4c46f8d81e1d58e757786f6501897e + # via queue-api +packaging==26.0 \ + --hash=sha256:00243ae351a257117b6a241061796684b084ed1c516a08c48a3f7e147a9d80b4 \ + --hash=sha256:b36f1fef9334a5588b4166f8bcd26a14e521f2b55e6b9de3aaa80d3ff7a37529 + # via + # gunicorn + # kombu + # pytest +platformdirs==4.9.4 \ + --hash=sha256:1ec356301b7dc906d83f371c8f487070e99d3ccf9e501686456394622a01a934 \ + --hash=sha256:68a9a4619a666ea6439f2ff250c12a853cd1cbd5158d258bd824a7df6be2f868 + # via pylint +pluggy==1.6.0 \ + --hash=sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3 \ + --hash=sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746 + # via + # pytest + # pytest-cov +psycopg2-binary==2.9.11 \ + --hash=sha256:32770a4d666fbdafab017086655bcddab791d7cb260a16679cc5a7338b64343b \ + --hash=sha256:4012c9c954dfaccd28f94e84ab9f94e12df76b4afb22331b1f0d3154893a6316 \ + --hash=sha256:47f212c1d3be608a12937cc131bd85502954398aaa1320cb4c14421a0ffccf4c \ + --hash=sha256:92e3b669236327083a2e33ccfa0d320dd01b9803b3e14dd986a4fc54aa00f4e1 \ + --hash=sha256:9b52a3f9bb540a3e4ec0f6ba6d31339727b2950c9772850d6545b7eae0b9d7c5 \ + --hash=sha256:9bd81e64e8de111237737b29d68039b9c813bdf520156af36d26819c9a979e5f \ + --hash=sha256:b6aed9e096bf63f9e75edf2581aa9a7e7186d97ab5c177aa6c87797cd591236c \ + --hash=sha256:c3cb3a676873d7506825221045bd70e0427c905b9c8ee8d6acd70cfcbd6e576d \ + --hash=sha256:db4fd476874ccfdbb630a54426964959e58da4c61c9feba73e6094d51303d7d8 \ + --hash=sha256:e0deeb03da539fa3577fcb0b3f2554a97f7e5477c246098dbb18091a4a01c16f \ + --hash=sha256:e35b7abae2b0adab776add56111df1735ccc71406e56203515e228a8dc07089f \ + --hash=sha256:fcf21be3ce5f5659daefd2b3b3b6e4727b028221ddc94e6c1523425579664747 + # via queue-api +pyasn1==0.6.3 \ + --hash=sha256:697a8ecd6d98891189184ca1fa05d1bb00e2f84b5977c481452050549c8a72cf \ + --hash=sha256:a80184d120f0864a52a073acc6fc642847d0be408e7c7252f31390c0f4eadcde + # via + # python-jose + # rsa +pycparser==3.0 ; implementation_name != 'PyPy' \ + --hash=sha256:600f49d217304a5902ac3c37e1281c9fe94e4d0489de643a9504c5cdfdfc6b29 \ + --hash=sha256:b727414169a36b7d524c1c3e31839a521725078d7b2ff038656844266160a992 + # via cffi +pycryptodome==3.23.0 \ + --hash=sha256:11eeeb6917903876f134b56ba11abe95c0b0fd5e3330def218083c7d98bbcb3c \ + --hash=sha256:156df9667ad9f2ad26255926524e1c136d6664b741547deb0a86a9acf5ea631f \ + --hash=sha256:187058ab80b3281b1de11c2e6842a357a1f71b42cb1e15bce373f3d238135c27 \ + --hash=sha256:447700a657182d60338bab09fdb27518f8856aecd80ae4c6bdddb67ff5da44ef \ + --hash=sha256:507dbead45474b62b2bbe318eb1c4c8ee641077532067fec9c1aa82c31f84886 \ + --hash=sha256:53ecbafc2b55353edcebd64bf5da94a2a2cdf5090a6915bcca6eca6cc452585a \ + --hash=sha256:67bd81fcbe34f43ad9422ee8fd4843c8e7198dd88dd3d40e6de42ee65fbe1490 \ + --hash=sha256:aa0698f65e5b570426fc31b8162ed4603b0c2841cbb9088e2b01641e3065915b \ + --hash=sha256:c75b52aacc6c0c260f204cbdd834f76edc9fb0d8e0da9fbf8352ef58202564e2 \ + --hash=sha256:c8987bd3307a39bc03df5c8e0e3d8be0c4c3518b7f044b0f4c15d1aa78f52575 \ + --hash=sha256:cfb5cd445280c5b0a4e6187a7ce8de5a07b5f3f897f235caa11f1f435f182843 \ + --hash=sha256:dea827b4d55ee390dc89b2afe5927d4308a8b538ae91d9c6f7a5090f397af1aa + # via minio +pygments==2.19.2 \ + --hash=sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887 \ + --hash=sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b + # via pytest +pyjwt==2.12.1 \ + --hash=sha256:28ca37c070cad8ba8cd9790cd940535d40274d22f80ab87f3ac6a713e6e8454c \ + --hash=sha256:c74a7a2adf861c04d002db713dd85f84beb242228e671280bf709d765b03672b + # via flask-jwt-oidc +pylint==4.0.5 \ + --hash=sha256:00f51c9b14a3b3ae08cff6b2cdd43f28165c78b165b628692e428fb1f8dc2cf2 \ + --hash=sha256:8cd6a618df75deb013bd7eb98327a95f02a6fb839205a6bbf5456ef96afb317c +pytest==9.0.2 \ + --hash=sha256:711ffd45bf766d5264d487b917733b453d917afd2b0ad65223959f59089f875b \ + --hash=sha256:75186651a92bd89611d1d9fc20f0b4345fd827c41ccd5c299a868a05d70edf11 + # via pytest-cov +pytest-cov==7.1.0 \ + --hash=sha256:30674f2b5f6351aa09702a9c8c364f6a01c27aae0c1366ae8016160d1efc56b2 \ + --hash=sha256:a0461110b7865f9a271aa1b51e516c9a95de9d696734a2f71e3e78f46e1d4678 +python-dateutil==2.9.0.post0 \ + --hash=sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3 \ + --hash=sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427 + # via queue-api +python-dotenv==1.2.2 \ + --hash=sha256:1d8214789a24de455a8b8bd8ae6fe3c6b69a5e3d64aa8a8e5d68e694bbcb285a \ + --hash=sha256:2c371a91fbd7ba082c2c1dc1f8bf89ca22564a087c2c287cd9b662adde799cf3 + # via queue-api +python-engineio==4.13.1 \ + --hash=sha256:0a853fcef52f5b345425d8c2b921ac85023a04dfcf75d7b74696c61e940fd066 \ + --hash=sha256:f32ad10589859c11053ad7d9bb3c9695cdf862113bfb0d20bc4d890198287399 + # via python-socketio +python-jose==3.5.0 \ + --hash=sha256:abd1202f23d34dfad2c3d28cb8617b90acf34132c7afd60abd0b0b7d3cb55771 \ + --hash=sha256:fb4eaa44dbeb1c26dcc69e4bd7ec54a1cb8dd64d3b4d81ef08d90ff453f2b01b + # via queue-api +python-socketio==5.16.1 \ + --hash=sha256:a3eb1702e92aa2f2b5d3ba00261b61f062cce51f1cfb6900bf3ab4d1934d2d35 \ + --hash=sha256:f863f98eacce81ceea2e742f6388e10ca3cdd0764be21d30d5196470edf5ea89 + # via flask-socketio +redis==7.4.0 \ + --hash=sha256:64a6ea7bf567ad43c964d2c30d82853f8df927c5c9017766c55a1d1ed95d18ad \ + --hash=sha256:a9c74a5c893a5ef8455a5adb793a31bb70feb821c86eccb62eebef5a19c429ec + # via queue-api +referencing==0.37.0 \ + --hash=sha256:381329a9f99628c9069361716891d34ad94af76e461dcb0335825aecc7692231 \ + --hash=sha256:44aefc3142c5b842538163acb373e24cce6632bd54bdb01b21ad5863489f50d8 + # via + # flask-restx + # jsonschema + # jsonschema-specifications +requests==2.33.0 \ + --hash=sha256:3324635456fa185245e24865e810cecec7b4caf933d7eb133dcde67d48cee69b \ + --hash=sha256:c7ebc5e8b0f21837386ad0e1c8fe8b829fa5f544d8df3b2253bff14ef29d7652 + # via + # queue-api + # snowplow-tracker +rpds-py==0.30.0 \ + --hash=sha256:0d08f00679177226c4cb8c5265012eea897c8ca3b93f429e546600c971bcbae7 \ + --hash=sha256:0ed177ed9bded28f8deb6ab40c183cd1192aa0de40c12f38be4d59cd33cb5c65 \ + --hash=sha256:27f4b0e92de5bfbc6f86e43959e6edd1425c33b5e69aab0984a72047f2bcf1e3 \ + --hash=sha256:3e62880792319dbeb7eb866547f2e35973289e7d5696c6e295476448f5b63c87 \ + --hash=sha256:3e8eeb0544f2eb0d2581774be4c3410356eba189529a6b3e36bbbf9696175856 \ + --hash=sha256:4559c972db3a360808309e06a74628b95eaccbf961c335c8fe0d590cf587456f \ + --hash=sha256:46e83c697b1f1c72b50e5ee5adb4353eef7406fb3f2043d64c33f20ad1c2fc53 \ + --hash=sha256:47e77dc9822d3ad616c3d5759ea5631a75e5809d5a28707744ef79d7a1bcfcad \ + --hash=sha256:4e7fc54e0900ab35d041b0601431b0a0eb495f0851a0639b6ef90f7741b39a18 \ + --hash=sha256:5965af57d5848192c13534f90f9dd16464f3c37aaf166cc1da1cae1fd5a34898 \ + --hash=sha256:613aa4771c99f03346e54c3f038e4cc574ac09a3ddfb0e8878487335e96dead6 \ + --hash=sha256:626a7433c34566535b6e56a1b39a7b17ba961e97ce3b80ec62e6f1312c025551 \ + --hash=sha256:68f19c879420aa08f61203801423f6cd5ac5f0ac4ac82a2368a9fcd6a9a075e0 \ + --hash=sha256:74a3243a411126362712ee1524dfc90c650a503502f135d54d1b352bd01f2404 \ + --hash=sha256:7e6ecfcb62edfd632e56983964e6884851786443739dbfe3582947e87274f7cb \ + --hash=sha256:95f0802447ac2d10bcc69f6dc28fe95fdf17940367b21d34e34c737870758950 \ + --hash=sha256:9a4e86e34e9ab6b667c27f3211ca48f73dba7cd3d90f8d5b11be56e5dbc3fb4e \ + --hash=sha256:a1d0bc22a7cdc173fedebb73ef81e07faef93692b8c1ad3733b67e31e1b6e1b8 \ + --hash=sha256:ac98b175585ecf4c0348fd7b29c3864bda53b805c773cbf7bfdaffc8070c976f \ + --hash=sha256:acd7eb3f4471577b9b5a41baf02a978e8bdeb08b4b355273994f8b87032000a8 \ + --hash=sha256:ad1fa8db769b76ea911cb4e10f049d80bf518c104f15b3edb2371cc65375c46f \ + --hash=sha256:b4dc1a6ff022ff85ecafef7979a2c6eb423430e05f1165d6688234e62ba99a07 \ + --hash=sha256:dbd936cde57abfee19ab3213cf9c26be06d60750e60a8e4dd85d1ab12c8b1f40 \ + --hash=sha256:dc824125c72246d924f7f796b4f63c1e9dc810c7d9e2355864b3c3a73d59ade0 \ + --hash=sha256:dd8ff7cf90014af0c0f787eea34794ebf6415242ee1d6fa91eaba725cc441e84 \ + --hash=sha256:e5d3e6b26f2c785d65cc25ef1e5267ccbe1b069c5c21b8cc724efee290554419 \ + --hash=sha256:ec7c4490c672c1a0389d319b3a9cfcd098dcdc4783991553c332a15acf7249be \ + --hash=sha256:ee454b2a007d57363c2dfd5b6ca4a5d7e2c518938f8ed3b706e37e5d470801ed \ + --hash=sha256:f251c812357a3fed308d684a5079ddfb9d933860fc6de89f2b7ab00da481e65f \ + --hash=sha256:fe5fa731a1fa8a0a56b0977413f8cacac1768dad38d16b3a296712709476fbd5 + # via + # jsonschema + # referencing +rsa==4.9.1 \ + --hash=sha256:68635866661c6836b8d39430f97a996acbd61bfa49406748ea243539fe239762 \ + --hash=sha256:e7bdbfdb5497da4c07dfd35530e1a902659db6ff241e39d9953cad06ebd0ae75 + # via python-jose +ruff==0.15.8 \ + --hash=sha256:04f79eff02a72db209d47d665ba7ebcad609d8918a134f86cb13dd132159fc89 \ + --hash=sha256:0f29b989a55572fb885b77464cf24af05500806ab4edf9a0fd8977f9759d85b1 \ + --hash=sha256:12e617fc01a95e5821648a6df341d80456bd627bfab8a829f7cfc26a14a4b4a3 \ + --hash=sha256:2033f963c43949d51e6fdccd3946633c6b37c484f5f98c3035f49c27395a8ab8 \ + --hash=sha256:432701303b26416d22ba696c39f2c6f12499b89093b61360abc34bcc9bf07762 \ + --hash=sha256:6ee3ae5c65a42f273f126686353f2e08ff29927b7b7e203b711514370d500de3 \ + --hash=sha256:75e5cd06b1cf3f47a3996cfc999226b19aa92e7cce682dcd62f80d7035f98f49 \ + --hash=sha256:8d9a5b8ea13f26ae90838afc33f91b547e61b794865374f114f349e9036835fb \ + --hash=sha256:995f11f63597ee362130d1d5a327a87cb6f3f5eae3094c620bcc632329a4d26e \ + --hash=sha256:ac51d486bf457cdc985a412fb1801b2dfd1bd8838372fc55de64b1510eff4bec \ + --hash=sha256:bc1f0a51254ba21767bfa9a8b5013ca8149dcf38092e6a9eb704d876de94dc34 \ + --hash=sha256:c2a33a529fb3cbc23a7124b5c6ff121e4d6228029cba374777bd7649cc8598b8 \ + --hash=sha256:c9861eb959edab053c10ad62c278835ee69ca527b6dcd72b47d5c1e5648964f6 \ + --hash=sha256:cbe05adeba76d58162762d6b239c9056f1a15a55bd4b346cfd21e26cd6ad7bc7 \ + --hash=sha256:cf891fa8e3bb430c0e7fac93851a5978fc99c8fa2c053b57b118972866f8e5f2 \ + --hash=sha256:d3e3d0b6ba8dca1b7ef9ab80a28e840a20070c4b62e56d675c24f366ef330570 \ + --hash=sha256:d910ae974b7a06a33a057cb87d2a10792a3b2b3b35e33d2699fdf63ec8f6b17a \ + --hash=sha256:fdce027ada77baa448077ccc6ebb2fa9c3c62fd110d8659d601cf2f475858d94 +simple-websocket==1.1.0 \ + --hash=sha256:4af6069630a38ed6c561010f0e11a5bc0d4ca569b36306eb257cd9a192497c8c \ + --hash=sha256:7939234e7aa067c534abdab3a9ed933ec9ce4691b0713c78acb195560aa52ae4 + # via python-engineio +six==1.17.0 \ + --hash=sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274 \ + --hash=sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81 + # via + # ecdsa + # python-dateutil +snowplow-tracker==1.1.0 \ + --hash=sha256:24ea32ddac9cca547421bf9ab162f5f33c00711c6ef118ad5f78093cee962224 \ + --hash=sha256:95d8fdc8bd542fd12a0b9a076852239cbaf0599eda8721deaf5f93f7138fe755 + # via queue-api +sqlalchemy==2.0.48 \ + --hash=sha256:1182437cb2d97988cfea04cf6cdc0b0bb9c74f4d56ec3d08b81e23d621a28cc6 \ + --hash=sha256:144921da96c08feb9e2b052c5c5c1d0d151a292c6135623c6b2c041f2a45f9e0 \ + --hash=sha256:288937433bd44e3990e7da2402fabc44a3c6c25d3704da066b85b89a85474ae0 \ + --hash=sha256:426c5ca86415d9b8945c7073597e10de9644802e2ff502b8e1f11a7a2642856b \ + --hash=sha256:49b7bddc1eebf011ea5ab722fdbe67a401caa34a350d278cc7733c0e88fecb1f \ + --hash=sha256:5aee45fd2c6c0f2b9cdddf48c48535e7471e42d6fb81adfde801da0bd5b93241 \ + --hash=sha256:5ca74f37f3369b45e1f6b7b06afb182af1fd5dde009e4ffd831830d98cbe5fe7 \ + --hash=sha256:7a936f1bb23d370b7c8cc079d5fce4c7d18da87a33c6744e51a93b0f9e97e9b3 \ + --hash=sha256:7cddca31edf8b0653090cbb54562ca027c421c58ddde2c0685f49ff56a1690e0 \ + --hash=sha256:8183dc57ae7d9edc1346e007e840a9f3d6aa7b7f165203a99e16f447150140d2 \ + --hash=sha256:a66fe406437dd65cacd96a72689a3aaaecaebbcd62d81c5ac1c0fdbeac835096 \ + --hash=sha256:b8438ec5594980d405251451c5b7ea9aa58dda38eb7ac35fb7e4c696712ee24f \ + --hash=sha256:d854b3970067297f3a7fbd7a4683587134aa9b3877ee15aa29eea478dc68f933 \ + --hash=sha256:e004aa9248e8cb0a5f9b96d003ca7c1c0a5da8decd1066e7b53f59eb8ce7c62b \ + --hash=sha256:e2d0d88686e3d35a76f3e15a34e8c12d73fc94c1dea1cd55782e695cc14086dd + # via + # alembic + # flask-sqlalchemy + # marshmallow-sqlalchemy + # queue-api +tomlkit==0.14.0 \ + --hash=sha256:592064ed85b40fa213469f81ac584f67a4f2992509a7c3ea2d632208623a3680 \ + --hash=sha256:cf00efca415dbd57575befb1f6634c4f42d2d87dbba376128adb42c121b87064 + # via pylint +typing-extensions==4.15.0 \ + --hash=sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466 \ + --hash=sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548 + # via + # alembic + # minio + # snowplow-tracker + # sqlalchemy +tzdata==2025.3 \ + --hash=sha256:06a47e5700f3081aab02b2e513160914ff0694bce9947d6b76ebd6bf57cfc5d1 \ + --hash=sha256:de39c2ca5dc7b0344f2eba86f49d614019d29f060fc4ebc8a417896a620b56a7 + # via kombu +urllib3==2.6.3 \ + --hash=sha256:1b62b6884944a57dbe321509ab94fd4d3b307075e0c2eae991ac71ee15ad38ed \ + --hash=sha256:bf272323e553dfb2e87d9bfd225ca7b0f467b919d7bbd355436d3fd37cb0acd4 + # via + # minio + # requests +vine==5.1.0 \ + --hash=sha256:40fdf3c48b2cfe1c38a49e9ae2da6fda88e4794c810050a728bd7413811fb1dc \ + --hash=sha256:8b62e981d35c41049211cf62a0a1242d8c1ee9bd15bb196ce38aefd6799e61e0 + # via + # amqp + # kombu +werkzeug==3.1.7 \ + --hash=sha256:4b314d81163a3e1a169b6a0be2a000a0e204e8873c5de6586f453c55688d422f \ + --hash=sha256:fb8c01fe6ab13b9b7cdb46892b99b1d66754e1d7ab8e542e865ec13f526b5351 + # via + # flask + # flask-admin + # flask-cors + # flask-login + # flask-restx + # flask-socketio +wsproto==1.3.2 \ + --hash=sha256:61eea322cdf56e8cc904bd3ad7573359a242ba65688716b0710a5eb12beab584 \ + --hash=sha256:b86885dcf294e15204919950f666e06ffc6c7c114ca900b060d6e16293528294 + # via simple-websocket +wtforms==3.2.1 \ + --hash=sha256:583bad77ba1dd7286463f21e11aa3043ca4869d03575921d1a1698d0715e0fd4 \ + --hash=sha256:df3e6b70f3192e92623128123ec8dca3067df9cfadd43d59681e210cfb8d4682 + # via + # flask-admin + # queue-api +zope-event==6.1 \ + --hash=sha256:0ca78b6391b694272b23ec1335c0294cc471065ed10f7f606858fc54566c25a0 \ + --hash=sha256:6052a3e0cb8565d3d4ef1a3a7809336ac519bc4fe38398cb8d466db09adef4f0 + # via gevent +zope-interface==8.2 \ + --hash=sha256:05a0e42d6d830f547e114de2e7cd15750dc6c0c78f8138e6c5035e51ddfff37c \ + --hash=sha256:46c7e4e8cbc698398a67e56ca985d19cb92365b4aafbeb6a712e8c101090f4cb \ + --hash=sha256:561ce42390bee90bae51cf1c012902a8033b2aaefbd0deed81e877562a116d48 \ + --hash=sha256:a87fc7517f825a97ff4a4ca4c8a950593c59e0f8e7bfe1b6f898a38d5ba9f9cf \ + --hash=sha256:aae807efc7bd26302eb2fea05cd6de7d59269ed6ae23a6de1ee47add6de99b8c \ + --hash=sha256:afb20c371a601d261b4f6edb53c3c418c249db1a9717b0baafc9a9bb39ba1224 \ + --hash=sha256:ccf52f7d44d669203c2096c1a0c2c15d52e36b2e7a9413df50f48392c7d4d080 + # via gevent diff --git a/api/requirements_dev.txt b/api/requirements_dev.txt old mode 100755 new mode 100644 index 47890fc16..8881f4d73 --- a/api/requirements_dev.txt +++ b/api/requirements_dev.txt @@ -1,18 +1,736 @@ -# Copyright 2022 Province of British Columbia -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. - -# Requirements for dev: everything deployed plus dev tools. - --r requirements.txt -pylint==2.7.2 +# This file was autogenerated by uv via the following command: +# uv export --frozen --format requirements-txt --no-emit-project --group dev --output-file requirements_dev.txt +alembic==1.18.4 \ + --hash=sha256:a5ed4adcf6d8a4cb575f3d759f071b03cd6e5c7618eb796cb52497be25bfe19a \ + --hash=sha256:cb6e1fd84b6174ab8dbb2329f86d631ba9559dd78df550b57804d607672cedbc + # via + # flask-migrate + # queue-api +amqp==5.3.1 \ + --hash=sha256:43b3319e1b4e7d1251833a93d672b4af1e40f3d632d479b98661a95f117880a2 \ + --hash=sha256:cddc00c725449522023bad949f70fff7b48f0b1ade74d170a6f10ab044739432 + # via + # kombu + # queue-api +aniso8601==10.0.1 \ + --hash=sha256:25488f8663dd1528ae1f54f94ac1ea51ae25b4d531539b8bc707fed184d16845 \ + --hash=sha256:eb19717fd4e0db6de1aab06f12450ab92144246b257423fe020af5748c0cb89e + # via flask-restx +argon2-cffi==25.1.0 \ + --hash=sha256:694ae5cc8a42f4c4e2bf2ca0e64e51e23a040c6a517a85074683d3959e1346c1 \ + --hash=sha256:fdc8b074db390fccb6eb4a3604ae7231f219aa669a2652e0f20e16ba513d5741 + # via minio +argon2-cffi-bindings==25.1.0 \ + --hash=sha256:1db89609c06afa1a214a69a462ea741cf735b29a57530478c06eb81dd403de99 \ + --hash=sha256:1e021e87faa76ae0d413b619fe2b65ab9a037f24c60a1e6cc43457ae20de6dc6 \ + --hash=sha256:2630b6240b495dfab90aebe159ff784d08ea999aa4b0d17efa734055a07d2f44 \ + --hash=sha256:3c6702abc36bf3ccba3f802b799505def420a1b7039862014a65db3205967f5a \ + --hash=sha256:3d3f05610594151994ca9ccb3c771115bdb4daef161976a266f0dd8aa9996b8f \ + --hash=sha256:473bcb5f82924b1becbb637b63303ec8d10e84c8d241119419897a26116515d2 \ + --hash=sha256:7aef0c91e2c0fbca6fc68e7555aa60ef7008a739cbe045541e438373bc54d2b0 \ + --hash=sha256:84a461d4d84ae1295871329b346a97f68eade8c53b6ed9a7ca2d7467f3c8ff6f \ + --hash=sha256:87c33a52407e4c41f3b70a9c2d3f6056d88b10dad7695be708c5021673f55623 \ + --hash=sha256:8b8efee945193e667a396cbc7b4fb7d357297d6234d30a489905d96caabde56b \ + --hash=sha256:a1c70058c6ab1e352304ac7e3b52554daadacd8d453c1752e547c76e9c99ac44 \ + --hash=sha256:a98cd7d17e9f7ce244c0803cad3c23a7d379c301ba618a5fa76a67d116618b98 \ + --hash=sha256:aecba1723ae35330a008418a91ea6cfcedf6d31e5fbaa056a166462ff066d500 \ + --hash=sha256:b0fdbcf513833809c882823f98dc2f931cf659d9a1429616ac3adebb49f5db94 \ + --hash=sha256:b55aec3565b65f56455eebc9b9f34130440404f27fe21c3b375bf1ea4d8fbae6 \ + --hash=sha256:b957f3e6ea4d55d820e40ff76f450952807013d361a65d7f28acc0acbf29229d \ + --hash=sha256:ba92837e4a9aa6a508c8d2d7883ed5a8f6c308c89a4790e1e447a220deb79a85 \ + --hash=sha256:c4f9665de60b1b0e99bcd6be4f17d90339698ce954cfd8d9cf4f91c995165a92 \ + --hash=sha256:c87b72589133f0346a1cb8d5ecca4b933e3c9b64656c9d175270a000e73b288d \ + --hash=sha256:d3e924cfc503018a714f94a49a149fdc0b644eaead5d1f089330399134fa028a \ + --hash=sha256:e2fd3bfbff3c5d74fef31a722f729bf93500910db650c925c2d6ef879a7e51cb + # via argon2-cffi +astroid==4.0.4 \ + --hash=sha256:52f39653876c7dec3e3afd4c2696920e05c83832b9737afc21928f2d2eb7a753 \ + --hash=sha256:986fed8bcf79fb82c78b18a53352a0b287a73817d6dbcfba3162da36667c49a0 + # via pylint +attrs==26.1.0 \ + --hash=sha256:c647aa4a12dfbad9333ca4e71fe62ddc36f4e63b2d260a37a8b83d2f043ac309 \ + --hash=sha256:d03ceb89cb322a8fd706d4fb91940737b6642aa36998fe130a9bc96c985eff32 + # via + # jsonschema + # referencing +bidict==0.23.1 \ + --hash=sha256:03069d763bc387bbd20e7d49914e75fc4132a41937fa3405417e1a5a2d006d71 \ + --hash=sha256:5dae8d4d79b552a71cbabc7deb25dfe8ce710b17ff41711e13010ead2abfc3e5 + # via python-socketio +blinker==1.9.0 \ + --hash=sha256:b4ce2265a7abece45e7cc896e98dbebe6cead56bcf805a3d23136d145f5445bf \ + --hash=sha256:ba0efaa9080b619ff2f3459d1d500c57bddea4a6b424b60a91141db6fd2f08bc + # via + # flask + # flask-socketio +brotli==1.2.0 ; platform_python_implementation != 'PyPy' \ + --hash=sha256:3219bd9e69868e57183316ee19c84e03e8f8b5a1d1f2667e1aa8c2f91cb061ac \ + --hash=sha256:6c12dad5cd04530323e723787ff762bac749a7b256a5bece32b2243dd5c27b21 \ + --hash=sha256:7547369c4392b47d30a3467fe8c3330b4f2e0f7730e45e3103d7d636678a808b \ + --hash=sha256:832c115a020e463c2f67664560449a7bea26b0c1fdd690352addad6d0a08714d \ + --hash=sha256:9322b9f8656782414b37e6af884146869d46ab85158201d82bab9abbcb971dc7 \ + --hash=sha256:963a08f3bebd8b75ac57661045402da15991468a621f014be54e50f53a58d19e \ + --hash=sha256:cf9cba6f5b78a2071ec6fb1e7bd39acf35071d90a81231d67e92d637776a6a63 \ + --hash=sha256:d2d085ded05278d1c7f65560aae97b3160aeb2ea2c0b3e26204856beccb60888 \ + --hash=sha256:e310f77e41941c13340a95976fe66a8a95b01e783d430eeaf7a2f87e0a57dd0a \ + --hash=sha256:e7c0af964e0b4e3412a0ebf341ea26ec767fa0b4cf81abb5e897c9338b5ad6a3 \ + --hash=sha256:fc1530af5c3c275b8524f2e24841cbe2599d74462455e9bae5109e9ff42e9361 + # via flask-compress +brotlicffi==1.2.0.1 ; platform_python_implementation == 'PyPy' \ + --hash=sha256:2c85e65913cf2b79c57a3fdd05b98d9731d9255dc0cb696b09376cc091b9cddd \ + --hash=sha256:3c9544f83cb715d95d7eab3af4adbbef8b2093ad6382288a83b3a25feb1a57ec \ + --hash=sha256:535f2d05d0273408abc13fc0eebb467afac17b0ad85090c8913690d40207dac5 \ + --hash=sha256:625f8115d32ae9c0740d01ea51518437c3fbaa3e78d41cb18459f6f7ac326000 \ + --hash=sha256:6f3314a3476f59e5443f9f72a6dff16edc0c3463c9b318feaef04ae3e4683f5a \ + --hash=sha256:82ea52e2b5d3145b6c406ebd3efb0d55db718b7ad996bd70c62cec0439de1187 \ + --hash=sha256:91ba5f0ccc040f6ff8f7efaf839f797723d03ed46acb8ae9408f99ffd2572cf4 \ + --hash=sha256:be9a670c6811af30a4bd42d7116dc5895d3b41beaa8ed8a89050447a0181f5ce \ + --hash=sha256:c20d5c596278307ad06414a6d95a892377ea274a5c6b790c2548c009385d621c \ + --hash=sha256:ce17eb798ca59ecec67a9bb3fd7a4304e120d1cd02953ce522d959b9a84d58ac \ + --hash=sha256:da2e82a08e7778b8bc539d27ca03cdd684113e81394bfaaad8d0dfc6a17ddede + # via flask-compress +cachelib==0.13.0 \ + --hash=sha256:209d8996e3c57595bee274ff97116d1d73c4980b2fd9a34c7846cd07fd2e1a48 \ + --hash=sha256:8c8019e53b6302967d4e8329a504acf75e7bc46130291d30188a6e4e58162516 + # via + # flask-caching + # flask-jwt-oidc +certifi==2026.2.25 \ + --hash=sha256:027692e4402ad994f1c42e52a4997a9763c646b73e4096e4d5d6db8af1d6f0fa \ + --hash=sha256:e887ab5cee78ea814d3472169153c2d12cd43b14bd03329a39a9c6e2e80bfba7 + # via + # minio + # requests +cffi==2.0.0 \ + --hash=sha256:087067fa8953339c723661eda6b54bc98c5625757ea62e95eb4898ad5e776e9f \ + --hash=sha256:0a1527a803f0a659de1af2e1fd700213caba79377e27e4693648c2923da066f9 \ + --hash=sha256:12873ca6cb9b0f0d3a0da705d6086fe911591737a59f28b7936bdfed27c0d47c \ + --hash=sha256:1fc9ea04857caf665289b7a75923f2c6ed559b8298a1b8c49e59f7dd95c8481e \ + --hash=sha256:203a48d1fb583fc7d78a4c6655692963b860a417c0528492a6bc21f1aaefab25 \ + --hash=sha256:24b6f81f1983e6df8db3adc38562c83f7d4a0c36162885ec7f7b77c7dcbec97b \ + --hash=sha256:28a3a209b96630bca57cce802da70c266eb08c6e97e5afd61a75611ee6c64592 \ + --hash=sha256:38100abb9d1b1435bc4cc340bb4489635dc2f0da7456590877030c9b3d40b0c1 \ + --hash=sha256:44d1b5909021139fe36001ae048dbdde8214afa20200eda0f64c068cac5d5529 \ + --hash=sha256:6c6c373cfc5c83a975506110d17457138c8c63016b563cc9ed6e056a82f13ce4 \ + --hash=sha256:737fe7d37e1a1bffe70bd5754ea763a62a066dc5913ca57e957824b72a85e205 \ + --hash=sha256:7553fb2090d71822f02c629afe6042c299edf91ba1bf94951165613553984512 \ + --hash=sha256:7a66c7204d8869299919db4d5069a82f1561581af12b11b3c9f48c584eb8743d \ + --hash=sha256:7cc09976e8b56f8cebd752f7113ad07752461f48a58cbba644139015ac24954c \ + --hash=sha256:92b68146a71df78564e4ef48af17551a5ddd142e5190cdf2c5624d0c3ff5b2e8 \ + --hash=sha256:9a67fc9e8eb39039280526379fb3a70023d77caec1852002b4da7e8b270c4dd9 \ + --hash=sha256:afb8db5439b81cf9c9d0c80404b60c3cc9c3add93e114dcae767f1477cb53775 \ + --hash=sha256:b1e74d11748e7e98e2f426ab176d4ed720a64412b6a15054378afdb71e0f37dc \ + --hash=sha256:c654de545946e0db659b3400168c9ad31b5d29593291482c43e3564effbcee13 \ + --hash=sha256:d68b6cef7827e8641e8ef16f4494edda8b36104d79773a334beaa1e3521430f6 \ + --hash=sha256:d9b97165e8aed9272a6bb17c01e3cc5871a594a446ebedc996e2397a1c1ea8ef \ + --hash=sha256:dbd5c7a25a7cb98f5ca55d258b103a2054f859a46ae11aaf23134f9cc0d356ad \ + --hash=sha256:fc33c5141b55ed366cfaad382df24fe7dcbc686de5be719b207bb248e3053dc5 + # via + # argon2-cffi-bindings + # brotlicffi + # cryptography + # gevent +charset-normalizer==3.4.6 \ + --hash=sha256:06a7e86163334edfc5d20fe104db92fcd666e5a5df0977cb5680a506fe26cc8e \ + --hash=sha256:0e901eb1049fdb80f5bd11ed5ea1e498ec423102f7a9b9e4645d5b8204ff2815 \ + --hash=sha256:172985e4ff804a7ad08eebec0a1640ece87ba5041d565fff23c8f99c1f389484 \ + --hash=sha256:197c1a244a274bb016dd8b79204850144ef77fe81c5b797dc389327adb552407 \ + --hash=sha256:1ae6b62897110aa7c79ea2f5dd38d1abca6db663687c0b1ad9aed6f6bae3d9d6 \ + --hash=sha256:22c6f0c2fbc31e76c3b8a86fba1a56eda6166e238c29cdd3d14befdb4a4e4815 \ + --hash=sha256:2a24157fa36980478dd1770b585c0f30d19e18f4fb0c47c13aa568f871718579 \ + --hash=sha256:419a9d91bd238052642a51938af8ac05da5b3343becde08d5cdeab9046df9ee1 \ + --hash=sha256:47955475ac79cc504ef2704b192364e51d0d473ad452caedd0002605f780101c \ + --hash=sha256:4be9f4830ba8741527693848403e2c457c16e499100963ec711b1c6f2049b7c7 \ + --hash=sha256:5273b9f0b5835ff0350c0828faea623c68bfa65b792720c453e22b25cc72930f \ + --hash=sha256:58c948d0d086229efc484fe2f30c2d382c86720f55cd9bc33591774348ad44e0 \ + --hash=sha256:5d11595abf8dd942a77883a39d81433739b287b6aa71620f15164f8096221b30 \ + --hash=sha256:74119174722c4349af9708993118581686f343adc1c8c9c007d59be90d077f3f \ + --hash=sha256:7504e9b7dc05f99a9bbb4525c67a2c155073b44d720470a148b34166a69c054e \ + --hash=sha256:79090741d842f564b1b2827c0b82d846405b744d31e84f18d7a7b41c20e473ff \ + --hash=sha256:7bda6eebafd42133efdca535b04ccb338ab29467b3f7bf79569883676fc628db \ + --hash=sha256:7edbed096e4a4798710ed6bc75dcaa2a21b68b6c356553ac4823c3658d53743a \ + --hash=sha256:7f9019c9cb613f084481bd6a100b12e1547cf2efe362d873c2e31e4035a6fa43 \ + --hash=sha256:87725cfb1a4f1f8c2fc9890ae2f42094120f4b44db9360be5d99a4c6b0e03a9e \ + --hash=sha256:947cf925bc916d90adba35a64c82aace04fa39b46b52d4630ece166655905a69 \ + --hash=sha256:95b52c68d64c1878818687a473a10547b3292e82b6f6fe483808fb1468e2f52f \ + --hash=sha256:9cc6e6d9e571d2f863fa77700701dae73ed5f78881efc8b3f9a4398772ff53e8 \ + --hash=sha256:ad8faf8df23f0378c6d527d8b0b15ea4a2e23c89376877c598c4870d1b2c7866 \ + --hash=sha256:b3694e3f87f8ac7ce279d4355645b3c878d24d1424581b46282f24b92f5a4ae2 \ + --hash=sha256:b4ff1d35e8c5bd078be89349b6f3a845128e685e751b6ea1169cf2160b344c4d \ + --hash=sha256:bbc8c8650c6e51041ad1be191742b8b421d05bbd3410f43fa2a00c8db87678e8 \ + --hash=sha256:ca0276464d148c72defa8bb4390cce01b4a0e425f3b50d1435aa6d7a18107602 \ + --hash=sha256:cd5e2801c89992ed8c0a3f0293ae83c159a60d9a5d685005383ef4caca77f2c4 \ + --hash=sha256:e1f6e2f00a6b8edb562826e4632e26d063ac10307e80f7461f7de3ad8ef3f077 \ + --hash=sha256:e5bcc1a1ae744e0bb59641171ae53743760130600da8db48cbb6e4918e186e4e \ + --hash=sha256:ef5960d965e67165d75b7c7ffc60a83ec5abfc5c11b764ec13ea54fbef8b4421 \ + --hash=sha256:f5ea69428fa1b49573eef0cc44a1d43bebd45ad0c611eb7d7eac760c7ae771bc \ + --hash=sha256:fcce033e4021347d80ed9c66dcf1e7b1546319834b74445f561d2e2221de5659 + # via requests +click==8.3.1 \ + --hash=sha256:12ff4785d337a1bb490bb7e9c2b1ee5da3112e94a8622f26a6c77f5d2fc6842a \ + --hash=sha256:981153a64e25f12d547d3426c367a4857371575ee7ad18df2a6183ab0545b2a6 + # via + # flask + # flask-socketio + # queue-api +colorama==0.4.6 ; sys_platform == 'win32' \ + --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ + --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 + # via + # click + # pylint + # pytest +coverage==7.13.5 \ + --hash=sha256:0b67af5492adb31940ee418a5a655c28e48165da5afab8c7fa6fd72a142f8740 \ + --hash=sha256:0cd9ed7a8b181775459296e402ca4fb27db1279740a24e93b3b41942ebe4b215 \ + --hash=sha256:10a0c37f0b646eaff7cce1874c31d1f1ccb297688d4c747291f4f4c70741cc8b \ + --hash=sha256:1b11eef33edeae9d142f9b4358edb76273b3bfd30bc3df9a4f95d0e49caf94e8 \ + --hash=sha256:2aa055ae1857258f9e0045be26a6d62bdb47a72448b62d7b55f4820f361a2633 \ + --hash=sha256:301e3b7dfefecaca37c9f1aa6f0049b7d4ab8dd933742b607765d757aca77d43 \ + --hash=sha256:32ca0c0114c9834a43f045a87dcebd69d108d8ffb666957ea65aa132f50332e2 \ + --hash=sha256:34b02417cf070e173989b3db962f7ed56d2f644307b2cf9d5a0f258e13084a61 \ + --hash=sha256:35a31f2b1578185fbe6aa2e74cea1b1d0bbf4c552774247d9160d29b80ed56cc \ + --hash=sha256:380e8e9084d8eb38db3a9176a1a4f3c0082c3806fa0dc882d1d87abc3c789247 \ + --hash=sha256:6697e29b93707167687543480a40f0db8f356e86d9f67ddf2e37e2dfd91a9dab \ + --hash=sha256:68a4953be99b17ac3c23b6efbc8a38330d99680c9458927491d18700ef23ded0 \ + --hash=sha256:6c36ddb64ed9d7e496028d1d00dfec3e428e0aabf4006583bb1839958d280510 \ + --hash=sha256:750db93a81e3e5a9831b534be7b1229df848b2e125a604fe6651e48aa070e5f9 \ + --hash=sha256:777c4d1eff1b67876139d24288aaf1817f6c03d6bae9c5cc8d27b83bcfe38fe3 \ + --hash=sha256:800bc829053c80d240a687ceeb927a94fd108bbdc68dfbe505d0d75ab578a882 \ + --hash=sha256:8769751c10f339021e2638cd354e13adeac54004d1941119b2c96fe5276d45ea \ + --hash=sha256:8fdf453a942c3e4d99bd80088141c4c6960bb232c409d9c3558e2dbaa3998562 \ + --hash=sha256:9bb2a28101a443669a423b665939381084412b81c3f8c0fcfbac57f4e30b5b8e \ + --hash=sha256:9dacc2ad679b292709e0f5fc1ac74a6d4d5562e424058962c7bb0c658ad25e45 \ + --hash=sha256:9ddb4f4a5479f2539644be484da179b653273bca1a323947d48ab107b3ed1f29 \ + --hash=sha256:b5db73ba3c41c7008037fa731ad5459fc3944cb7452fc0aa9f822ad3533c583c \ + --hash=sha256:bd3a2fbc1c6cccb3c5106140d87cc6a8715110373ef42b63cf5aea29df8c217a \ + --hash=sha256:c81f6515c4c40141f83f502b07bbfa5c240ba25bbe73da7b33f1e5b6120ff179 \ + --hash=sha256:c9136ff29c3a91e25b1d1552b5308e53a1e0653a23e53b6366d7c2dcbbaf8a16 \ + --hash=sha256:cec2d83125531bd153175354055cdb7a09987af08a9430bd173c937c6d0fba2a \ + --hash=sha256:cff784eef7f0b8f6cb28804fbddcfa99f89efe4cc35fb5627e3ac58f91ed3ac0 \ + --hash=sha256:d8a7a2049c14f413163e2bdabd37e41179b1d1ccb10ffc6ccc4b7a718429c607 \ + --hash=sha256:e1c85e0b6c05c592ea6d8768a66a254bfb3874b53774b12d4c89c481eb78cb90 \ + --hash=sha256:e301d30dd7e95ae068671d746ba8c34e945a82682e62918e41b2679acd2051a0 \ + --hash=sha256:e808af52a0513762df4d945ea164a24b37f2f518cbe97e03deaa0ee66139b4d6 \ + --hash=sha256:fbabfaceaeb587e16f7008f7795cd80d20ec548dc7f94fbb0d4ec2e038ce563f + # via pytest-cov +cryptography==46.0.6 \ + --hash=sha256:02fad249cb0e090b574e30b276a3da6a149e04ee2f049725b1f69e7b8351ec70 \ + --hash=sha256:063b67749f338ca9c5a0b7fe438a52c25f9526b851e24e6c9310e7195aad3b4d \ + --hash=sha256:12cae594e9473bca1a7aceb90536060643128bb274fcea0fc459ab90f7d1ae7a \ + --hash=sha256:22259338084d6ae497a19bae5d4c66b7ca1387d3264d1c2c0e72d9e9b6a77b97 \ + --hash=sha256:26031f1e5ca62fcb9d1fcb34b2b60b390d1aacaa15dc8b895a9ed00968b97b30 \ + --hash=sha256:27550628a518c5c6c903d84f637fbecf287f6cb9ced3804838a1295dc1fd0759 \ + --hash=sha256:2b417edbe8877cda9022dde3a008e2deb50be9c407eef034aeeb3a8b11d9db3c \ + --hash=sha256:2ef9e69886cbb137c2aef9772c2e7138dc581fad4fcbcf13cc181eb5a3ab6275 \ + --hash=sha256:341359d6c9e68834e204ceaf25936dffeafea3829ab80e9503860dcc4f4dac58 \ + --hash=sha256:380343e0653b1c9d7e1f55b52aaa2dbb2fdf2730088d48c43ca1c7c0abb7cc2f \ + --hash=sha256:3c21d92ed15e9cfc6eb64c1f5a0326db22ca9c2566ca46d845119b45b4400361 \ + --hash=sha256:3dfa6567f2e9e4c5dceb8ccb5a708158a2a871052fa75c8b78cb0977063f1507 \ + --hash=sha256:456b3215172aeefb9284550b162801d62f5f264a081049a3e94307fe20792cfa \ + --hash=sha256:4668298aef7cddeaf5c6ecc244c2302a2b8e40f384255505c22875eebb47888b \ + --hash=sha256:639301950939d844a9e1c4464d7e07f902fe9a7f6b215bb0d4f28584729935d8 \ + --hash=sha256:64235194bad039a10bb6d2d930ab3323baaec67e2ce36215fd0952fad0930ca8 \ + --hash=sha256:6617f67b1606dfd9fe4dbfa354a9508d4a6d37afe30306fe6c101b7ce3274b72 \ + --hash=sha256:67177e8a9f421aa2d3a170c3e56eca4e0128883cf52a071a7cbf53297f18b175 \ + --hash=sha256:6739d56300662c468fddb0e5e291f9b4d084bead381667b9e654c7dd81705124 \ + --hash=sha256:69cf0056d6947edc6e6760e5f17afe4bea06b56a9ac8a06de9d2bd6b532d4f3a \ + --hash=sha256:760997a4b950ff00d418398ad73fbc91aa2894b5c1db7ccb45b4f68b42a63b3c \ + --hash=sha256:79e865c642cfc5c0b3eb12af83c35c5aeff4fa5c672dc28c43721c2c9fdd2f0f \ + --hash=sha256:7e6142674f2a9291463e5e150090b95a8519b2fb6e6aaec8917dd8d094ce750d \ + --hash=sha256:7f417f034f91dcec1cb6c5c35b07cdbb2ef262557f701b4ecd803ee8cefed4f4 \ + --hash=sha256:7f6690b6c55e9c5332c0b59b9c8a3fb232ebf059094c17f9019a51e9827df91c \ + --hash=sha256:8927ccfbe967c7df312ade694f987e7e9e22b2425976ddbf28271d7e58845290 \ + --hash=sha256:8ce35b77aaf02f3b59c90b2c8a05c73bac12cea5b4e8f3fbece1f5fddea5f0ca \ + --hash=sha256:8e7304c4f4e9490e11efe56af6713983460ee0780f16c63f219984dab3af9d2d \ + --hash=sha256:97c8115b27e19e592a05c45d0dd89c57f81f841cc9880e353e0d3bf25b2139ed \ + --hash=sha256:9a693028b9cbe51b5a1136232ee8f2bc242e4e19d456ded3fa7c86e43c713b4a \ + --hash=sha256:9a9c42a2723999a710445bc0d974e345c32adfd8d2fac6d8a251fa829ad31cfb \ + --hash=sha256:aad75154a7ac9039936d50cf431719a2f8d4ed3d3c277ac03f3339ded1a5e707 \ + --hash=sha256:b12c6b1e1651e42ab5de8b1e00dc3b6354fdfd778e7fa60541ddacc27cd21410 \ + --hash=sha256:b928a3ca837c77a10e81a814a693f2295200adb3352395fad024559b7be7a736 \ + --hash=sha256:bcb87663e1f7b075e48c3be3ecb5f0b46c8fc50b50a97cf264e7f60242dca3f2 \ + --hash=sha256:c797e2517cb7880f8297e2c0f43bb910e91381339336f75d2c1c2cbf811b70b4 \ + --hash=sha256:c89eb37fae9216985d8734c1afd172ba4927f5a05cfd9bf0e4863c6d5465b013 \ + --hash=sha256:cdcd3edcbc5d55757e5f5f3d330dd00007ae463a7e7aa5bf132d1f22a4b62b19 \ + --hash=sha256:d24c13369e856b94892a89ddf70b332e0b70ad4a5c43cf3e9cb71d6d7ffa1f7b \ + --hash=sha256:d4e4aadb7fc1f88687f47ca20bb7227981b03afaae69287029da08096853b738 \ + --hash=sha256:d9528b535a6c4f8ff37847144b8986a9a143585f0540fbcb1a98115b543aa463 \ + --hash=sha256:ed3775295fb91f70b4027aeba878d79b3e55c0b3e97eaa4de71f8f23a9f2eb77 \ + --hash=sha256:ed418c37d095aeddf5336898a132fba01091f0ac5844e3e8018506f014b6d2c4 + # via + # flask-jwt-oidc + # python-jose +dill==0.4.1 \ + --hash=sha256:1e1ce33e978ae97fcfcff5638477032b801c46c7c65cf717f95fbc2248f79a9d \ + --hash=sha256:423092df4182177d4d8ba8290c8a5b640c66ab35ec7da59ccfa00f6fa3eea5fa + # via pylint +ecdsa==0.19.2 \ + --hash=sha256:62635b0ac1ca2e027f82122b5b81cb706edc38cd91c63dda28e4f3455a2bf930 \ + --hash=sha256:840f5dc5e375c68f36c1a7a5b9caad28f95daa65185c9253c0c08dd952bb7399 + # via python-jose +filelock==3.25.2 \ + --hash=sha256:b64ece2b38f4ca29dd3e810287aa8c48182bbecd1ae6e9ae126c9b35f1382694 \ + --hash=sha256:ca8afb0da15f229774c9ad1b455ed96e85a81373065fb10446672f64444ddf70 + # via queue-api +flask==3.1.3 \ + --hash=sha256:0ef0e52b8a9cd932855379197dd8f94047b359ca0a78695144304cb45f87c9eb \ + --hash=sha256:f4bcbefc124291925f1a26446da31a5178f9483862233b23c0c96a20701f670c + # via + # flask-admin + # flask-caching + # flask-compress + # flask-cors + # flask-jwt-oidc + # flask-login + # flask-marshmallow + # flask-migrate + # flask-restx + # flask-socketio + # flask-sqlalchemy + # queue-api +flask-admin==2.0.2 \ + --hash=sha256:1d06aec7efee957972b43f6b08a0bd08d5f4cf9a337d4ece2f17c98abc2a214e \ + --hash=sha256:4b3c44068de0fe4630dfcd190cc11231cbbdd7bac315c74c55d1764087b8b273 + # via queue-api +flask-caching==2.3.1 \ + --hash=sha256:65d7fd1b4eebf810f844de7de6258254b3248296ee429bdcb3f741bcbf7b98c9 \ + --hash=sha256:d3efcf600e5925ea5a2fcb810f13b341ae984f5b52c00e9d9070392f3ca10761 + # via queue-api +flask-compress==1.23 \ + --hash=sha256:52108afb4d133a5aab9809e6ac3c085ed7b9c788c75c6846c129faa28468f08c \ + --hash=sha256:5580935b422e3f136b9a90909e4b1015ac2b29c9aebe0f8733b790fde461c545 + # via queue-api +flask-cors==6.0.2 \ + --hash=sha256:6e118f3698249ae33e429760db98ce032a8bf9913638d085ca0f4c5534ad2423 \ + --hash=sha256:e57544d415dfd7da89a9564e1e3a9e515042df76e12130641ca6f3f2f03b699a + # via queue-api +flask-jwt-oidc==0.9.0 \ + --hash=sha256:6c6169b52b73dbdc06f2e11b9481f382c4125a1b181f88f7270992200cda69a3 \ + --hash=sha256:7ce75f002e7a1ef3639366bf03f62b86e9a3afbd2d1818cbcb71a196b027e55c + # via queue-api +flask-login==0.6.3 \ + --hash=sha256:5e23d14a607ef12806c699590b89d0f0e0d67baeec599d75947bf9c147330333 \ + --hash=sha256:849b25b82a436bf830a054e74214074af59097171562ab10bfa999e6b78aae5d + # via queue-api +flask-marshmallow==1.4.0 \ + --hash=sha256:98c90a253052c72d2ddddc925539ac33bbd780c6fba86478ffe18e3b89d8b471 \ + --hash=sha256:b758fc2c428d0cbee6fd0ccf0d55524fe9e426a86a177dcc0fc8cd71ad4b7c59 + # via queue-api +flask-migrate==4.1.0 \ + --hash=sha256:1a336b06eb2c3ace005f5f2ded8641d534c18798d64061f6ff11f79e1434126d \ + --hash=sha256:24d8051af161782e0743af1b04a152d007bad9772b2bca67b7ec1e8ceeb3910d + # via queue-api +flask-restx==1.3.2 \ + --hash=sha256:0ae13d77e7d7e4dce513970cfa9db45364aef210e99022de26d2b73eb4dbced5 \ + --hash=sha256:6e035496e8223668044fc45bf769e526352fd648d9e159bd631d94fd645a687b + # via queue-api +flask-socketio==5.6.1 \ + --hash=sha256:51a3f71b28b4476c650829607e3a993e076034db6c3cc31f718f0a4b45939d42 \ + --hash=sha256:fe5bd995c3ed4da9a98f335d0d830fa1a19d84a64789f6265642a671fdacaeac + # via queue-api +flask-sqlalchemy==3.1.1 \ + --hash=sha256:4ba4be7f419dc72f4efd8802d69974803c37259dd42f3913b0dcf75c9447e0a0 \ + --hash=sha256:e4b68bb881802dda1a7d878b2fc84c06d1ee57fb40b874d3dc97dabfa36b8312 + # via + # flask-migrate + # queue-api +gevent==25.9.1 \ + --hash=sha256:0adb937f13e5fb90cca2edf66d8d7e99d62a299687400ce2edee3f3504009356 \ + --hash=sha256:1a3fe4ea1c312dbf6b375b416925036fe79a40054e6bf6248ee46526ea628be1 \ + --hash=sha256:1d0f5d8d73f97e24ea8d24d8be0f51e0cf7c54b8021c1fddb580bf239474690f \ + --hash=sha256:427f869a2050a4202d93cf7fd6ab5cffb06d3e9113c10c967b6e2a0d45237cb8 \ + --hash=sha256:adf9cd552de44a4e6754c51ff2e78d9193b7fa6eab123db9578a210e657235dd \ + --hash=sha256:b5a67a0974ad9f24721034d1e008856111e0535f1541499f72a733a73d658d1c \ + --hash=sha256:bb63c0d6cb9950cc94036a4995b9cc4667b8915366613449236970f4394f94d7 \ + --hash=sha256:c049880175e8c93124188f9d926af0a62826a3b81aa6d3074928345f8238279e \ + --hash=sha256:ddd3ff26e5c4240d3fbf5516c2d9d5f2a998ef87cfb73e1429cfaeaaec860fa6 + # via queue-api +greenlet==3.3.2 ; platform_machine == 'AMD64' or platform_machine == 'WIN32' or platform_machine == 'aarch64' or platform_machine == 'amd64' or platform_machine == 'ppc64le' or platform_machine == 'win32' or platform_machine == 'x86_64' or platform_python_implementation == 'CPython' \ + --hash=sha256:18cb1b7337bca281915b3c5d5ae19f4e76d35e1df80f4ad3c1a7be91fadf1082 \ + --hash=sha256:1fb39a11ee2e4d94be9a76671482be9398560955c9e568550de0224e41104727 \ + --hash=sha256:20154044d9085151bc309e7689d6f7ba10027f8f5a8c0676ad398b951913d89e \ + --hash=sha256:2eaf067fc6d886931c7962e8c6bede15d2f01965560f3359b27c80bde2d151f2 \ + --hash=sha256:59b3e2c40f6706b05a9cd299c836c6aa2378cabe25d021acd80f13abf81181cf \ + --hash=sha256:63d10328839d1973e5ba35e98cccbca71b232b14051fd957b6f8b6e8e80d0506 \ + --hash=sha256:8b466dff7a4ffda6ca975979bab80bdadde979e29fc947ac3be4451428d8b0e4 \ + --hash=sha256:8c4dd0f3997cf2512f7601563cc90dfb8957c0cff1e3a1b23991d4ea1776c492 \ + --hash=sha256:8d1658d7291f9859beed69a776c10822a0a799bc4bfe1bd4272bb60e62507dab \ + --hash=sha256:8e4ab3cfb02993c8cc248ea73d7dae6cec0253e9afa311c9b37e603ca9fad2ce \ + --hash=sha256:94ad81f0fd3c0c0681a018a976e5c2bd2ca2d9d94895f23e7bb1af4e8af4e2d5 \ + --hash=sha256:b26b0f4428b871a751968285a1ac9648944cea09807177ac639b030bddebcea4 \ + --hash=sha256:b8bddc5b73c9720bea487b3bffdb1840fe4e3656fba3bd40aa1489e9f37877ff \ + --hash=sha256:c04c5e06ec3e022cbfe2cd4a846e1d4e50087444f875ff6d2c2ad8445495cf1a \ + --hash=sha256:c2e47408e8ce1c6f1ceea0dffcdf6ebb85cc09e55c7af407c99f1112016e45e9 \ + --hash=sha256:cd6f9e2bbd46321ba3bbb4c8a15794d32960e3b0ae2cc4d49a1a53d314805d71 \ + --hash=sha256:e26e72bec7ab387ac80caa7496e0f908ff954f31065b0ffc1f8ecb1338b11b54 \ + --hash=sha256:e3cb43ce200f59483eb82949bf1835a99cf43d7571e900d7c8d5c62cdf25d2f9 + # via + # gevent + # sqlalchemy +gunicorn==25.2.0 \ + --hash=sha256:10bd7adb36d44945d97d0a1fdf9a0fb086ae9c7b39e56b4dece8555a6bf4a09c \ + --hash=sha256:88f5b444d0055bf298435384af7294f325e2273fd37ba9f9ff7b98e0a1e5dfdc + # via queue-api +h11==0.16.0 \ + --hash=sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1 \ + --hash=sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86 + # via wsproto +idna==3.11 \ + --hash=sha256:771a87f49d9defaf64091e6e6fe9c18d4833f140bd19464795bc32d966ca37ea \ + --hash=sha256:795dafcc9c04ed0c1fb032c2aa73654d8e8c5023a7df64a53f39190ada629902 + # via requests +importlib-resources==6.5.2 \ + --hash=sha256:185f87adef5bcc288449d98fb4fba07cea78bc036455dd44c5fc4a2fe78fed2c \ + --hash=sha256:789cfdc3ed28c78b67a06acb8126751ced69a3d5f79c095a98298cd8a760ccec + # via flask-restx +iniconfig==2.3.0 \ + --hash=sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730 \ + --hash=sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12 + # via pytest +isort==8.0.1 \ + --hash=sha256:171ac4ff559cdc060bcfff550bc8404a486fee0caab245679c2abe7cb253c78d \ + --hash=sha256:28b89bc70f751b559aeca209e6120393d43fbe2490de0559662be7a9787e3d75 + # via pylint +itsdangerous==2.2.0 \ + --hash=sha256:c6242fc49e35958c8b15141343aa660db5fc54d4f13a1db01a3f5891b98700ef \ + --hash=sha256:e0050c0b7da1eea53ffaf149c0cfbb5c6e2e2b69c4bef22c81fa6eb73e5f6173 + # via flask +jinja2==3.1.6 \ + --hash=sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d \ + --hash=sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67 + # via + # flask + # flask-admin + # flask-socketio + # queue-api +jsonschema==4.26.0 \ + --hash=sha256:0c26707e2efad8aa1bfc5b7ce170f3fccc2e4918ff85989ba9ffa9facb2be326 \ + --hash=sha256:d489f15263b8d200f8387e64b4c3a75f06629559fb73deb8fdfb525f2dab50ce + # via flask-restx +jsonschema-specifications==2025.9.1 \ + --hash=sha256:98802fee3a11ee76ecaca44429fda8a41bff98b00a0f2838151b113f210cc6fe \ + --hash=sha256:b540987f239e745613c7a9176f3edb72b832a4ac465cf02712288397832b5e8d + # via jsonschema +kombu==5.6.2 \ + --hash=sha256:8060497058066c6f5aed7c26d7cd0d3b574990b09de842a8c5aaed0b92cc5a55 \ + --hash=sha256:efcfc559da324d41d61ca311b0c64965ea35b4c55cc04ee36e55386145dace93 + # via queue-api +mako==1.3.10 \ + --hash=sha256:99579a6f39583fa7e5630a28c3c1f440e4e97a414b80372649c0ce338da2ea28 \ + --hash=sha256:baef24a52fc4fc514a0887ac600f9f1cff3d82c61d4d700a1fa84d597b88db59 + # via alembic +markupsafe==3.0.3 \ + --hash=sha256:0eb9ff8191e8498cca014656ae6b8d61f39da5f95b488805da4bb029cccbfbaf \ + --hash=sha256:1085e7fbddd3be5f89cc898938f42c0b3c711fdcb37d75221de2666af647c175 \ + --hash=sha256:1353ef0c1b138e1907ae78e2f6c63ff67501122006b0f9abad68fda5f4ffc6ab \ + --hash=sha256:1b52b4fb9df4eb9ae465f8d0c228a00624de2334f216f178a995ccdcf82c4634 \ + --hash=sha256:2713baf880df847f2bece4230d4d094280f4e67b1e813eec43b4c0e144a34ffe \ + --hash=sha256:32001d6a8fc98c8cb5c947787c5d08b0a50663d139f1305bac5885d98d9b40fa \ + --hash=sha256:457a69a9577064c05a97c41f4e65148652db078a3a509039e64d3467b9e7ef97 \ + --hash=sha256:4faffd047e07c38848ce017e8725090413cd80cbc23d86e55c587bf979e579c9 \ + --hash=sha256:5678211cb9333a6468fb8d8be0305520aa073f50d17f089b5b4b477ea6e67fdc \ + --hash=sha256:5a7d5dc5140555cf21a6fefbdbf8723f06fcd2f63ef108f2854de715e4422cb4 \ + --hash=sha256:722695808f4b6457b320fdc131280796bdceb04ab50fe1795cd540799ebe1698 \ + --hash=sha256:729586769a26dbceff69f7a7dbbf59ab6572b99d94576a5592625d5b411576b9 \ + --hash=sha256:915c04ba3851909ce68ccc2b8e2cd691618c4dc4c4232fb7982bca3f41fd8c3d \ + --hash=sha256:bdc919ead48f234740ad807933cdf545180bfbe9342c2bb451556db2ed958581 \ + --hash=sha256:c47a551199eb8eb2121d4f0f15ae0f923d31350ab9280078d1e5f12b249e0026 \ + --hash=sha256:e56b7d45a839a697b5eb268c82a71bd8c7f6c94d6fd50c3d577fa39a9f1409f5 \ + --hash=sha256:e8afc3f2ccfa24215f8cb28dcf43f0113ac3c37c2f0f0806d8c70e4228c5cf4d \ + --hash=sha256:eaa9599de571d72e2daf60164784109f19978b327a3910d3e9de8c97b5b70cfe \ + --hash=sha256:ec15a59cf5af7be74194f7ab02d0f59a62bdcf1a537677ce67a2537c9b87fcda \ + --hash=sha256:f190daf01f13c72eac4efd5c430a8de82489d9cff23c364c3ea822545032993e \ + --hash=sha256:f34c41761022dd093b4b6896d4810782ffbabe30f2d443ff5f083e0cbbb8c737 \ + --hash=sha256:f3e98bb3798ead92273dc0e5fd0f31ade220f59a266ffd8a4f6065e0a3ce0523 \ + --hash=sha256:fed51ac40f757d41b7c48425901843666a6677e3e8eb0abcff09e4ba6e664f50 + # via + # flask + # flask-admin + # jinja2 + # mako + # queue-api + # werkzeug + # wtforms +marshmallow==4.2.3 \ + --hash=sha256:3e3fef6b3603721a25a723b8caedfa488369bddaf9bc03b40b9442c90aebd22b \ + --hash=sha256:c84fd89817ecea690bde1eb925036070e5e9883148217585adc56d5cfbc082b8 + # via + # flask-marshmallow + # marshmallow-sqlalchemy + # queue-api +marshmallow-sqlalchemy==1.4.2 \ + --hash=sha256:6410304bf98ec26ea35f3f9d3cee82e51fd093c434612add32a0bdcdb5668f7c \ + --hash=sha256:65aee301c4601e76a2fdb02764a65c18913afba2a3506a326c625d13ab405b40 + # via queue-api +mccabe==0.7.0 \ + --hash=sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325 \ + --hash=sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e + # via pylint +minio==7.2.20 \ + --hash=sha256:95898b7a023fbbfde375985aa77e2cd6a0762268db79cf886f002a9ea8e68598 \ + --hash=sha256:eb33dd2fb80e04c3726a76b13241c6be3c4c46f8d81e1d58e757786f6501897e + # via queue-api +packaging==26.0 \ + --hash=sha256:00243ae351a257117b6a241061796684b084ed1c516a08c48a3f7e147a9d80b4 \ + --hash=sha256:b36f1fef9334a5588b4166f8bcd26a14e521f2b55e6b9de3aaa80d3ff7a37529 + # via + # gunicorn + # kombu + # pytest +platformdirs==4.9.4 \ + --hash=sha256:1ec356301b7dc906d83f371c8f487070e99d3ccf9e501686456394622a01a934 \ + --hash=sha256:68a9a4619a666ea6439f2ff250c12a853cd1cbd5158d258bd824a7df6be2f868 + # via pylint +pluggy==1.6.0 \ + --hash=sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3 \ + --hash=sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746 + # via + # pytest + # pytest-cov +psycopg2-binary==2.9.11 \ + --hash=sha256:32770a4d666fbdafab017086655bcddab791d7cb260a16679cc5a7338b64343b \ + --hash=sha256:4012c9c954dfaccd28f94e84ab9f94e12df76b4afb22331b1f0d3154893a6316 \ + --hash=sha256:47f212c1d3be608a12937cc131bd85502954398aaa1320cb4c14421a0ffccf4c \ + --hash=sha256:92e3b669236327083a2e33ccfa0d320dd01b9803b3e14dd986a4fc54aa00f4e1 \ + --hash=sha256:9b52a3f9bb540a3e4ec0f6ba6d31339727b2950c9772850d6545b7eae0b9d7c5 \ + --hash=sha256:9bd81e64e8de111237737b29d68039b9c813bdf520156af36d26819c9a979e5f \ + --hash=sha256:b6aed9e096bf63f9e75edf2581aa9a7e7186d97ab5c177aa6c87797cd591236c \ + --hash=sha256:c3cb3a676873d7506825221045bd70e0427c905b9c8ee8d6acd70cfcbd6e576d \ + --hash=sha256:db4fd476874ccfdbb630a54426964959e58da4c61c9feba73e6094d51303d7d8 \ + --hash=sha256:e0deeb03da539fa3577fcb0b3f2554a97f7e5477c246098dbb18091a4a01c16f \ + --hash=sha256:e35b7abae2b0adab776add56111df1735ccc71406e56203515e228a8dc07089f \ + --hash=sha256:fcf21be3ce5f5659daefd2b3b3b6e4727b028221ddc94e6c1523425579664747 + # via queue-api +pyasn1==0.6.3 \ + --hash=sha256:697a8ecd6d98891189184ca1fa05d1bb00e2f84b5977c481452050549c8a72cf \ + --hash=sha256:a80184d120f0864a52a073acc6fc642847d0be408e7c7252f31390c0f4eadcde + # via + # python-jose + # rsa +pycparser==3.0 ; implementation_name != 'PyPy' \ + --hash=sha256:600f49d217304a5902ac3c37e1281c9fe94e4d0489de643a9504c5cdfdfc6b29 \ + --hash=sha256:b727414169a36b7d524c1c3e31839a521725078d7b2ff038656844266160a992 + # via cffi +pycryptodome==3.23.0 \ + --hash=sha256:11eeeb6917903876f134b56ba11abe95c0b0fd5e3330def218083c7d98bbcb3c \ + --hash=sha256:156df9667ad9f2ad26255926524e1c136d6664b741547deb0a86a9acf5ea631f \ + --hash=sha256:187058ab80b3281b1de11c2e6842a357a1f71b42cb1e15bce373f3d238135c27 \ + --hash=sha256:447700a657182d60338bab09fdb27518f8856aecd80ae4c6bdddb67ff5da44ef \ + --hash=sha256:507dbead45474b62b2bbe318eb1c4c8ee641077532067fec9c1aa82c31f84886 \ + --hash=sha256:53ecbafc2b55353edcebd64bf5da94a2a2cdf5090a6915bcca6eca6cc452585a \ + --hash=sha256:67bd81fcbe34f43ad9422ee8fd4843c8e7198dd88dd3d40e6de42ee65fbe1490 \ + --hash=sha256:aa0698f65e5b570426fc31b8162ed4603b0c2841cbb9088e2b01641e3065915b \ + --hash=sha256:c75b52aacc6c0c260f204cbdd834f76edc9fb0d8e0da9fbf8352ef58202564e2 \ + --hash=sha256:c8987bd3307a39bc03df5c8e0e3d8be0c4c3518b7f044b0f4c15d1aa78f52575 \ + --hash=sha256:cfb5cd445280c5b0a4e6187a7ce8de5a07b5f3f897f235caa11f1f435f182843 \ + --hash=sha256:dea827b4d55ee390dc89b2afe5927d4308a8b538ae91d9c6f7a5090f397af1aa + # via minio +pygments==2.19.2 \ + --hash=sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887 \ + --hash=sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b + # via pytest +pyjwt==2.12.1 \ + --hash=sha256:28ca37c070cad8ba8cd9790cd940535d40274d22f80ab87f3ac6a713e6e8454c \ + --hash=sha256:c74a7a2adf861c04d002db713dd85f84beb242228e671280bf709d765b03672b + # via flask-jwt-oidc +pylint==4.0.5 \ + --hash=sha256:00f51c9b14a3b3ae08cff6b2cdd43f28165c78b165b628692e428fb1f8dc2cf2 \ + --hash=sha256:8cd6a618df75deb013bd7eb98327a95f02a6fb839205a6bbf5456ef96afb317c +pytest==9.0.2 \ + --hash=sha256:711ffd45bf766d5264d487b917733b453d917afd2b0ad65223959f59089f875b \ + --hash=sha256:75186651a92bd89611d1d9fc20f0b4345fd827c41ccd5c299a868a05d70edf11 + # via pytest-cov +pytest-cov==7.1.0 \ + --hash=sha256:30674f2b5f6351aa09702a9c8c364f6a01c27aae0c1366ae8016160d1efc56b2 \ + --hash=sha256:a0461110b7865f9a271aa1b51e516c9a95de9d696734a2f71e3e78f46e1d4678 +python-dateutil==2.9.0.post0 \ + --hash=sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3 \ + --hash=sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427 + # via queue-api +python-dotenv==1.2.2 \ + --hash=sha256:1d8214789a24de455a8b8bd8ae6fe3c6b69a5e3d64aa8a8e5d68e694bbcb285a \ + --hash=sha256:2c371a91fbd7ba082c2c1dc1f8bf89ca22564a087c2c287cd9b662adde799cf3 + # via queue-api +python-engineio==4.13.1 \ + --hash=sha256:0a853fcef52f5b345425d8c2b921ac85023a04dfcf75d7b74696c61e940fd066 \ + --hash=sha256:f32ad10589859c11053ad7d9bb3c9695cdf862113bfb0d20bc4d890198287399 + # via python-socketio +python-jose==3.5.0 \ + --hash=sha256:abd1202f23d34dfad2c3d28cb8617b90acf34132c7afd60abd0b0b7d3cb55771 \ + --hash=sha256:fb4eaa44dbeb1c26dcc69e4bd7ec54a1cb8dd64d3b4d81ef08d90ff453f2b01b + # via queue-api +python-socketio==5.16.1 \ + --hash=sha256:a3eb1702e92aa2f2b5d3ba00261b61f062cce51f1cfb6900bf3ab4d1934d2d35 \ + --hash=sha256:f863f98eacce81ceea2e742f6388e10ca3cdd0764be21d30d5196470edf5ea89 + # via flask-socketio +redis==7.4.0 \ + --hash=sha256:64a6ea7bf567ad43c964d2c30d82853f8df927c5c9017766c55a1d1ed95d18ad \ + --hash=sha256:a9c74a5c893a5ef8455a5adb793a31bb70feb821c86eccb62eebef5a19c429ec + # via queue-api +referencing==0.37.0 \ + --hash=sha256:381329a9f99628c9069361716891d34ad94af76e461dcb0335825aecc7692231 \ + --hash=sha256:44aefc3142c5b842538163acb373e24cce6632bd54bdb01b21ad5863489f50d8 + # via + # flask-restx + # jsonschema + # jsonschema-specifications +requests==2.33.0 \ + --hash=sha256:3324635456fa185245e24865e810cecec7b4caf933d7eb133dcde67d48cee69b \ + --hash=sha256:c7ebc5e8b0f21837386ad0e1c8fe8b829fa5f544d8df3b2253bff14ef29d7652 + # via + # queue-api + # snowplow-tracker +rpds-py==0.30.0 \ + --hash=sha256:0d08f00679177226c4cb8c5265012eea897c8ca3b93f429e546600c971bcbae7 \ + --hash=sha256:0ed177ed9bded28f8deb6ab40c183cd1192aa0de40c12f38be4d59cd33cb5c65 \ + --hash=sha256:27f4b0e92de5bfbc6f86e43959e6edd1425c33b5e69aab0984a72047f2bcf1e3 \ + --hash=sha256:3e62880792319dbeb7eb866547f2e35973289e7d5696c6e295476448f5b63c87 \ + --hash=sha256:3e8eeb0544f2eb0d2581774be4c3410356eba189529a6b3e36bbbf9696175856 \ + --hash=sha256:4559c972db3a360808309e06a74628b95eaccbf961c335c8fe0d590cf587456f \ + --hash=sha256:46e83c697b1f1c72b50e5ee5adb4353eef7406fb3f2043d64c33f20ad1c2fc53 \ + --hash=sha256:47e77dc9822d3ad616c3d5759ea5631a75e5809d5a28707744ef79d7a1bcfcad \ + --hash=sha256:4e7fc54e0900ab35d041b0601431b0a0eb495f0851a0639b6ef90f7741b39a18 \ + --hash=sha256:5965af57d5848192c13534f90f9dd16464f3c37aaf166cc1da1cae1fd5a34898 \ + --hash=sha256:613aa4771c99f03346e54c3f038e4cc574ac09a3ddfb0e8878487335e96dead6 \ + --hash=sha256:626a7433c34566535b6e56a1b39a7b17ba961e97ce3b80ec62e6f1312c025551 \ + --hash=sha256:68f19c879420aa08f61203801423f6cd5ac5f0ac4ac82a2368a9fcd6a9a075e0 \ + --hash=sha256:74a3243a411126362712ee1524dfc90c650a503502f135d54d1b352bd01f2404 \ + --hash=sha256:7e6ecfcb62edfd632e56983964e6884851786443739dbfe3582947e87274f7cb \ + --hash=sha256:95f0802447ac2d10bcc69f6dc28fe95fdf17940367b21d34e34c737870758950 \ + --hash=sha256:9a4e86e34e9ab6b667c27f3211ca48f73dba7cd3d90f8d5b11be56e5dbc3fb4e \ + --hash=sha256:a1d0bc22a7cdc173fedebb73ef81e07faef93692b8c1ad3733b67e31e1b6e1b8 \ + --hash=sha256:ac98b175585ecf4c0348fd7b29c3864bda53b805c773cbf7bfdaffc8070c976f \ + --hash=sha256:acd7eb3f4471577b9b5a41baf02a978e8bdeb08b4b355273994f8b87032000a8 \ + --hash=sha256:ad1fa8db769b76ea911cb4e10f049d80bf518c104f15b3edb2371cc65375c46f \ + --hash=sha256:b4dc1a6ff022ff85ecafef7979a2c6eb423430e05f1165d6688234e62ba99a07 \ + --hash=sha256:dbd936cde57abfee19ab3213cf9c26be06d60750e60a8e4dd85d1ab12c8b1f40 \ + --hash=sha256:dc824125c72246d924f7f796b4f63c1e9dc810c7d9e2355864b3c3a73d59ade0 \ + --hash=sha256:dd8ff7cf90014af0c0f787eea34794ebf6415242ee1d6fa91eaba725cc441e84 \ + --hash=sha256:e5d3e6b26f2c785d65cc25ef1e5267ccbe1b069c5c21b8cc724efee290554419 \ + --hash=sha256:ec7c4490c672c1a0389d319b3a9cfcd098dcdc4783991553c332a15acf7249be \ + --hash=sha256:ee454b2a007d57363c2dfd5b6ca4a5d7e2c518938f8ed3b706e37e5d470801ed \ + --hash=sha256:f251c812357a3fed308d684a5079ddfb9d933860fc6de89f2b7ab00da481e65f \ + --hash=sha256:fe5fa731a1fa8a0a56b0977413f8cacac1768dad38d16b3a296712709476fbd5 + # via + # jsonschema + # referencing +rsa==4.9.1 \ + --hash=sha256:68635866661c6836b8d39430f97a996acbd61bfa49406748ea243539fe239762 \ + --hash=sha256:e7bdbfdb5497da4c07dfd35530e1a902659db6ff241e39d9953cad06ebd0ae75 + # via python-jose +ruff==0.15.8 \ + --hash=sha256:04f79eff02a72db209d47d665ba7ebcad609d8918a134f86cb13dd132159fc89 \ + --hash=sha256:0f29b989a55572fb885b77464cf24af05500806ab4edf9a0fd8977f9759d85b1 \ + --hash=sha256:12e617fc01a95e5821648a6df341d80456bd627bfab8a829f7cfc26a14a4b4a3 \ + --hash=sha256:2033f963c43949d51e6fdccd3946633c6b37c484f5f98c3035f49c27395a8ab8 \ + --hash=sha256:432701303b26416d22ba696c39f2c6f12499b89093b61360abc34bcc9bf07762 \ + --hash=sha256:6ee3ae5c65a42f273f126686353f2e08ff29927b7b7e203b711514370d500de3 \ + --hash=sha256:75e5cd06b1cf3f47a3996cfc999226b19aa92e7cce682dcd62f80d7035f98f49 \ + --hash=sha256:8d9a5b8ea13f26ae90838afc33f91b547e61b794865374f114f349e9036835fb \ + --hash=sha256:995f11f63597ee362130d1d5a327a87cb6f3f5eae3094c620bcc632329a4d26e \ + --hash=sha256:ac51d486bf457cdc985a412fb1801b2dfd1bd8838372fc55de64b1510eff4bec \ + --hash=sha256:bc1f0a51254ba21767bfa9a8b5013ca8149dcf38092e6a9eb704d876de94dc34 \ + --hash=sha256:c2a33a529fb3cbc23a7124b5c6ff121e4d6228029cba374777bd7649cc8598b8 \ + --hash=sha256:c9861eb959edab053c10ad62c278835ee69ca527b6dcd72b47d5c1e5648964f6 \ + --hash=sha256:cbe05adeba76d58162762d6b239c9056f1a15a55bd4b346cfd21e26cd6ad7bc7 \ + --hash=sha256:cf891fa8e3bb430c0e7fac93851a5978fc99c8fa2c053b57b118972866f8e5f2 \ + --hash=sha256:d3e3d0b6ba8dca1b7ef9ab80a28e840a20070c4b62e56d675c24f366ef330570 \ + --hash=sha256:d910ae974b7a06a33a057cb87d2a10792a3b2b3b35e33d2699fdf63ec8f6b17a \ + --hash=sha256:fdce027ada77baa448077ccc6ebb2fa9c3c62fd110d8659d601cf2f475858d94 +simple-websocket==1.1.0 \ + --hash=sha256:4af6069630a38ed6c561010f0e11a5bc0d4ca569b36306eb257cd9a192497c8c \ + --hash=sha256:7939234e7aa067c534abdab3a9ed933ec9ce4691b0713c78acb195560aa52ae4 + # via python-engineio +six==1.17.0 \ + --hash=sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274 \ + --hash=sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81 + # via + # ecdsa + # python-dateutil +snowplow-tracker==1.1.0 \ + --hash=sha256:24ea32ddac9cca547421bf9ab162f5f33c00711c6ef118ad5f78093cee962224 \ + --hash=sha256:95d8fdc8bd542fd12a0b9a076852239cbaf0599eda8721deaf5f93f7138fe755 + # via queue-api +sqlalchemy==2.0.48 \ + --hash=sha256:1182437cb2d97988cfea04cf6cdc0b0bb9c74f4d56ec3d08b81e23d621a28cc6 \ + --hash=sha256:144921da96c08feb9e2b052c5c5c1d0d151a292c6135623c6b2c041f2a45f9e0 \ + --hash=sha256:288937433bd44e3990e7da2402fabc44a3c6c25d3704da066b85b89a85474ae0 \ + --hash=sha256:426c5ca86415d9b8945c7073597e10de9644802e2ff502b8e1f11a7a2642856b \ + --hash=sha256:49b7bddc1eebf011ea5ab722fdbe67a401caa34a350d278cc7733c0e88fecb1f \ + --hash=sha256:5aee45fd2c6c0f2b9cdddf48c48535e7471e42d6fb81adfde801da0bd5b93241 \ + --hash=sha256:5ca74f37f3369b45e1f6b7b06afb182af1fd5dde009e4ffd831830d98cbe5fe7 \ + --hash=sha256:7a936f1bb23d370b7c8cc079d5fce4c7d18da87a33c6744e51a93b0f9e97e9b3 \ + --hash=sha256:7cddca31edf8b0653090cbb54562ca027c421c58ddde2c0685f49ff56a1690e0 \ + --hash=sha256:8183dc57ae7d9edc1346e007e840a9f3d6aa7b7f165203a99e16f447150140d2 \ + --hash=sha256:a66fe406437dd65cacd96a72689a3aaaecaebbcd62d81c5ac1c0fdbeac835096 \ + --hash=sha256:b8438ec5594980d405251451c5b7ea9aa58dda38eb7ac35fb7e4c696712ee24f \ + --hash=sha256:d854b3970067297f3a7fbd7a4683587134aa9b3877ee15aa29eea478dc68f933 \ + --hash=sha256:e004aa9248e8cb0a5f9b96d003ca7c1c0a5da8decd1066e7b53f59eb8ce7c62b \ + --hash=sha256:e2d0d88686e3d35a76f3e15a34e8c12d73fc94c1dea1cd55782e695cc14086dd + # via + # alembic + # flask-sqlalchemy + # marshmallow-sqlalchemy + # queue-api +tomlkit==0.14.0 \ + --hash=sha256:592064ed85b40fa213469f81ac584f67a4f2992509a7c3ea2d632208623a3680 \ + --hash=sha256:cf00efca415dbd57575befb1f6634c4f42d2d87dbba376128adb42c121b87064 + # via pylint +typing-extensions==4.15.0 \ + --hash=sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466 \ + --hash=sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548 + # via + # alembic + # minio + # snowplow-tracker + # sqlalchemy +tzdata==2025.3 \ + --hash=sha256:06a47e5700f3081aab02b2e513160914ff0694bce9947d6b76ebd6bf57cfc5d1 \ + --hash=sha256:de39c2ca5dc7b0344f2eba86f49d614019d29f060fc4ebc8a417896a620b56a7 + # via kombu +urllib3==2.6.3 \ + --hash=sha256:1b62b6884944a57dbe321509ab94fd4d3b307075e0c2eae991ac71ee15ad38ed \ + --hash=sha256:bf272323e553dfb2e87d9bfd225ca7b0f467b919d7bbd355436d3fd37cb0acd4 + # via + # minio + # requests +vine==5.1.0 \ + --hash=sha256:40fdf3c48b2cfe1c38a49e9ae2da6fda88e4794c810050a728bd7413811fb1dc \ + --hash=sha256:8b62e981d35c41049211cf62a0a1242d8c1ee9bd15bb196ce38aefd6799e61e0 + # via + # amqp + # kombu +werkzeug==3.1.7 \ + --hash=sha256:4b314d81163a3e1a169b6a0be2a000a0e204e8873c5de6586f453c55688d422f \ + --hash=sha256:fb8c01fe6ab13b9b7cdb46892b99b1d66754e1d7ab8e542e865ec13f526b5351 + # via + # flask + # flask-admin + # flask-cors + # flask-login + # flask-restx + # flask-socketio +wsproto==1.3.2 \ + --hash=sha256:61eea322cdf56e8cc904bd3ad7573359a242ba65688716b0710a5eb12beab584 \ + --hash=sha256:b86885dcf294e15204919950f666e06ffc6c7c114ca900b060d6e16293528294 + # via simple-websocket +wtforms==3.2.1 \ + --hash=sha256:583bad77ba1dd7286463f21e11aa3043ca4869d03575921d1a1698d0715e0fd4 \ + --hash=sha256:df3e6b70f3192e92623128123ec8dca3067df9cfadd43d59681e210cfb8d4682 + # via + # flask-admin + # queue-api +zope-event==6.1 \ + --hash=sha256:0ca78b6391b694272b23ec1335c0294cc471065ed10f7f606858fc54566c25a0 \ + --hash=sha256:6052a3e0cb8565d3d4ef1a3a7809336ac519bc4fe38398cb8d466db09adef4f0 + # via gevent +zope-interface==8.2 \ + --hash=sha256:05a0e42d6d830f547e114de2e7cd15750dc6c0c78f8138e6c5035e51ddfff37c \ + --hash=sha256:46c7e4e8cbc698398a67e56ca985d19cb92365b4aafbeb6a712e8c101090f4cb \ + --hash=sha256:561ce42390bee90bae51cf1c012902a8033b2aaefbd0deed81e877562a116d48 \ + --hash=sha256:a87fc7517f825a97ff4a4ca4c8a950593c59e0f8e7bfe1b6f898a38d5ba9f9cf \ + --hash=sha256:aae807efc7bd26302eb2fea05cd6de7d59269ed6ae23a6de1ee47add6de99b8c \ + --hash=sha256:afb20c371a601d261b4f6edb53c3c418c249db1a9717b0baafc9a9bb39ba1224 \ + --hash=sha256:ccf52f7d44d669203c2096c1a0c2c15d52e36b2e7a9413df50f48392c7d4d080 + # via gevent diff --git a/api/scripts/export_requirements.sh b/api/scripts/export_requirements.sh new file mode 100644 index 000000000..699412610 --- /dev/null +++ b/api/scripts/export_requirements.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -euo pipefail + +script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +api_dir="$(cd "${script_dir}/.." && pwd)" + +cd "${api_dir}" +uv export --frozen --format requirements-txt --no-emit-project --output-file requirements.txt +uv export --frozen --format requirements-txt --no-emit-project --group dev --output-file requirements_dev.txt diff --git a/api/scripts/run_api_full_tests.sh b/api/scripts/run_api_full_tests.sh new file mode 100755 index 000000000..d97e3ba6e --- /dev/null +++ b/api/scripts/run_api_full_tests.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -euo pipefail + +script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +api_dir="$(cd "${script_dir}/.." && pwd)" + +cd "${api_dir}" +uv run pytest app/tests -q --require-integration-db diff --git a/api/scripts/run_api_integration_tests.sh b/api/scripts/run_api_integration_tests.sh new file mode 100755 index 000000000..aa4079eae --- /dev/null +++ b/api/scripts/run_api_integration_tests.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +set -euo pipefail + +script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +api_dir="$(cd "${script_dir}/.." && pwd)" + +cd "${api_dir}" +uv run pytest app/tests -m integration -q \ + --override-ini "addopts=--strict-markers" \ + --require-integration-db diff --git a/api/scripts/run_api_smoke_tests.sh b/api/scripts/run_api_smoke_tests.sh new file mode 100755 index 000000000..4895648bf --- /dev/null +++ b/api/scripts/run_api_smoke_tests.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -euo pipefail + +script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +api_dir="$(cd "${script_dir}/.." && pwd)" + +cd "${api_dir}" +uv run pytest app/tests -m smoke -q --override-ini "addopts=--strict-markers" diff --git a/api/setup.cfg b/api/setup.cfg index 3c3d26b0e..652123ea7 100755 --- a/api/setup.cfg +++ b/api/setup.cfg @@ -1,38 +1,3 @@ -[metadata] -name = queue_api -url = https://github.com/bcgov/queue-management/ -author = Service BC Team -author_email = -classifiers = - Development Status :: Beta - Intended Audience :: Developers / QA - Topic :: Service BC - License :: OSI Approved :: Apache Software License - Natural Language :: English - Programming Language :: Python :: 3.6 -license = Apache Software License Version 2.0 -description = A short description of the project -long_description = file: README.md -keywords = - -[options] -zip_safe = True -python_requires = >=3.6 -include_package_data = True -packages = find: - -[options.package_data] -queue_api = - -[wheel] -universal = 1 - -[bdist_wheel] -universal = 1 - -[aliases] -test = pytest - [flake8] ignore = I001, I003, I004, E126, W504 exclude = .git,*migrations* @@ -79,7 +44,15 @@ lines_after_imports = 2 [tool:pytest] -addopts = --cov=src --cov-report html:htmlcov --cov-report xml:coverage.xml -testpaths = tests/unit +addopts = --strict-markers --cov=app --cov-branch --cov-report html:htmlcov --cov-report xml:coverage.xml +testpaths = app/tests +python_files = test*.py +markers = + integration: Disposable-Postgres integration coverage that requires the seeded API harness. + contracts: Stable API contract and smoke assertions for seeded local test data. + flows: Stateful end-to-end API regression workflows translated from the legacy Postman collections. + auth: Authorization boundary tests for seeded synthetic identities. + validation: Input validation and error handling assertions. + smoke: Infrastructure and compatibility smoke assertions. filterwarnings = ignore::UserWarning diff --git a/api/setup.py b/api/setup.py deleted file mode 100755 index c5a322c53..000000000 --- a/api/setup.py +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright © 2019 Province of British Columbia. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Installer and setup for this module -""" -from glob import glob -from os.path import basename, splitext - -from setuptools import find_packages, setup - - -def read_requirements(filename): - """ - Get application requirements from - the requirements.txt file. - :return: Python requirements - :rtype: list - """ - with open(filename, 'r') as req: - requirements = req.readlines() - install_requires = [r.strip() for r in requirements if r.find('git+') != 0] - return install_requires - - -def read(filepath): - """ - Read the contents from a file. - :param str filepath: path to the file to be read - :return: file contents - :rtype: str - """ - with open(filepath, 'r') as file_handle: - content = file_handle.read() - return content - - -REQUIREMENTS = read_requirements('requirements.txt') - -setup( - name="queue_api", - packages=find_packages() -) diff --git a/api/sqlalchemy_utc.py b/api/sqlalchemy_utc.py new file mode 100644 index 000000000..d3738a8fc --- /dev/null +++ b/api/sqlalchemy_utc.py @@ -0,0 +1,7 @@ +"""Compatibility shim for legacy Alembic migrations and local model imports.""" + +from app.utilities.sqlalchemy_compat import UtcDateTime, utcnow + + +class sqltypes: + UtcDateTime = UtcDateTime diff --git a/api/templates/admin/base.html b/api/templates/admin/base.html index f334c51ee..29eb2c376 100644 --- a/api/templates/admin/base.html +++ b/api/templates/admin/base.html @@ -1,7 +1,7 @@ {% import 'admin/layout.html' as layout with context -%} {% import 'admin/static.html' as admin_static with context %} - + {% block title %}{% if admin_view.category %}{{ admin_view.category }} - {% endif %}{{ admin_view.name }} - {{ admin_view.admin.name }}{% endblock %} {% block head_meta %} @@ -12,71 +12,57 @@ {% endblock %} {% block head_css %} - - {%if config.get('FLASK_ADMIN_SWATCH', 'default') == 'default' %} - - {%endif%} - + + {% if theme.swatch == 'default' %} + + {% endif %} + + {% if admin_view.extra_css %} {% for css_url in admin_view.extra_css %} - + {% endfor %} {% endif %} - {% endblock %} {% block head %} {% endblock %} {% block head_tail %} {% endblock %} - - {% block page_body %} -
- {% block messages %} - {{ layout.messages() }} - {% endblock %} - {# store the jinja2 context for form_rules rendering logic #} - {% set render_ctx = h.resolve_ctx() %} - {% block body %}{% endblock %} - {% endblock %} + +{% block page_body %} +
+ {% block messages %} + {{ layout.messages() }} + {% endblock %} + + {% set render_ctx = h.resolve_ctx() %} + + {% block body %}{% endblock %} +
+{% endblock %} - {% block tail_js %} - - - - - +{% block tail_js %} + + + + + + + + + {% if admin_view.extra_js %} - {% for js_url in admin_view.extra_js %} - - {% endfor %} + {% for js_url in admin_view.extra_js %} + + {% endfor %} {% endif %} - {% endblock %} +{% endblock %} + {% block tail %} {% endblock %} - - {% if not current_user.is_authenticated %} -
- {{ layout.menu_links() }} - {{ current_user.username }} -
- {% endif %} diff --git a/api/templates/admin/home.html b/api/templates/admin/home.html new file mode 100644 index 000000000..16d60d8be --- /dev/null +++ b/api/templates/admin/home.html @@ -0,0 +1,7 @@ +{% extends 'admin/master.html' %} + +{% block body %} +
+

{{ admin_view.admin.name }}

+
+{% endblock %} diff --git a/api/templates/office/office_create.html b/api/templates/office/office_create.html index 578d64869..9569e8d7b 100644 --- a/api/templates/office/office_create.html +++ b/api/templates/office/office_create.html @@ -3,10 +3,7 @@ {{ super() }} {% endblock %} {% block tail_js %} - - - - + {{ super() }} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/api/templates/office/office_edit.html b/api/templates/office/office_edit.html index bedfaf03a..d44c4eacd 100644 --- a/api/templates/office/office_edit.html +++ b/api/templates/office/office_edit.html @@ -3,10 +3,7 @@ {{ super() }} {% endblock %} {% block tail_js %} - - - - + {{ super() }} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/api/templates/office/officega_create.html b/api/templates/office/officega_create.html index c44267df5..4cde4015b 100644 --- a/api/templates/office/officega_create.html +++ b/api/templates/office/officega_create.html @@ -3,10 +3,7 @@ {{ super() }} {% endblock %} {% block tail_js %} - - - - + {{ super() }} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/api/templates/office/officega_edit.html b/api/templates/office/officega_edit.html index 8d4a4e71e..5d40a3861 100644 --- a/api/templates/office/officega_edit.html +++ b/api/templates/office/officega_edit.html @@ -3,10 +3,7 @@ {{ super() }} {% endblock %} {% block tail_js %} - - - - + {{ super() }} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/api/uv.lock b/api/uv.lock new file mode 100644 index 000000000..13a55b1aa --- /dev/null +++ b/api/uv.lock @@ -0,0 +1,1406 @@ +version = 1 +revision = 3 +requires-python = "==3.14.*" + +[[package]] +name = "alembic" +version = "1.18.4" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "mako" }, + { name = "sqlalchemy" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/94/13/8b084e0f2efb0275a1d534838844926f798bd766566b1375174e2448cd31/alembic-1.18.4.tar.gz", hash = "sha256:cb6e1fd84b6174ab8dbb2329f86d631ba9559dd78df550b57804d607672cedbc", size = 2056725, upload-time = "2026-02-10T16:00:47.195Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d2/29/6533c317b74f707ea28f8d633734dbda2119bbadfc61b2f3640ba835d0f7/alembic-1.18.4-py3-none-any.whl", hash = "sha256:a5ed4adcf6d8a4cb575f3d759f071b03cd6e5c7618eb796cb52497be25bfe19a", size = 263893, upload-time = "2026-02-10T16:00:49.997Z" }, +] + +[[package]] +name = "amqp" +version = "5.3.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "vine" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/79/fc/ec94a357dfc6683d8c86f8b4cfa5416a4c36b28052ec8260c77aca96a443/amqp-5.3.1.tar.gz", hash = "sha256:cddc00c725449522023bad949f70fff7b48f0b1ade74d170a6f10ab044739432", size = 129013, upload-time = "2024-11-12T19:55:44.051Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/26/99/fc813cd978842c26c82534010ea849eee9ab3a13ea2b74e95cb9c99e747b/amqp-5.3.1-py3-none-any.whl", hash = "sha256:43b3319e1b4e7d1251833a93d672b4af1e40f3d632d479b98661a95f117880a2", size = 50944, upload-time = "2024-11-12T19:55:41.782Z" }, +] + +[[package]] +name = "aniso8601" +version = "10.0.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/8b/8d/52179c4e3f1978d3d9a285f98c706642522750ef343e9738286130423730/aniso8601-10.0.1.tar.gz", hash = "sha256:25488f8663dd1528ae1f54f94ac1ea51ae25b4d531539b8bc707fed184d16845", size = 47190, upload-time = "2025-04-18T17:29:42.995Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/59/75/e0e10dc7ed1408c28e03a6cb2d7a407f99320eb953f229d008a7a6d05546/aniso8601-10.0.1-py2.py3-none-any.whl", hash = "sha256:eb19717fd4e0db6de1aab06f12450ab92144246b257423fe020af5748c0cb89e", size = 52848, upload-time = "2025-04-18T17:29:41.492Z" }, +] + +[[package]] +name = "argon2-cffi" +version = "25.1.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "argon2-cffi-bindings" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/0e/89/ce5af8a7d472a67cc819d5d998aa8c82c5d860608c4db9f46f1162d7dab9/argon2_cffi-25.1.0.tar.gz", hash = "sha256:694ae5cc8a42f4c4e2bf2ca0e64e51e23a040c6a517a85074683d3959e1346c1", size = 45706, upload-time = "2025-06-03T06:55:32.073Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/4f/d3/a8b22fa575b297cd6e3e3b0155c7e25db170edf1c74783d6a31a2490b8d9/argon2_cffi-25.1.0-py3-none-any.whl", hash = "sha256:fdc8b074db390fccb6eb4a3604ae7231f219aa669a2652e0f20e16ba513d5741", size = 14657, upload-time = "2025-06-03T06:55:30.804Z" }, +] + +[[package]] +name = "argon2-cffi-bindings" +version = "25.1.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "cffi" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/5c/2d/db8af0df73c1cf454f71b2bbe5e356b8c1f8041c979f505b3d3186e520a9/argon2_cffi_bindings-25.1.0.tar.gz", hash = "sha256:b957f3e6ea4d55d820e40ff76f450952807013d361a65d7f28acc0acbf29229d", size = 1783441, upload-time = "2025-07-30T10:02:05.147Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/60/97/3c0a35f46e52108d4707c44b95cfe2afcafc50800b5450c197454569b776/argon2_cffi_bindings-25.1.0-cp314-cp314t-macosx_10_13_universal2.whl", hash = "sha256:3d3f05610594151994ca9ccb3c771115bdb4daef161976a266f0dd8aa9996b8f", size = 54393, upload-time = "2025-07-30T10:01:40.97Z" }, + { url = "https://files.pythonhosted.org/packages/9d/f4/98bbd6ee89febd4f212696f13c03ca302b8552e7dbf9c8efa11ea4a388c3/argon2_cffi_bindings-25.1.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:8b8efee945193e667a396cbc7b4fb7d357297d6234d30a489905d96caabde56b", size = 29328, upload-time = "2025-07-30T10:01:41.916Z" }, + { url = "https://files.pythonhosted.org/packages/43/24/90a01c0ef12ac91a6be05969f29944643bc1e5e461155ae6559befa8f00b/argon2_cffi_bindings-25.1.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:3c6702abc36bf3ccba3f802b799505def420a1b7039862014a65db3205967f5a", size = 31269, upload-time = "2025-07-30T10:01:42.716Z" }, + { url = "https://files.pythonhosted.org/packages/d4/d3/942aa10782b2697eee7af5e12eeff5ebb325ccfb86dd8abda54174e377e4/argon2_cffi_bindings-25.1.0-cp314-cp314t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a1c70058c6ab1e352304ac7e3b52554daadacd8d453c1752e547c76e9c99ac44", size = 86558, upload-time = "2025-07-30T10:01:43.943Z" }, + { url = "https://files.pythonhosted.org/packages/0d/82/b484f702fec5536e71836fc2dbc8c5267b3f6e78d2d539b4eaa6f0db8bf8/argon2_cffi_bindings-25.1.0-cp314-cp314t-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e2fd3bfbff3c5d74fef31a722f729bf93500910db650c925c2d6ef879a7e51cb", size = 92364, upload-time = "2025-07-30T10:01:44.887Z" }, + { url = "https://files.pythonhosted.org/packages/c9/c1/a606ff83b3f1735f3759ad0f2cd9e038a0ad11a3de3b6c673aa41c24bb7b/argon2_cffi_bindings-25.1.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:c4f9665de60b1b0e99bcd6be4f17d90339698ce954cfd8d9cf4f91c995165a92", size = 85637, upload-time = "2025-07-30T10:01:46.225Z" }, + { url = "https://files.pythonhosted.org/packages/44/b4/678503f12aceb0262f84fa201f6027ed77d71c5019ae03b399b97caa2f19/argon2_cffi_bindings-25.1.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:ba92837e4a9aa6a508c8d2d7883ed5a8f6c308c89a4790e1e447a220deb79a85", size = 91934, upload-time = "2025-07-30T10:01:47.203Z" }, + { url = "https://files.pythonhosted.org/packages/f0/c7/f36bd08ef9bd9f0a9cff9428406651f5937ce27b6c5b07b92d41f91ae541/argon2_cffi_bindings-25.1.0-cp314-cp314t-win32.whl", hash = "sha256:84a461d4d84ae1295871329b346a97f68eade8c53b6ed9a7ca2d7467f3c8ff6f", size = 28158, upload-time = "2025-07-30T10:01:48.341Z" }, + { url = "https://files.pythonhosted.org/packages/b3/80/0106a7448abb24a2c467bf7d527fe5413b7fdfa4ad6d6a96a43a62ef3988/argon2_cffi_bindings-25.1.0-cp314-cp314t-win_amd64.whl", hash = "sha256:b55aec3565b65f56455eebc9b9f34130440404f27fe21c3b375bf1ea4d8fbae6", size = 32597, upload-time = "2025-07-30T10:01:49.112Z" }, + { url = "https://files.pythonhosted.org/packages/05/b8/d663c9caea07e9180b2cb662772865230715cbd573ba3b5e81793d580316/argon2_cffi_bindings-25.1.0-cp314-cp314t-win_arm64.whl", hash = "sha256:87c33a52407e4c41f3b70a9c2d3f6056d88b10dad7695be708c5021673f55623", size = 28231, upload-time = "2025-07-30T10:01:49.92Z" }, + { url = "https://files.pythonhosted.org/packages/1d/57/96b8b9f93166147826da5f90376e784a10582dd39a393c99bb62cfcf52f0/argon2_cffi_bindings-25.1.0-cp39-abi3-macosx_10_9_universal2.whl", hash = "sha256:aecba1723ae35330a008418a91ea6cfcedf6d31e5fbaa056a166462ff066d500", size = 54121, upload-time = "2025-07-30T10:01:50.815Z" }, + { url = "https://files.pythonhosted.org/packages/0a/08/a9bebdb2e0e602dde230bdde8021b29f71f7841bd54801bcfd514acb5dcf/argon2_cffi_bindings-25.1.0-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:2630b6240b495dfab90aebe159ff784d08ea999aa4b0d17efa734055a07d2f44", size = 29177, upload-time = "2025-07-30T10:01:51.681Z" }, + { url = "https://files.pythonhosted.org/packages/b6/02/d297943bcacf05e4f2a94ab6f462831dc20158614e5d067c35d4e63b9acb/argon2_cffi_bindings-25.1.0-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:7aef0c91e2c0fbca6fc68e7555aa60ef7008a739cbe045541e438373bc54d2b0", size = 31090, upload-time = "2025-07-30T10:01:53.184Z" }, + { url = "https://files.pythonhosted.org/packages/c1/93/44365f3d75053e53893ec6d733e4a5e3147502663554b4d864587c7828a7/argon2_cffi_bindings-25.1.0-cp39-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1e021e87faa76ae0d413b619fe2b65ab9a037f24c60a1e6cc43457ae20de6dc6", size = 81246, upload-time = "2025-07-30T10:01:54.145Z" }, + { url = "https://files.pythonhosted.org/packages/09/52/94108adfdd6e2ddf58be64f959a0b9c7d4ef2fa71086c38356d22dc501ea/argon2_cffi_bindings-25.1.0-cp39-abi3-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d3e924cfc503018a714f94a49a149fdc0b644eaead5d1f089330399134fa028a", size = 87126, upload-time = "2025-07-30T10:01:55.074Z" }, + { url = "https://files.pythonhosted.org/packages/72/70/7a2993a12b0ffa2a9271259b79cc616e2389ed1a4d93842fac5a1f923ffd/argon2_cffi_bindings-25.1.0-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:c87b72589133f0346a1cb8d5ecca4b933e3c9b64656c9d175270a000e73b288d", size = 80343, upload-time = "2025-07-30T10:01:56.007Z" }, + { url = "https://files.pythonhosted.org/packages/78/9a/4e5157d893ffc712b74dbd868c7f62365618266982b64accab26bab01edc/argon2_cffi_bindings-25.1.0-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:1db89609c06afa1a214a69a462ea741cf735b29a57530478c06eb81dd403de99", size = 86777, upload-time = "2025-07-30T10:01:56.943Z" }, + { url = "https://files.pythonhosted.org/packages/74/cd/15777dfde1c29d96de7f18edf4cc94c385646852e7c7b0320aa91ccca583/argon2_cffi_bindings-25.1.0-cp39-abi3-win32.whl", hash = "sha256:473bcb5f82924b1becbb637b63303ec8d10e84c8d241119419897a26116515d2", size = 27180, upload-time = "2025-07-30T10:01:57.759Z" }, + { url = "https://files.pythonhosted.org/packages/e2/c6/a759ece8f1829d1f162261226fbfd2c6832b3ff7657384045286d2afa384/argon2_cffi_bindings-25.1.0-cp39-abi3-win_amd64.whl", hash = "sha256:a98cd7d17e9f7ce244c0803cad3c23a7d379c301ba618a5fa76a67d116618b98", size = 31715, upload-time = "2025-07-30T10:01:58.56Z" }, + { url = "https://files.pythonhosted.org/packages/42/b9/f8d6fa329ab25128b7e98fd83a3cb34d9db5b059a9847eddb840a0af45dd/argon2_cffi_bindings-25.1.0-cp39-abi3-win_arm64.whl", hash = "sha256:b0fdbcf513833809c882823f98dc2f931cf659d9a1429616ac3adebb49f5db94", size = 27149, upload-time = "2025-07-30T10:01:59.329Z" }, +] + +[[package]] +name = "astroid" +version = "4.0.4" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/07/63/0adf26577da5eff6eb7a177876c1cfa213856be9926a000f65c4add9692b/astroid-4.0.4.tar.gz", hash = "sha256:986fed8bcf79fb82c78b18a53352a0b287a73817d6dbcfba3162da36667c49a0", size = 406358, upload-time = "2026-02-07T23:35:07.509Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b0/cf/1c5f42b110e57bc5502eb80dbc3b03d256926062519224835ef08134f1f9/astroid-4.0.4-py3-none-any.whl", hash = "sha256:52f39653876c7dec3e3afd4c2696920e05c83832b9737afc21928f2d2eb7a753", size = 276445, upload-time = "2026-02-07T23:35:05.344Z" }, +] + +[[package]] +name = "attrs" +version = "26.1.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/9a/8e/82a0fe20a541c03148528be8cac2408564a6c9a0cc7e9171802bc1d26985/attrs-26.1.0.tar.gz", hash = "sha256:d03ceb89cb322a8fd706d4fb91940737b6642aa36998fe130a9bc96c985eff32", size = 952055, upload-time = "2026-03-19T14:22:25.026Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/64/b4/17d4b0b2a2dc85a6df63d1157e028ed19f90d4cd97c36717afef2bc2f395/attrs-26.1.0-py3-none-any.whl", hash = "sha256:c647aa4a12dfbad9333ca4e71fe62ddc36f4e63b2d260a37a8b83d2f043ac309", size = 67548, upload-time = "2026-03-19T14:22:23.645Z" }, +] + +[[package]] +name = "bidict" +version = "0.23.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/9a/6e/026678aa5a830e07cd9498a05d3e7e650a4f56a42f267a53d22bcda1bdc9/bidict-0.23.1.tar.gz", hash = "sha256:03069d763bc387bbd20e7d49914e75fc4132a41937fa3405417e1a5a2d006d71", size = 29093, upload-time = "2024-02-18T19:09:05.748Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/99/37/e8730c3587a65eb5645d4aba2d27aae48e8003614d6aaf15dda67f702f1f/bidict-0.23.1-py3-none-any.whl", hash = "sha256:5dae8d4d79b552a71cbabc7deb25dfe8ce710b17ff41711e13010ead2abfc3e5", size = 32764, upload-time = "2024-02-18T19:09:04.156Z" }, +] + +[[package]] +name = "blinker" +version = "1.9.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/21/28/9b3f50ce0e048515135495f198351908d99540d69bfdc8c1d15b73dc55ce/blinker-1.9.0.tar.gz", hash = "sha256:b4ce2265a7abece45e7cc896e98dbebe6cead56bcf805a3d23136d145f5445bf", size = 22460, upload-time = "2024-11-08T17:25:47.436Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/10/cb/f2ad4230dc2eb1a74edf38f1a38b9b52277f75bef262d8908e60d957e13c/blinker-1.9.0-py3-none-any.whl", hash = "sha256:ba0efaa9080b619ff2f3459d1d500c57bddea4a6b424b60a91141db6fd2f08bc", size = 8458, upload-time = "2024-11-08T17:25:46.184Z" }, +] + +[[package]] +name = "brotli" +version = "1.2.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f7/16/c92ca344d646e71a43b8bb353f0a6490d7f6e06210f8554c8f874e454285/brotli-1.2.0.tar.gz", hash = "sha256:e310f77e41941c13340a95976fe66a8a95b01e783d430eeaf7a2f87e0a57dd0a", size = 7388632, upload-time = "2025-11-05T18:39:42.86Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/17/e1/298c2ddf786bb7347a1cd71d63a347a79e5712a7c0cba9e3c3458ebd976f/brotli-1.2.0-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:6c12dad5cd04530323e723787ff762bac749a7b256a5bece32b2243dd5c27b21", size = 863080, upload-time = "2025-11-05T18:38:45.503Z" }, + { url = "https://files.pythonhosted.org/packages/84/0c/aac98e286ba66868b2b3b50338ffbd85a35c7122e9531a73a37a29763d38/brotli-1.2.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:3219bd9e69868e57183316ee19c84e03e8f8b5a1d1f2667e1aa8c2f91cb061ac", size = 445453, upload-time = "2025-11-05T18:38:46.433Z" }, + { url = "https://files.pythonhosted.org/packages/ec/f1/0ca1f3f99ae300372635ab3fe2f7a79fa335fee3d874fa7f9e68575e0e62/brotli-1.2.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:963a08f3bebd8b75ac57661045402da15991468a621f014be54e50f53a58d19e", size = 1528168, upload-time = "2025-11-05T18:38:47.371Z" }, + { url = "https://files.pythonhosted.org/packages/d6/a6/2ebfc8f766d46df8d3e65b880a2e220732395e6d7dc312c1e1244b0f074a/brotli-1.2.0-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:9322b9f8656782414b37e6af884146869d46ab85158201d82bab9abbcb971dc7", size = 1627098, upload-time = "2025-11-05T18:38:48.385Z" }, + { url = "https://files.pythonhosted.org/packages/f3/2f/0976d5b097ff8a22163b10617f76b2557f15f0f39d6a0fe1f02b1a53e92b/brotli-1.2.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:cf9cba6f5b78a2071ec6fb1e7bd39acf35071d90a81231d67e92d637776a6a63", size = 1419861, upload-time = "2025-11-05T18:38:49.372Z" }, + { url = "https://files.pythonhosted.org/packages/9c/97/d76df7176a2ce7616ff94c1fb72d307c9a30d2189fe877f3dd99af00ea5a/brotli-1.2.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:7547369c4392b47d30a3467fe8c3330b4f2e0f7730e45e3103d7d636678a808b", size = 1484594, upload-time = "2025-11-05T18:38:50.655Z" }, + { url = "https://files.pythonhosted.org/packages/d3/93/14cf0b1216f43df5609f5b272050b0abd219e0b54ea80b47cef9867b45e7/brotli-1.2.0-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:fc1530af5c3c275b8524f2e24841cbe2599d74462455e9bae5109e9ff42e9361", size = 1593455, upload-time = "2025-11-05T18:38:51.624Z" }, + { url = "https://files.pythonhosted.org/packages/b3/73/3183c9e41ca755713bdf2cc1d0810df742c09484e2e1ddd693bee53877c1/brotli-1.2.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:d2d085ded05278d1c7f65560aae97b3160aeb2ea2c0b3e26204856beccb60888", size = 1488164, upload-time = "2025-11-05T18:38:53.079Z" }, + { url = "https://files.pythonhosted.org/packages/64/6a/0c78d8f3a582859236482fd9fa86a65a60328a00983006bcf6d83b7b2253/brotli-1.2.0-cp314-cp314-win32.whl", hash = "sha256:832c115a020e463c2f67664560449a7bea26b0c1fdd690352addad6d0a08714d", size = 339280, upload-time = "2025-11-05T18:38:54.02Z" }, + { url = "https://files.pythonhosted.org/packages/f5/10/56978295c14794b2c12007b07f3e41ba26acda9257457d7085b0bb3bb90c/brotli-1.2.0-cp314-cp314-win_amd64.whl", hash = "sha256:e7c0af964e0b4e3412a0ebf341ea26ec767fa0b4cf81abb5e897c9338b5ad6a3", size = 375639, upload-time = "2025-11-05T18:38:55.67Z" }, +] + +[[package]] +name = "brotlicffi" +version = "1.2.0.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "cffi" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/8a/b6/017dc5f852ed9b8735af77774509271acbf1de02d238377667145fcee01d/brotlicffi-1.2.0.1.tar.gz", hash = "sha256:c20d5c596278307ad06414a6d95a892377ea274a5c6b790c2548c009385d621c", size = 478156, upload-time = "2026-03-05T19:54:11.547Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ef/f9/dfa56316837fa798eac19358351e974de8e1e2ca9475af4cb90293cd6576/brotlicffi-1.2.0.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:2c85e65913cf2b79c57a3fdd05b98d9731d9255dc0cb696b09376cc091b9cddd", size = 433046, upload-time = "2026-03-05T19:53:46.209Z" }, + { url = "https://files.pythonhosted.org/packages/4a/f5/f8f492158c76b0d940388801f04f747028971ad5774287bded5f1e53f08d/brotlicffi-1.2.0.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:535f2d05d0273408abc13fc0eebb467afac17b0ad85090c8913690d40207dac5", size = 1541126, upload-time = "2026-03-05T19:53:48.248Z" }, + { url = "https://files.pythonhosted.org/packages/3b/e1/ff87af10ac419600c63e9287a0649c673673ae6b4f2bcf48e96cb2f89f60/brotlicffi-1.2.0.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ce17eb798ca59ecec67a9bb3fd7a4304e120d1cd02953ce522d959b9a84d58ac", size = 1541983, upload-time = "2026-03-05T19:53:50.317Z" }, + { url = "https://files.pythonhosted.org/packages/47/c0/80ecd9bd45776109fab14040e478bf63e456967c9ddee2353d8330ed8de1/brotlicffi-1.2.0.1-cp314-cp314t-win32.whl", hash = "sha256:3c9544f83cb715d95d7eab3af4adbbef8b2093ad6382288a83b3a25feb1a57ec", size = 349047, upload-time = "2026-03-05T19:53:52.215Z" }, + { url = "https://files.pythonhosted.org/packages/ab/98/13e5b250236a281b6cd9e92a01ee1ae231029fa78faee932ef3766e1cb24/brotlicffi-1.2.0.1-cp314-cp314t-win_amd64.whl", hash = "sha256:625f8115d32ae9c0740d01ea51518437c3fbaa3e78d41cb18459f6f7ac326000", size = 385652, upload-time = "2026-03-05T19:53:53.892Z" }, + { url = "https://files.pythonhosted.org/packages/9a/9f/b98dcd4af47994cee97aebac866996a006a2e5fc1fd1e2b82a8ad95cf09c/brotlicffi-1.2.0.1-cp38-abi3-macosx_11_0_arm64.whl", hash = "sha256:91ba5f0ccc040f6ff8f7efaf839f797723d03ed46acb8ae9408f99ffd2572cf4", size = 432608, upload-time = "2026-03-05T19:53:56.736Z" }, + { url = "https://files.pythonhosted.org/packages/b1/7a/ac4ee56595a061e3718a6d1ea7e921f4df156894acffb28ed88a1fd52022/brotlicffi-1.2.0.1-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:be9a670c6811af30a4bd42d7116dc5895d3b41beaa8ed8a89050447a0181f5ce", size = 1534257, upload-time = "2026-03-05T19:53:58.667Z" }, + { url = "https://files.pythonhosted.org/packages/99/39/e7410db7f6f56de57744ea52a115084ceb2735f4d44973f349bb92136586/brotlicffi-1.2.0.1-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6f3314a3476f59e5443f9f72a6dff16edc0c3463c9b318feaef04ae3e4683f5a", size = 1536838, upload-time = "2026-03-05T19:54:00.705Z" }, + { url = "https://files.pythonhosted.org/packages/a6/75/6e7977d1935fc3fbb201cbd619be8f2c7aea25d40a096967132854b34708/brotlicffi-1.2.0.1-cp38-abi3-win32.whl", hash = "sha256:82ea52e2b5d3145b6c406ebd3efb0d55db718b7ad996bd70c62cec0439de1187", size = 343337, upload-time = "2026-03-05T19:54:02.446Z" }, + { url = "https://files.pythonhosted.org/packages/d8/ef/e7e485ce5e4ba3843a0a92feb767c7b6098fd6e65ce752918074d175ae71/brotlicffi-1.2.0.1-cp38-abi3-win_amd64.whl", hash = "sha256:da2e82a08e7778b8bc539d27ca03cdd684113e81394bfaaad8d0dfc6a17ddede", size = 379026, upload-time = "2026-03-05T19:54:04.322Z" }, +] + +[[package]] +name = "cachelib" +version = "0.13.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/1d/69/0b5c1259e12fbcf5c2abe5934b5c0c1294ec0f845e2b4b2a51a91d79a4fb/cachelib-0.13.0.tar.gz", hash = "sha256:209d8996e3c57595bee274ff97116d1d73c4980b2fd9a34c7846cd07fd2e1a48", size = 34418, upload-time = "2024-04-13T14:18:27.782Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/9b/42/960fc9896ddeb301716fdd554bab7941c35fb90a1dc7260b77df3366f87f/cachelib-0.13.0-py3-none-any.whl", hash = "sha256:8c8019e53b6302967d4e8329a504acf75e7bc46130291d30188a6e4e58162516", size = 20914, upload-time = "2024-04-13T14:18:26.361Z" }, +] + +[[package]] +name = "certifi" +version = "2026.2.25" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/af/2d/7bf41579a8986e348fa033a31cdd0e4121114f6bce2457e8876010b092dd/certifi-2026.2.25.tar.gz", hash = "sha256:e887ab5cee78ea814d3472169153c2d12cd43b14bd03329a39a9c6e2e80bfba7", size = 155029, upload-time = "2026-02-25T02:54:17.342Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/9a/3c/c17fb3ca2d9c3acff52e30b309f538586f9f5b9c9cf454f3845fc9af4881/certifi-2026.2.25-py3-none-any.whl", hash = "sha256:027692e4402ad994f1c42e52a4997a9763c646b73e4096e4d5d6db8af1d6f0fa", size = 153684, upload-time = "2026-02-25T02:54:15.766Z" }, +] + +[[package]] +name = "cffi" +version = "2.0.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pycparser", marker = "implementation_name != 'PyPy'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/eb/56/b1ba7935a17738ae8453301356628e8147c79dbb825bcbc73dc7401f9846/cffi-2.0.0.tar.gz", hash = "sha256:44d1b5909021139fe36001ae048dbdde8214afa20200eda0f64c068cac5d5529", size = 523588, upload-time = "2025-09-08T23:24:04.541Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/92/c4/3ce07396253a83250ee98564f8d7e9789fab8e58858f35d07a9a2c78de9f/cffi-2.0.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:fc33c5141b55ed366cfaad382df24fe7dcbc686de5be719b207bb248e3053dc5", size = 185320, upload-time = "2025-09-08T23:23:18.087Z" }, + { url = "https://files.pythonhosted.org/packages/59/dd/27e9fa567a23931c838c6b02d0764611c62290062a6d4e8ff7863daf9730/cffi-2.0.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:c654de545946e0db659b3400168c9ad31b5d29593291482c43e3564effbcee13", size = 181487, upload-time = "2025-09-08T23:23:19.622Z" }, + { url = "https://files.pythonhosted.org/packages/d6/43/0e822876f87ea8a4ef95442c3d766a06a51fc5298823f884ef87aaad168c/cffi-2.0.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:24b6f81f1983e6df8db3adc38562c83f7d4a0c36162885ec7f7b77c7dcbec97b", size = 220049, upload-time = "2025-09-08T23:23:20.853Z" }, + { url = "https://files.pythonhosted.org/packages/b4/89/76799151d9c2d2d1ead63c2429da9ea9d7aac304603de0c6e8764e6e8e70/cffi-2.0.0-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:12873ca6cb9b0f0d3a0da705d6086fe911591737a59f28b7936bdfed27c0d47c", size = 207793, upload-time = "2025-09-08T23:23:22.08Z" }, + { url = "https://files.pythonhosted.org/packages/bb/dd/3465b14bb9e24ee24cb88c9e3730f6de63111fffe513492bf8c808a3547e/cffi-2.0.0-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:d9b97165e8aed9272a6bb17c01e3cc5871a594a446ebedc996e2397a1c1ea8ef", size = 206300, upload-time = "2025-09-08T23:23:23.314Z" }, + { url = "https://files.pythonhosted.org/packages/47/d9/d83e293854571c877a92da46fdec39158f8d7e68da75bf73581225d28e90/cffi-2.0.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:afb8db5439b81cf9c9d0c80404b60c3cc9c3add93e114dcae767f1477cb53775", size = 219244, upload-time = "2025-09-08T23:23:24.541Z" }, + { url = "https://files.pythonhosted.org/packages/2b/0f/1f177e3683aead2bb00f7679a16451d302c436b5cbf2505f0ea8146ef59e/cffi-2.0.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:737fe7d37e1a1bffe70bd5754ea763a62a066dc5913ca57e957824b72a85e205", size = 222828, upload-time = "2025-09-08T23:23:26.143Z" }, + { url = "https://files.pythonhosted.org/packages/c6/0f/cafacebd4b040e3119dcb32fed8bdef8dfe94da653155f9d0b9dc660166e/cffi-2.0.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:38100abb9d1b1435bc4cc340bb4489635dc2f0da7456590877030c9b3d40b0c1", size = 220926, upload-time = "2025-09-08T23:23:27.873Z" }, + { url = "https://files.pythonhosted.org/packages/3e/aa/df335faa45b395396fcbc03de2dfcab242cd61a9900e914fe682a59170b1/cffi-2.0.0-cp314-cp314-win32.whl", hash = "sha256:087067fa8953339c723661eda6b54bc98c5625757ea62e95eb4898ad5e776e9f", size = 175328, upload-time = "2025-09-08T23:23:44.61Z" }, + { url = "https://files.pythonhosted.org/packages/bb/92/882c2d30831744296ce713f0feb4c1cd30f346ef747b530b5318715cc367/cffi-2.0.0-cp314-cp314-win_amd64.whl", hash = "sha256:203a48d1fb583fc7d78a4c6655692963b860a417c0528492a6bc21f1aaefab25", size = 185650, upload-time = "2025-09-08T23:23:45.848Z" }, + { url = "https://files.pythonhosted.org/packages/9f/2c/98ece204b9d35a7366b5b2c6539c350313ca13932143e79dc133ba757104/cffi-2.0.0-cp314-cp314-win_arm64.whl", hash = "sha256:dbd5c7a25a7cb98f5ca55d258b103a2054f859a46ae11aaf23134f9cc0d356ad", size = 180687, upload-time = "2025-09-08T23:23:47.105Z" }, + { url = "https://files.pythonhosted.org/packages/3e/61/c768e4d548bfa607abcda77423448df8c471f25dbe64fb2ef6d555eae006/cffi-2.0.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:9a67fc9e8eb39039280526379fb3a70023d77caec1852002b4da7e8b270c4dd9", size = 188773, upload-time = "2025-09-08T23:23:29.347Z" }, + { url = "https://files.pythonhosted.org/packages/2c/ea/5f76bce7cf6fcd0ab1a1058b5af899bfbef198bea4d5686da88471ea0336/cffi-2.0.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:7a66c7204d8869299919db4d5069a82f1561581af12b11b3c9f48c584eb8743d", size = 185013, upload-time = "2025-09-08T23:23:30.63Z" }, + { url = "https://files.pythonhosted.org/packages/be/b4/c56878d0d1755cf9caa54ba71e5d049479c52f9e4afc230f06822162ab2f/cffi-2.0.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:7cc09976e8b56f8cebd752f7113ad07752461f48a58cbba644139015ac24954c", size = 221593, upload-time = "2025-09-08T23:23:31.91Z" }, + { url = "https://files.pythonhosted.org/packages/e0/0d/eb704606dfe8033e7128df5e90fee946bbcb64a04fcdaa97321309004000/cffi-2.0.0-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:92b68146a71df78564e4ef48af17551a5ddd142e5190cdf2c5624d0c3ff5b2e8", size = 209354, upload-time = "2025-09-08T23:23:33.214Z" }, + { url = "https://files.pythonhosted.org/packages/d8/19/3c435d727b368ca475fb8742ab97c9cb13a0de600ce86f62eab7fa3eea60/cffi-2.0.0-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:b1e74d11748e7e98e2f426ab176d4ed720a64412b6a15054378afdb71e0f37dc", size = 208480, upload-time = "2025-09-08T23:23:34.495Z" }, + { url = "https://files.pythonhosted.org/packages/d0/44/681604464ed9541673e486521497406fadcc15b5217c3e326b061696899a/cffi-2.0.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:28a3a209b96630bca57cce802da70c266eb08c6e97e5afd61a75611ee6c64592", size = 221584, upload-time = "2025-09-08T23:23:36.096Z" }, + { url = "https://files.pythonhosted.org/packages/25/8e/342a504ff018a2825d395d44d63a767dd8ebc927ebda557fecdaca3ac33a/cffi-2.0.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:7553fb2090d71822f02c629afe6042c299edf91ba1bf94951165613553984512", size = 224443, upload-time = "2025-09-08T23:23:37.328Z" }, + { url = "https://files.pythonhosted.org/packages/e1/5e/b666bacbbc60fbf415ba9988324a132c9a7a0448a9a8f125074671c0f2c3/cffi-2.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:6c6c373cfc5c83a975506110d17457138c8c63016b563cc9ed6e056a82f13ce4", size = 223437, upload-time = "2025-09-08T23:23:38.945Z" }, + { url = "https://files.pythonhosted.org/packages/a0/1d/ec1a60bd1a10daa292d3cd6bb0b359a81607154fb8165f3ec95fe003b85c/cffi-2.0.0-cp314-cp314t-win32.whl", hash = "sha256:1fc9ea04857caf665289b7a75923f2c6ed559b8298a1b8c49e59f7dd95c8481e", size = 180487, upload-time = "2025-09-08T23:23:40.423Z" }, + { url = "https://files.pythonhosted.org/packages/bf/41/4c1168c74fac325c0c8156f04b6749c8b6a8f405bbf91413ba088359f60d/cffi-2.0.0-cp314-cp314t-win_amd64.whl", hash = "sha256:d68b6cef7827e8641e8ef16f4494edda8b36104d79773a334beaa1e3521430f6", size = 191726, upload-time = "2025-09-08T23:23:41.742Z" }, + { url = "https://files.pythonhosted.org/packages/ae/3a/dbeec9d1ee0844c679f6bb5d6ad4e9f198b1224f4e7a32825f47f6192b0c/cffi-2.0.0-cp314-cp314t-win_arm64.whl", hash = "sha256:0a1527a803f0a659de1af2e1fd700213caba79377e27e4693648c2923da066f9", size = 184195, upload-time = "2025-09-08T23:23:43.004Z" }, +] + +[[package]] +name = "charset-normalizer" +version = "3.4.6" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/7b/60/e3bec1881450851b087e301bedc3daa9377a4d45f1c26aa90b0b235e38aa/charset_normalizer-3.4.6.tar.gz", hash = "sha256:1ae6b62897110aa7c79ea2f5dd38d1abca6db663687c0b1ad9aed6f6bae3d9d6", size = 143363, upload-time = "2026-03-15T18:53:25.478Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/25/6f/ffe1e1259f384594063ea1869bfb6be5cdb8bc81020fc36c3636bc8302a1/charset_normalizer-3.4.6-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:9cc6e6d9e571d2f863fa77700701dae73ed5f78881efc8b3f9a4398772ff53e8", size = 294458, upload-time = "2026-03-15T18:51:41.134Z" }, + { url = "https://files.pythonhosted.org/packages/56/60/09bb6c13a8c1016c2ed5c6a6488e4ffef506461aa5161662bd7636936fb1/charset_normalizer-3.4.6-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ef5960d965e67165d75b7c7ffc60a83ec5abfc5c11b764ec13ea54fbef8b4421", size = 199277, upload-time = "2026-03-15T18:51:42.953Z" }, + { url = "https://files.pythonhosted.org/packages/00/50/dcfbb72a5138bbefdc3332e8d81a23494bf67998b4b100703fd15fa52d81/charset_normalizer-3.4.6-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:b3694e3f87f8ac7ce279d4355645b3c878d24d1424581b46282f24b92f5a4ae2", size = 218758, upload-time = "2026-03-15T18:51:44.339Z" }, + { url = "https://files.pythonhosted.org/packages/03/b3/d79a9a191bb75f5aa81f3aaaa387ef29ce7cb7a9e5074ba8ea095cc073c2/charset_normalizer-3.4.6-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:5d11595abf8dd942a77883a39d81433739b287b6aa71620f15164f8096221b30", size = 215299, upload-time = "2026-03-15T18:51:45.871Z" }, + { url = "https://files.pythonhosted.org/packages/76/7e/bc8911719f7084f72fd545f647601ea3532363927f807d296a8c88a62c0d/charset_normalizer-3.4.6-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7bda6eebafd42133efdca535b04ccb338ab29467b3f7bf79569883676fc628db", size = 206811, upload-time = "2026-03-15T18:51:47.308Z" }, + { url = "https://files.pythonhosted.org/packages/e2/40/c430b969d41dda0c465aa36cc7c2c068afb67177bef50905ac371b28ccc7/charset_normalizer-3.4.6-cp314-cp314-manylinux_2_31_armv7l.whl", hash = "sha256:bbc8c8650c6e51041ad1be191742b8b421d05bbd3410f43fa2a00c8db87678e8", size = 193706, upload-time = "2026-03-15T18:51:48.849Z" }, + { url = "https://files.pythonhosted.org/packages/48/15/e35e0590af254f7df984de1323640ef375df5761f615b6225ba8deb9799a/charset_normalizer-3.4.6-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:22c6f0c2fbc31e76c3b8a86fba1a56eda6166e238c29cdd3d14befdb4a4e4815", size = 202706, upload-time = "2026-03-15T18:51:50.257Z" }, + { url = "https://files.pythonhosted.org/packages/5e/bd/f736f7b9cc5e93a18b794a50346bb16fbfd6b37f99e8f306f7951d27c17c/charset_normalizer-3.4.6-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:7edbed096e4a4798710ed6bc75dcaa2a21b68b6c356553ac4823c3658d53743a", size = 202497, upload-time = "2026-03-15T18:51:52.012Z" }, + { url = "https://files.pythonhosted.org/packages/9d/ba/2cc9e3e7dfdf7760a6ed8da7446d22536f3d0ce114ac63dee2a5a3599e62/charset_normalizer-3.4.6-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:7f9019c9cb613f084481bd6a100b12e1547cf2efe362d873c2e31e4035a6fa43", size = 193511, upload-time = "2026-03-15T18:51:53.723Z" }, + { url = "https://files.pythonhosted.org/packages/9e/cb/5be49b5f776e5613be07298c80e1b02a2d900f7a7de807230595c85a8b2e/charset_normalizer-3.4.6-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:58c948d0d086229efc484fe2f30c2d382c86720f55cd9bc33591774348ad44e0", size = 220133, upload-time = "2026-03-15T18:51:55.333Z" }, + { url = "https://files.pythonhosted.org/packages/83/43/99f1b5dad345accb322c80c7821071554f791a95ee50c1c90041c157ae99/charset_normalizer-3.4.6-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:419a9d91bd238052642a51938af8ac05da5b3343becde08d5cdeab9046df9ee1", size = 203035, upload-time = "2026-03-15T18:51:56.736Z" }, + { url = "https://files.pythonhosted.org/packages/87/9a/62c2cb6a531483b55dddff1a68b3d891a8b498f3ca555fbcf2978e804d9d/charset_normalizer-3.4.6-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:5273b9f0b5835ff0350c0828faea623c68bfa65b792720c453e22b25cc72930f", size = 216321, upload-time = "2026-03-15T18:51:58.17Z" }, + { url = "https://files.pythonhosted.org/packages/6e/79/94a010ff81e3aec7c293eb82c28f930918e517bc144c9906a060844462eb/charset_normalizer-3.4.6-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:0e901eb1049fdb80f5bd11ed5ea1e498ec423102f7a9b9e4645d5b8204ff2815", size = 208973, upload-time = "2026-03-15T18:51:59.998Z" }, + { url = "https://files.pythonhosted.org/packages/2a/57/4ecff6d4ec8585342f0c71bc03efaa99cb7468f7c91a57b105bcd561cea8/charset_normalizer-3.4.6-cp314-cp314-win32.whl", hash = "sha256:b4ff1d35e8c5bd078be89349b6f3a845128e685e751b6ea1169cf2160b344c4d", size = 144610, upload-time = "2026-03-15T18:52:02.213Z" }, + { url = "https://files.pythonhosted.org/packages/80/94/8434a02d9d7f168c25767c64671fead8d599744a05d6a6c877144c754246/charset_normalizer-3.4.6-cp314-cp314-win_amd64.whl", hash = "sha256:74119174722c4349af9708993118581686f343adc1c8c9c007d59be90d077f3f", size = 154962, upload-time = "2026-03-15T18:52:03.658Z" }, + { url = "https://files.pythonhosted.org/packages/46/4c/48f2cdbfd923026503dfd67ccea45c94fd8fe988d9056b468579c66ed62b/charset_normalizer-3.4.6-cp314-cp314-win_arm64.whl", hash = "sha256:e5bcc1a1ae744e0bb59641171ae53743760130600da8db48cbb6e4918e186e4e", size = 143595, upload-time = "2026-03-15T18:52:05.123Z" }, + { url = "https://files.pythonhosted.org/packages/31/93/8878be7569f87b14f1d52032946131bcb6ebbd8af3e20446bc04053dc3f1/charset_normalizer-3.4.6-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:ad8faf8df23f0378c6d527d8b0b15ea4a2e23c89376877c598c4870d1b2c7866", size = 314828, upload-time = "2026-03-15T18:52:06.831Z" }, + { url = "https://files.pythonhosted.org/packages/06/b6/fae511ca98aac69ecc35cde828b0a3d146325dd03d99655ad38fc2cc3293/charset_normalizer-3.4.6-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f5ea69428fa1b49573eef0cc44a1d43bebd45ad0c611eb7d7eac760c7ae771bc", size = 208138, upload-time = "2026-03-15T18:52:08.239Z" }, + { url = "https://files.pythonhosted.org/packages/54/57/64caf6e1bf07274a1e0b7c160a55ee9e8c9ec32c46846ce59b9c333f7008/charset_normalizer-3.4.6-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:06a7e86163334edfc5d20fe104db92fcd666e5a5df0977cb5680a506fe26cc8e", size = 224679, upload-time = "2026-03-15T18:52:10.043Z" }, + { url = "https://files.pythonhosted.org/packages/aa/cb/9ff5a25b9273ef160861b41f6937f86fae18b0792fe0a8e75e06acb08f1d/charset_normalizer-3.4.6-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:e1f6e2f00a6b8edb562826e4632e26d063ac10307e80f7461f7de3ad8ef3f077", size = 223475, upload-time = "2026-03-15T18:52:11.854Z" }, + { url = "https://files.pythonhosted.org/packages/fc/97/440635fc093b8d7347502a377031f9605a1039c958f3cd18dcacffb37743/charset_normalizer-3.4.6-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:95b52c68d64c1878818687a473a10547b3292e82b6f6fe483808fb1468e2f52f", size = 215230, upload-time = "2026-03-15T18:52:13.325Z" }, + { url = "https://files.pythonhosted.org/packages/cd/24/afff630feb571a13f07c8539fbb502d2ab494019492aaffc78ef41f1d1d0/charset_normalizer-3.4.6-cp314-cp314t-manylinux_2_31_armv7l.whl", hash = "sha256:7504e9b7dc05f99a9bbb4525c67a2c155073b44d720470a148b34166a69c054e", size = 199045, upload-time = "2026-03-15T18:52:14.752Z" }, + { url = "https://files.pythonhosted.org/packages/e5/17/d1399ecdaf7e0498c327433e7eefdd862b41236a7e484355b8e0e5ebd64b/charset_normalizer-3.4.6-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:172985e4ff804a7ad08eebec0a1640ece87ba5041d565fff23c8f99c1f389484", size = 211658, upload-time = "2026-03-15T18:52:16.278Z" }, + { url = "https://files.pythonhosted.org/packages/b5/38/16baa0affb957b3d880e5ac2144caf3f9d7de7bc4a91842e447fbb5e8b67/charset_normalizer-3.4.6-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:4be9f4830ba8741527693848403e2c457c16e499100963ec711b1c6f2049b7c7", size = 210769, upload-time = "2026-03-15T18:52:17.782Z" }, + { url = "https://files.pythonhosted.org/packages/05/34/c531bc6ac4c21da9ddfddb3107be2287188b3ea4b53b70fc58f2a77ac8d8/charset_normalizer-3.4.6-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:79090741d842f564b1b2827c0b82d846405b744d31e84f18d7a7b41c20e473ff", size = 201328, upload-time = "2026-03-15T18:52:19.553Z" }, + { url = "https://files.pythonhosted.org/packages/fa/73/a5a1e9ca5f234519c1953608a03fe109c306b97fdfb25f09182babad51a7/charset_normalizer-3.4.6-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:87725cfb1a4f1f8c2fc9890ae2f42094120f4b44db9360be5d99a4c6b0e03a9e", size = 225302, upload-time = "2026-03-15T18:52:21.043Z" }, + { url = "https://files.pythonhosted.org/packages/ba/f6/cd782923d112d296294dea4bcc7af5a7ae0f86ab79f8fefbda5526b6cfc0/charset_normalizer-3.4.6-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:fcce033e4021347d80ed9c66dcf1e7b1546319834b74445f561d2e2221de5659", size = 211127, upload-time = "2026-03-15T18:52:22.491Z" }, + { url = "https://files.pythonhosted.org/packages/0e/c5/0b6898950627af7d6103a449b22320372c24c6feda91aa24e201a478d161/charset_normalizer-3.4.6-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:ca0276464d148c72defa8bb4390cce01b4a0e425f3b50d1435aa6d7a18107602", size = 222840, upload-time = "2026-03-15T18:52:24.113Z" }, + { url = "https://files.pythonhosted.org/packages/7d/25/c4bba773bef442cbdc06111d40daa3de5050a676fa26e85090fc54dd12f0/charset_normalizer-3.4.6-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:197c1a244a274bb016dd8b79204850144ef77fe81c5b797dc389327adb552407", size = 216890, upload-time = "2026-03-15T18:52:25.541Z" }, + { url = "https://files.pythonhosted.org/packages/35/1a/05dacadb0978da72ee287b0143097db12f2e7e8d3ffc4647da07a383b0b7/charset_normalizer-3.4.6-cp314-cp314t-win32.whl", hash = "sha256:2a24157fa36980478dd1770b585c0f30d19e18f4fb0c47c13aa568f871718579", size = 155379, upload-time = "2026-03-15T18:52:27.05Z" }, + { url = "https://files.pythonhosted.org/packages/5d/7a/d269d834cb3a76291651256f3b9a5945e81d0a49ab9f4a498964e83c0416/charset_normalizer-3.4.6-cp314-cp314t-win_amd64.whl", hash = "sha256:cd5e2801c89992ed8c0a3f0293ae83c159a60d9a5d685005383ef4caca77f2c4", size = 169043, upload-time = "2026-03-15T18:52:28.502Z" }, + { url = "https://files.pythonhosted.org/packages/23/06/28b29fba521a37a8932c6a84192175c34d49f84a6d4773fa63d05f9aff22/charset_normalizer-3.4.6-cp314-cp314t-win_arm64.whl", hash = "sha256:47955475ac79cc504ef2704b192364e51d0d473ad452caedd0002605f780101c", size = 148523, upload-time = "2026-03-15T18:52:29.956Z" }, + { url = "https://files.pythonhosted.org/packages/2a/68/687187c7e26cb24ccbd88e5069f5ef00eba804d36dde11d99aad0838ab45/charset_normalizer-3.4.6-py3-none-any.whl", hash = "sha256:947cf925bc916d90adba35a64c82aace04fa39b46b52d4630ece166655905a69", size = 61455, upload-time = "2026-03-15T18:53:23.833Z" }, +] + +[[package]] +name = "click" +version = "8.3.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "sys_platform == 'win32'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/3d/fa/656b739db8587d7b5dfa22e22ed02566950fbfbcdc20311993483657a5c0/click-8.3.1.tar.gz", hash = "sha256:12ff4785d337a1bb490bb7e9c2b1ee5da3112e94a8622f26a6c77f5d2fc6842a", size = 295065, upload-time = "2025-11-15T20:45:42.706Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/98/78/01c019cdb5d6498122777c1a43056ebb3ebfeef2076d9d026bfe15583b2b/click-8.3.1-py3-none-any.whl", hash = "sha256:981153a64e25f12d547d3426c367a4857371575ee7ad18df2a6183ab0545b2a6", size = 108274, upload-time = "2025-11-15T20:45:41.139Z" }, +] + +[[package]] +name = "colorama" +version = "0.4.6" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" }, +] + +[[package]] +name = "coverage" +version = "7.13.5" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/9d/e0/70553e3000e345daff267cec284ce4cbf3fc141b6da229ac52775b5428f1/coverage-7.13.5.tar.gz", hash = "sha256:c81f6515c4c40141f83f502b07bbfa5c240ba25bbe73da7b33f1e5b6120ff179", size = 915967, upload-time = "2026-03-17T10:33:18.341Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/8e/77/39703f0d1d4b478bfd30191d3c14f53caf596fac00efb3f8f6ee23646439/coverage-7.13.5-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:fbabfaceaeb587e16f7008f7795cd80d20ec548dc7f94fbb0d4ec2e038ce563f", size = 219621, upload-time = "2026-03-17T10:32:08.589Z" }, + { url = "https://files.pythonhosted.org/packages/e2/3e/51dff36d99ae14639a133d9b164d63e628532e2974d8b1edb99dd1ebc733/coverage-7.13.5-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:9bb2a28101a443669a423b665939381084412b81c3f8c0fcfbac57f4e30b5b8e", size = 219953, upload-time = "2026-03-17T10:32:10.507Z" }, + { url = "https://files.pythonhosted.org/packages/6a/6c/1f1917b01eb647c2f2adc9962bd66c79eb978951cab61bdc1acab3290c07/coverage-7.13.5-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:bd3a2fbc1c6cccb3c5106140d87cc6a8715110373ef42b63cf5aea29df8c217a", size = 250992, upload-time = "2026-03-17T10:32:12.41Z" }, + { url = "https://files.pythonhosted.org/packages/22/e5/06b1f88f42a5a99df42ce61208bdec3bddb3d261412874280a19796fc09c/coverage-7.13.5-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:6c36ddb64ed9d7e496028d1d00dfec3e428e0aabf4006583bb1839958d280510", size = 253503, upload-time = "2026-03-17T10:32:14.449Z" }, + { url = "https://files.pythonhosted.org/packages/80/28/2a148a51e5907e504fa7b85490277734e6771d8844ebcc48764a15e28155/coverage-7.13.5-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:380e8e9084d8eb38db3a9176a1a4f3c0082c3806fa0dc882d1d87abc3c789247", size = 254852, upload-time = "2026-03-17T10:32:16.56Z" }, + { url = "https://files.pythonhosted.org/packages/61/77/50e8d3d85cc0b7ebe09f30f151d670e302c7ff4a1bf6243f71dd8b0981fa/coverage-7.13.5-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:e808af52a0513762df4d945ea164a24b37f2f518cbe97e03deaa0ee66139b4d6", size = 257161, upload-time = "2026-03-17T10:32:19.004Z" }, + { url = "https://files.pythonhosted.org/packages/3b/c4/b5fd1d4b7bf8d0e75d997afd3925c59ba629fc8616f1b3aae7605132e256/coverage-7.13.5-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:e301d30dd7e95ae068671d746ba8c34e945a82682e62918e41b2679acd2051a0", size = 251021, upload-time = "2026-03-17T10:32:21.344Z" }, + { url = "https://files.pythonhosted.org/packages/f8/66/6ea21f910e92d69ef0b1c3346ea5922a51bad4446c9126db2ae96ee24c4c/coverage-7.13.5-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:800bc829053c80d240a687ceeb927a94fd108bbdc68dfbe505d0d75ab578a882", size = 252858, upload-time = "2026-03-17T10:32:23.506Z" }, + { url = "https://files.pythonhosted.org/packages/9e/ea/879c83cb5d61aa2a35fb80e72715e92672daef8191b84911a643f533840c/coverage-7.13.5-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:0b67af5492adb31940ee418a5a655c28e48165da5afab8c7fa6fd72a142f8740", size = 250823, upload-time = "2026-03-17T10:32:25.516Z" }, + { url = "https://files.pythonhosted.org/packages/8a/fb/616d95d3adb88b9803b275580bdeee8bd1b69a886d057652521f83d7322f/coverage-7.13.5-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:c9136ff29c3a91e25b1d1552b5308e53a1e0653a23e53b6366d7c2dcbbaf8a16", size = 255099, upload-time = "2026-03-17T10:32:27.944Z" }, + { url = "https://files.pythonhosted.org/packages/1c/93/25e6917c90ec1c9a56b0b26f6cad6408e5f13bb6b35d484a0d75c9cf000d/coverage-7.13.5-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:cff784eef7f0b8f6cb28804fbddcfa99f89efe4cc35fb5627e3ac58f91ed3ac0", size = 250638, upload-time = "2026-03-17T10:32:29.914Z" }, + { url = "https://files.pythonhosted.org/packages/fc/7b/dc1776b0464145a929deed214aef9fb1493f159b59ff3c7eeeedf91eddd0/coverage-7.13.5-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:68a4953be99b17ac3c23b6efbc8a38330d99680c9458927491d18700ef23ded0", size = 252295, upload-time = "2026-03-17T10:32:31.981Z" }, + { url = "https://files.pythonhosted.org/packages/ea/fb/99cbbc56a26e07762a2740713f3c8f9f3f3106e3a3dd8cc4474954bccd34/coverage-7.13.5-cp314-cp314-win32.whl", hash = "sha256:35a31f2b1578185fbe6aa2e74cea1b1d0bbf4c552774247d9160d29b80ed56cc", size = 222360, upload-time = "2026-03-17T10:32:34.233Z" }, + { url = "https://files.pythonhosted.org/packages/8d/b7/4758d4f73fb536347cc5e4ad63662f9d60ba9118cb6785e9616b2ce5d7fa/coverage-7.13.5-cp314-cp314-win_amd64.whl", hash = "sha256:2aa055ae1857258f9e0045be26a6d62bdb47a72448b62d7b55f4820f361a2633", size = 223174, upload-time = "2026-03-17T10:32:36.369Z" }, + { url = "https://files.pythonhosted.org/packages/2c/f2/24d84e1dfe70f8ac9fdf30d338239860d0d1d5da0bda528959d0ebc9da28/coverage-7.13.5-cp314-cp314-win_arm64.whl", hash = "sha256:1b11eef33edeae9d142f9b4358edb76273b3bfd30bc3df9a4f95d0e49caf94e8", size = 221739, upload-time = "2026-03-17T10:32:38.736Z" }, + { url = "https://files.pythonhosted.org/packages/60/5b/4a168591057b3668c2428bff25dd3ebc21b629d666d90bcdfa0217940e84/coverage-7.13.5-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:10a0c37f0b646eaff7cce1874c31d1f1ccb297688d4c747291f4f4c70741cc8b", size = 220351, upload-time = "2026-03-17T10:32:41.196Z" }, + { url = "https://files.pythonhosted.org/packages/f5/21/1fd5c4dbfe4a58b6b99649125635df46decdfd4a784c3cd6d410d303e370/coverage-7.13.5-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:b5db73ba3c41c7008037fa731ad5459fc3944cb7452fc0aa9f822ad3533c583c", size = 220612, upload-time = "2026-03-17T10:32:43.204Z" }, + { url = "https://files.pythonhosted.org/packages/d6/fe/2a924b3055a5e7e4512655a9d4609781b0d62334fa0140c3e742926834e2/coverage-7.13.5-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:750db93a81e3e5a9831b534be7b1229df848b2e125a604fe6651e48aa070e5f9", size = 261985, upload-time = "2026-03-17T10:32:45.514Z" }, + { url = "https://files.pythonhosted.org/packages/d7/0d/c8928f2bd518c45990fe1a2ab8db42e914ef9b726c975facc4282578c3eb/coverage-7.13.5-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:9ddb4f4a5479f2539644be484da179b653273bca1a323947d48ab107b3ed1f29", size = 264107, upload-time = "2026-03-17T10:32:47.971Z" }, + { url = "https://files.pythonhosted.org/packages/ef/ae/4ae35bbd9a0af9d820362751f0766582833c211224b38665c0f8de3d487f/coverage-7.13.5-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d8a7a2049c14f413163e2bdabd37e41179b1d1ccb10ffc6ccc4b7a718429c607", size = 266513, upload-time = "2026-03-17T10:32:50.1Z" }, + { url = "https://files.pythonhosted.org/packages/9c/20/d326174c55af36f74eac6ae781612d9492f060ce8244b570bb9d50d9d609/coverage-7.13.5-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:e1c85e0b6c05c592ea6d8768a66a254bfb3874b53774b12d4c89c481eb78cb90", size = 267650, upload-time = "2026-03-17T10:32:52.391Z" }, + { url = "https://files.pythonhosted.org/packages/7a/5e/31484d62cbd0eabd3412e30d74386ece4a0837d4f6c3040a653878bfc019/coverage-7.13.5-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:777c4d1eff1b67876139d24288aaf1817f6c03d6bae9c5cc8d27b83bcfe38fe3", size = 261089, upload-time = "2026-03-17T10:32:54.544Z" }, + { url = "https://files.pythonhosted.org/packages/e9/d8/49a72d6de146eebb0b7e48cc0f4bc2c0dd858e3d4790ab2b39a2872b62bd/coverage-7.13.5-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:6697e29b93707167687543480a40f0db8f356e86d9f67ddf2e37e2dfd91a9dab", size = 263982, upload-time = "2026-03-17T10:32:56.803Z" }, + { url = "https://files.pythonhosted.org/packages/06/3b/0351f1bd566e6e4dd39e978efe7958bde1d32f879e85589de147654f57bb/coverage-7.13.5-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:8fdf453a942c3e4d99bd80088141c4c6960bb232c409d9c3558e2dbaa3998562", size = 261579, upload-time = "2026-03-17T10:32:59.466Z" }, + { url = "https://files.pythonhosted.org/packages/5d/ce/796a2a2f4017f554d7810f5c573449b35b1e46788424a548d4d19201b222/coverage-7.13.5-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:32ca0c0114c9834a43f045a87dcebd69d108d8ffb666957ea65aa132f50332e2", size = 265316, upload-time = "2026-03-17T10:33:01.847Z" }, + { url = "https://files.pythonhosted.org/packages/3d/16/d5ae91455541d1a78bc90abf495be600588aff8f6db5c8b0dae739fa39c9/coverage-7.13.5-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:8769751c10f339021e2638cd354e13adeac54004d1941119b2c96fe5276d45ea", size = 260427, upload-time = "2026-03-17T10:33:03.945Z" }, + { url = "https://files.pythonhosted.org/packages/48/11/07f413dba62db21fb3fad5d0de013a50e073cc4e2dc4306e770360f6dfc8/coverage-7.13.5-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:cec2d83125531bd153175354055cdb7a09987af08a9430bd173c937c6d0fba2a", size = 262745, upload-time = "2026-03-17T10:33:06.285Z" }, + { url = "https://files.pythonhosted.org/packages/91/15/d792371332eb4663115becf4bad47e047d16234b1aff687b1b18c58d60ae/coverage-7.13.5-cp314-cp314t-win32.whl", hash = "sha256:0cd9ed7a8b181775459296e402ca4fb27db1279740a24e93b3b41942ebe4b215", size = 223146, upload-time = "2026-03-17T10:33:08.756Z" }, + { url = "https://files.pythonhosted.org/packages/db/51/37221f59a111dca5e85be7dbf09696323b5b9f13ff65e0641d535ed06ea8/coverage-7.13.5-cp314-cp314t-win_amd64.whl", hash = "sha256:301e3b7dfefecaca37c9f1aa6f0049b7d4ab8dd933742b607765d757aca77d43", size = 224254, upload-time = "2026-03-17T10:33:11.174Z" }, + { url = "https://files.pythonhosted.org/packages/54/83/6acacc889de8987441aa7d5adfbdbf33d288dad28704a67e574f1df9bcbb/coverage-7.13.5-cp314-cp314t-win_arm64.whl", hash = "sha256:9dacc2ad679b292709e0f5fc1ac74a6d4d5562e424058962c7bb0c658ad25e45", size = 222276, upload-time = "2026-03-17T10:33:13.466Z" }, + { url = "https://files.pythonhosted.org/packages/9e/ee/a4cf96b8ce1e566ed238f0659ac2d3f007ed1d14b181bcb684e19561a69a/coverage-7.13.5-py3-none-any.whl", hash = "sha256:34b02417cf070e173989b3db962f7ed56d2f644307b2cf9d5a0f258e13084a61", size = 211346, upload-time = "2026-03-17T10:33:15.691Z" }, +] + +[[package]] +name = "cryptography" +version = "46.0.6" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "cffi", marker = "platform_python_implementation != 'PyPy'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/a4/ba/04b1bd4218cbc58dc90ce967106d51582371b898690f3ae0402876cc4f34/cryptography-46.0.6.tar.gz", hash = "sha256:27550628a518c5c6c903d84f637fbecf287f6cb9ced3804838a1295dc1fd0759", size = 750542, upload-time = "2026-03-25T23:34:53.396Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/47/23/9285e15e3bc57325b0a72e592921983a701efc1ee8f91c06c5f0235d86d9/cryptography-46.0.6-cp311-abi3-macosx_10_9_universal2.whl", hash = "sha256:64235194bad039a10bb6d2d930ab3323baaec67e2ce36215fd0952fad0930ca8", size = 7176401, upload-time = "2026-03-25T23:33:22.096Z" }, + { url = "https://files.pythonhosted.org/packages/60/f8/e61f8f13950ab6195b31913b42d39f0f9afc7d93f76710f299b5ec286ae6/cryptography-46.0.6-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:26031f1e5ca62fcb9d1fcb34b2b60b390d1aacaa15dc8b895a9ed00968b97b30", size = 4275275, upload-time = "2026-03-25T23:33:23.844Z" }, + { url = "https://files.pythonhosted.org/packages/19/69/732a736d12c2631e140be2348b4ad3d226302df63ef64d30dfdb8db7ad1c/cryptography-46.0.6-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:9a693028b9cbe51b5a1136232ee8f2bc242e4e19d456ded3fa7c86e43c713b4a", size = 4425320, upload-time = "2026-03-25T23:33:25.703Z" }, + { url = "https://files.pythonhosted.org/packages/d4/12/123be7292674abf76b21ac1fc0e1af50661f0e5b8f0ec8285faac18eb99e/cryptography-46.0.6-cp311-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:67177e8a9f421aa2d3a170c3e56eca4e0128883cf52a071a7cbf53297f18b175", size = 4278082, upload-time = "2026-03-25T23:33:27.423Z" }, + { url = "https://files.pythonhosted.org/packages/5b/ba/d5e27f8d68c24951b0a484924a84c7cdaed7502bac9f18601cd357f8b1d2/cryptography-46.0.6-cp311-abi3-manylinux_2_28_ppc64le.whl", hash = "sha256:d9528b535a6c4f8ff37847144b8986a9a143585f0540fbcb1a98115b543aa463", size = 4926514, upload-time = "2026-03-25T23:33:29.206Z" }, + { url = "https://files.pythonhosted.org/packages/34/71/1ea5a7352ae516d5512d17babe7e1b87d9db5150b21f794b1377eac1edc0/cryptography-46.0.6-cp311-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:22259338084d6ae497a19bae5d4c66b7ca1387d3264d1c2c0e72d9e9b6a77b97", size = 4457766, upload-time = "2026-03-25T23:33:30.834Z" }, + { url = "https://files.pythonhosted.org/packages/01/59/562be1e653accee4fdad92c7a2e88fced26b3fdfce144047519bbebc299e/cryptography-46.0.6-cp311-abi3-manylinux_2_31_armv7l.whl", hash = "sha256:760997a4b950ff00d418398ad73fbc91aa2894b5c1db7ccb45b4f68b42a63b3c", size = 3986535, upload-time = "2026-03-25T23:33:33.02Z" }, + { url = "https://files.pythonhosted.org/packages/d6/8b/b1ebfeb788bf4624d36e45ed2662b8bd43a05ff62157093c1539c1288a18/cryptography-46.0.6-cp311-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:3dfa6567f2e9e4c5dceb8ccb5a708158a2a871052fa75c8b78cb0977063f1507", size = 4277618, upload-time = "2026-03-25T23:33:34.567Z" }, + { url = "https://files.pythonhosted.org/packages/dd/52/a005f8eabdb28df57c20f84c44d397a755782d6ff6d455f05baa2785bd91/cryptography-46.0.6-cp311-abi3-manylinux_2_34_ppc64le.whl", hash = "sha256:cdcd3edcbc5d55757e5f5f3d330dd00007ae463a7e7aa5bf132d1f22a4b62b19", size = 4890802, upload-time = "2026-03-25T23:33:37.034Z" }, + { url = "https://files.pythonhosted.org/packages/ec/4d/8e7d7245c79c617d08724e2efa397737715ca0ec830ecb3c91e547302555/cryptography-46.0.6-cp311-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:d4e4aadb7fc1f88687f47ca20bb7227981b03afaae69287029da08096853b738", size = 4457425, upload-time = "2026-03-25T23:33:38.904Z" }, + { url = "https://files.pythonhosted.org/packages/1d/5c/f6c3596a1430cec6f949085f0e1a970638d76f81c3ea56d93d564d04c340/cryptography-46.0.6-cp311-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:2b417edbe8877cda9022dde3a008e2deb50be9c407eef034aeeb3a8b11d9db3c", size = 4405530, upload-time = "2026-03-25T23:33:40.842Z" }, + { url = "https://files.pythonhosted.org/packages/7e/c9/9f9cea13ee2dbde070424e0c4f621c091a91ffcc504ffea5e74f0e1daeff/cryptography-46.0.6-cp311-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:380343e0653b1c9d7e1f55b52aaa2dbb2fdf2730088d48c43ca1c7c0abb7cc2f", size = 4667896, upload-time = "2026-03-25T23:33:42.781Z" }, + { url = "https://files.pythonhosted.org/packages/ad/b5/1895bc0821226f129bc74d00eccfc6a5969e2028f8617c09790bf89c185e/cryptography-46.0.6-cp311-abi3-win32.whl", hash = "sha256:bcb87663e1f7b075e48c3be3ecb5f0b46c8fc50b50a97cf264e7f60242dca3f2", size = 3026348, upload-time = "2026-03-25T23:33:45.021Z" }, + { url = "https://files.pythonhosted.org/packages/c3/f8/c9bcbf0d3e6ad288b9d9aa0b1dee04b063d19e8c4f871855a03ab3a297ab/cryptography-46.0.6-cp311-abi3-win_amd64.whl", hash = "sha256:6739d56300662c468fddb0e5e291f9b4d084bead381667b9e654c7dd81705124", size = 3483896, upload-time = "2026-03-25T23:33:46.649Z" }, + { url = "https://files.pythonhosted.org/packages/01/41/3a578f7fd5c70611c0aacba52cd13cb364a5dee895a5c1d467208a9380b0/cryptography-46.0.6-cp314-cp314t-macosx_10_9_universal2.whl", hash = "sha256:2ef9e69886cbb137c2aef9772c2e7138dc581fad4fcbcf13cc181eb5a3ab6275", size = 7117147, upload-time = "2026-03-25T23:33:48.249Z" }, + { url = "https://files.pythonhosted.org/packages/fa/87/887f35a6fca9dde90cad08e0de0c89263a8e59b2d2ff904fd9fcd8025b6f/cryptography-46.0.6-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:7f417f034f91dcec1cb6c5c35b07cdbb2ef262557f701b4ecd803ee8cefed4f4", size = 4266221, upload-time = "2026-03-25T23:33:49.874Z" }, + { url = "https://files.pythonhosted.org/packages/aa/a8/0a90c4f0b0871e0e3d1ed126aed101328a8a57fd9fd17f00fb67e82a51ca/cryptography-46.0.6-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:d24c13369e856b94892a89ddf70b332e0b70ad4a5c43cf3e9cb71d6d7ffa1f7b", size = 4408952, upload-time = "2026-03-25T23:33:52.128Z" }, + { url = "https://files.pythonhosted.org/packages/16/0b/b239701eb946523e4e9f329336e4ff32b1247e109cbab32d1a7b61da8ed7/cryptography-46.0.6-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:aad75154a7ac9039936d50cf431719a2f8d4ed3d3c277ac03f3339ded1a5e707", size = 4270141, upload-time = "2026-03-25T23:33:54.11Z" }, + { url = "https://files.pythonhosted.org/packages/0f/a8/976acdd4f0f30df7b25605f4b9d3d89295351665c2091d18224f7ad5cdbf/cryptography-46.0.6-cp314-cp314t-manylinux_2_28_ppc64le.whl", hash = "sha256:3c21d92ed15e9cfc6eb64c1f5a0326db22ca9c2566ca46d845119b45b4400361", size = 4904178, upload-time = "2026-03-25T23:33:55.725Z" }, + { url = "https://files.pythonhosted.org/packages/b1/1b/bf0e01a88efd0e59679b69f42d4afd5bced8700bb5e80617b2d63a3741af/cryptography-46.0.6-cp314-cp314t-manylinux_2_28_x86_64.whl", hash = "sha256:4668298aef7cddeaf5c6ecc244c2302a2b8e40f384255505c22875eebb47888b", size = 4441812, upload-time = "2026-03-25T23:33:57.364Z" }, + { url = "https://files.pythonhosted.org/packages/bb/8b/11df86de2ea389c65aa1806f331cae145f2ed18011f30234cc10ca253de8/cryptography-46.0.6-cp314-cp314t-manylinux_2_31_armv7l.whl", hash = "sha256:8ce35b77aaf02f3b59c90b2c8a05c73bac12cea5b4e8f3fbece1f5fddea5f0ca", size = 3963923, upload-time = "2026-03-25T23:33:59.361Z" }, + { url = "https://files.pythonhosted.org/packages/91/e0/207fb177c3a9ef6a8108f234208c3e9e76a6aa8cf20d51932916bd43bda0/cryptography-46.0.6-cp314-cp314t-manylinux_2_34_aarch64.whl", hash = "sha256:c89eb37fae9216985d8734c1afd172ba4927f5a05cfd9bf0e4863c6d5465b013", size = 4269695, upload-time = "2026-03-25T23:34:00.909Z" }, + { url = "https://files.pythonhosted.org/packages/21/5e/19f3260ed1e95bced52ace7501fabcd266df67077eeb382b79c81729d2d3/cryptography-46.0.6-cp314-cp314t-manylinux_2_34_ppc64le.whl", hash = "sha256:ed418c37d095aeddf5336898a132fba01091f0ac5844e3e8018506f014b6d2c4", size = 4869785, upload-time = "2026-03-25T23:34:02.796Z" }, + { url = "https://files.pythonhosted.org/packages/10/38/cd7864d79aa1d92ef6f1a584281433419b955ad5a5ba8d1eb6c872165bcb/cryptography-46.0.6-cp314-cp314t-manylinux_2_34_x86_64.whl", hash = "sha256:69cf0056d6947edc6e6760e5f17afe4bea06b56a9ac8a06de9d2bd6b532d4f3a", size = 4441404, upload-time = "2026-03-25T23:34:04.35Z" }, + { url = "https://files.pythonhosted.org/packages/09/0a/4fe7a8d25fed74419f91835cf5829ade6408fd1963c9eae9c4bce390ecbb/cryptography-46.0.6-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:8e7304c4f4e9490e11efe56af6713983460ee0780f16c63f219984dab3af9d2d", size = 4397549, upload-time = "2026-03-25T23:34:06.342Z" }, + { url = "https://files.pythonhosted.org/packages/5f/a0/7d738944eac6513cd60a8da98b65951f4a3b279b93479a7e8926d9cd730b/cryptography-46.0.6-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:b928a3ca837c77a10e81a814a693f2295200adb3352395fad024559b7be7a736", size = 4651874, upload-time = "2026-03-25T23:34:07.916Z" }, + { url = "https://files.pythonhosted.org/packages/cb/f1/c2326781ca05208845efca38bf714f76939ae446cd492d7613808badedf1/cryptography-46.0.6-cp314-cp314t-win32.whl", hash = "sha256:97c8115b27e19e592a05c45d0dd89c57f81f841cc9880e353e0d3bf25b2139ed", size = 3001511, upload-time = "2026-03-25T23:34:09.892Z" }, + { url = "https://files.pythonhosted.org/packages/c9/57/fe4a23eb549ac9d903bd4698ffda13383808ef0876cc912bcb2838799ece/cryptography-46.0.6-cp314-cp314t-win_amd64.whl", hash = "sha256:c797e2517cb7880f8297e2c0f43bb910e91381339336f75d2c1c2cbf811b70b4", size = 3471692, upload-time = "2026-03-25T23:34:11.613Z" }, + { url = "https://files.pythonhosted.org/packages/c4/cc/f330e982852403da79008552de9906804568ae9230da8432f7496ce02b71/cryptography-46.0.6-cp38-abi3-macosx_10_9_universal2.whl", hash = "sha256:12cae594e9473bca1a7aceb90536060643128bb274fcea0fc459ab90f7d1ae7a", size = 7162776, upload-time = "2026-03-25T23:34:13.308Z" }, + { url = "https://files.pythonhosted.org/packages/49/b3/dc27efd8dcc4bff583b3f01d4a3943cd8b5821777a58b3a6a5f054d61b79/cryptography-46.0.6-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:639301950939d844a9e1c4464d7e07f902fe9a7f6b215bb0d4f28584729935d8", size = 4270529, upload-time = "2026-03-25T23:34:15.019Z" }, + { url = "https://files.pythonhosted.org/packages/e6/05/e8d0e6eb4f0d83365b3cb0e00eb3c484f7348db0266652ccd84632a3d58d/cryptography-46.0.6-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:ed3775295fb91f70b4027aeba878d79b3e55c0b3e97eaa4de71f8f23a9f2eb77", size = 4414827, upload-time = "2026-03-25T23:34:16.604Z" }, + { url = "https://files.pythonhosted.org/packages/2f/97/daba0f5d2dc6d855e2dcb70733c812558a7977a55dd4a6722756628c44d1/cryptography-46.0.6-cp38-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:8927ccfbe967c7df312ade694f987e7e9e22b2425976ddbf28271d7e58845290", size = 4271265, upload-time = "2026-03-25T23:34:18.586Z" }, + { url = "https://files.pythonhosted.org/packages/89/06/fe1fce39a37ac452e58d04b43b0855261dac320a2ebf8f5260dd55b201a9/cryptography-46.0.6-cp38-abi3-manylinux_2_28_ppc64le.whl", hash = "sha256:b12c6b1e1651e42ab5de8b1e00dc3b6354fdfd778e7fa60541ddacc27cd21410", size = 4916800, upload-time = "2026-03-25T23:34:20.561Z" }, + { url = "https://files.pythonhosted.org/packages/ff/8a/b14f3101fe9c3592603339eb5d94046c3ce5f7fc76d6512a2d40efd9724e/cryptography-46.0.6-cp38-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:063b67749f338ca9c5a0b7fe438a52c25f9526b851e24e6c9310e7195aad3b4d", size = 4448771, upload-time = "2026-03-25T23:34:22.406Z" }, + { url = "https://files.pythonhosted.org/packages/01/b3/0796998056a66d1973fd52ee89dc1bb3b6581960a91ad4ac705f182d398f/cryptography-46.0.6-cp38-abi3-manylinux_2_31_armv7l.whl", hash = "sha256:02fad249cb0e090b574e30b276a3da6a149e04ee2f049725b1f69e7b8351ec70", size = 3978333, upload-time = "2026-03-25T23:34:24.281Z" }, + { url = "https://files.pythonhosted.org/packages/c5/3d/db200af5a4ffd08918cd55c08399dc6c9c50b0bc72c00a3246e099d3a849/cryptography-46.0.6-cp38-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:7e6142674f2a9291463e5e150090b95a8519b2fb6e6aaec8917dd8d094ce750d", size = 4271069, upload-time = "2026-03-25T23:34:25.895Z" }, + { url = "https://files.pythonhosted.org/packages/d7/18/61acfd5b414309d74ee838be321c636fe71815436f53c9f0334bf19064fa/cryptography-46.0.6-cp38-abi3-manylinux_2_34_ppc64le.whl", hash = "sha256:456b3215172aeefb9284550b162801d62f5f264a081049a3e94307fe20792cfa", size = 4878358, upload-time = "2026-03-25T23:34:27.67Z" }, + { url = "https://files.pythonhosted.org/packages/8b/65/5bf43286d566f8171917cae23ac6add941654ccf085d739195a4eacf1674/cryptography-46.0.6-cp38-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:341359d6c9e68834e204ceaf25936dffeafea3829ab80e9503860dcc4f4dac58", size = 4448061, upload-time = "2026-03-25T23:34:29.375Z" }, + { url = "https://files.pythonhosted.org/packages/e0/25/7e49c0fa7205cf3597e525d156a6bce5b5c9de1fd7e8cb01120e459f205a/cryptography-46.0.6-cp38-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:9a9c42a2723999a710445bc0d974e345c32adfd8d2fac6d8a251fa829ad31cfb", size = 4399103, upload-time = "2026-03-25T23:34:32.036Z" }, + { url = "https://files.pythonhosted.org/packages/44/46/466269e833f1c4718d6cd496ffe20c56c9c8d013486ff66b4f69c302a68d/cryptography-46.0.6-cp38-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:6617f67b1606dfd9fe4dbfa354a9508d4a6d37afe30306fe6c101b7ce3274b72", size = 4659255, upload-time = "2026-03-25T23:34:33.679Z" }, + { url = "https://files.pythonhosted.org/packages/0a/09/ddc5f630cc32287d2c953fc5d32705e63ec73e37308e5120955316f53827/cryptography-46.0.6-cp38-abi3-win32.whl", hash = "sha256:7f6690b6c55e9c5332c0b59b9c8a3fb232ebf059094c17f9019a51e9827df91c", size = 3010660, upload-time = "2026-03-25T23:34:35.418Z" }, + { url = "https://files.pythonhosted.org/packages/1b/82/ca4893968aeb2709aacfb57a30dec6fa2ab25b10fa9f064b8882ce33f599/cryptography-46.0.6-cp38-abi3-win_amd64.whl", hash = "sha256:79e865c642cfc5c0b3eb12af83c35c5aeff4fa5c672dc28c43721c2c9fdd2f0f", size = 3471160, upload-time = "2026-03-25T23:34:37.191Z" }, +] + +[[package]] +name = "dill" +version = "0.4.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/81/e1/56027a71e31b02ddc53c7d65b01e68edf64dea2932122fe7746a516f75d5/dill-0.4.1.tar.gz", hash = "sha256:423092df4182177d4d8ba8290c8a5b640c66ab35ec7da59ccfa00f6fa3eea5fa", size = 187315, upload-time = "2026-01-19T02:36:56.85Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/1e/77/dc8c558f7593132cf8fefec57c4f60c83b16941c574ac5f619abb3ae7933/dill-0.4.1-py3-none-any.whl", hash = "sha256:1e1ce33e978ae97fcfcff5638477032b801c46c7c65cf717f95fbc2248f79a9d", size = 120019, upload-time = "2026-01-19T02:36:55.663Z" }, +] + +[[package]] +name = "ecdsa" +version = "0.19.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "six" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/25/ca/8de7744cb3bc966c85430ca2d0fcaeea872507c6a4cf6e007f7fe269ed9d/ecdsa-0.19.2.tar.gz", hash = "sha256:62635b0ac1ca2e027f82122b5b81cb706edc38cd91c63dda28e4f3455a2bf930", size = 202432, upload-time = "2026-03-26T09:58:17.675Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/51/79/119091c98e2bf49e24ed9f3ae69f816d715d2904aefa6a2baa039a2ba0b0/ecdsa-0.19.2-py2.py3-none-any.whl", hash = "sha256:840f5dc5e375c68f36c1a7a5b9caad28f95daa65185c9253c0c08dd952bb7399", size = 150818, upload-time = "2026-03-26T09:58:15.808Z" }, +] + +[[package]] +name = "filelock" +version = "3.25.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/94/b8/00651a0f559862f3bb7d6f7477b192afe3f583cc5e26403b44e59a55ab34/filelock-3.25.2.tar.gz", hash = "sha256:b64ece2b38f4ca29dd3e810287aa8c48182bbecd1ae6e9ae126c9b35f1382694", size = 40480, upload-time = "2026-03-11T20:45:38.487Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a4/a5/842ae8f0c08b61d6484b52f99a03510a3a72d23141942d216ebe81fefbce/filelock-3.25.2-py3-none-any.whl", hash = "sha256:ca8afb0da15f229774c9ad1b455ed96e85a81373065fb10446672f64444ddf70", size = 26759, upload-time = "2026-03-11T20:45:37.437Z" }, +] + +[[package]] +name = "flask" +version = "3.1.3" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "blinker" }, + { name = "click" }, + { name = "itsdangerous" }, + { name = "jinja2" }, + { name = "markupsafe" }, + { name = "werkzeug" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/26/00/35d85dcce6c57fdc871f3867d465d780f302a175ea360f62533f12b27e2b/flask-3.1.3.tar.gz", hash = "sha256:0ef0e52b8a9cd932855379197dd8f94047b359ca0a78695144304cb45f87c9eb", size = 759004, upload-time = "2026-02-19T05:00:57.678Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/7f/9c/34f6962f9b9e9c71f6e5ed806e0d0ff03c9d1b0b2340088a0cf4bce09b18/flask-3.1.3-py3-none-any.whl", hash = "sha256:f4bcbefc124291925f1a26446da31a5178f9483862233b23c0c96a20701f670c", size = 103424, upload-time = "2026-02-19T05:00:56.027Z" }, +] + +[[package]] +name = "flask-admin" +version = "2.0.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "flask" }, + { name = "jinja2" }, + { name = "markupsafe" }, + { name = "werkzeug" }, + { name = "wtforms" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/cc/b7/78a1534b4fe1a40bccf79e8e274e1ace6ee1678c804e4c178b1c96e6c8d6/flask_admin-2.0.2.tar.gz", hash = "sha256:1d06aec7efee957972b43f6b08a0bd08d5f4cf9a337d4ece2f17c98abc2a214e", size = 5528977, upload-time = "2025-11-11T21:59:14.782Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2b/25/a379b8dc388630f1d173544c8b3ebbdb2ad5b60992e531b724d7f8a7ea03/flask_admin-2.0.2-py3-none-any.whl", hash = "sha256:4b3c44068de0fe4630dfcd190cc11231cbbdd7bac315c74c55d1764087b8b273", size = 6459099, upload-time = "2025-11-11T21:59:12.82Z" }, +] + +[[package]] +name = "flask-caching" +version = "2.3.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "cachelib" }, + { name = "flask" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/e2/80/74846c8af58ed60972d64f23a6cd0c3ac0175677d7555dff9f51bf82c294/flask_caching-2.3.1.tar.gz", hash = "sha256:65d7fd1b4eebf810f844de7de6258254b3248296ee429bdcb3f741bcbf7b98c9", size = 67560, upload-time = "2025-02-23T01:34:40.207Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/00/bb/82daa5e2fcecafadcc8659ce5779679d0641666f9252a4d5a2ae987b0506/Flask_Caching-2.3.1-py3-none-any.whl", hash = "sha256:d3efcf600e5925ea5a2fcb810f13b341ae984f5b52c00e9d9070392f3ca10761", size = 28916, upload-time = "2025-02-23T01:34:37.749Z" }, +] + +[[package]] +name = "flask-compress" +version = "1.23" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "brotli", marker = "platform_python_implementation != 'PyPy'" }, + { name = "brotlicffi", marker = "platform_python_implementation == 'PyPy'" }, + { name = "flask" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/5d/e4/2b54da5cf8ae5d38a495ca20154aa40d6d2ee6dc1756429a82856181aa2c/flask_compress-1.23.tar.gz", hash = "sha256:5580935b422e3f136b9a90909e4b1015ac2b29c9aebe0f8733b790fde461c545", size = 20135, upload-time = "2025-11-06T09:06:29.56Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/7d/9a/bebdcdba82d2786b33cd9f5fd65b8d309797c27176a9c4f357c1150c4ac0/flask_compress-1.23-py3-none-any.whl", hash = "sha256:52108afb4d133a5aab9809e6ac3c085ed7b9c788c75c6846c129faa28468f08c", size = 10515, upload-time = "2025-11-06T09:06:28.691Z" }, +] + +[[package]] +name = "flask-cors" +version = "6.0.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "flask" }, + { name = "werkzeug" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/70/74/0fc0fa68d62f21daef41017dafab19ef4b36551521260987eb3a5394c7ba/flask_cors-6.0.2.tar.gz", hash = "sha256:6e118f3698249ae33e429760db98ce032a8bf9913638d085ca0f4c5534ad2423", size = 13472, upload-time = "2025-12-12T20:31:42.861Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/4f/af/72ad54402e599152de6d067324c46fe6a4f531c7c65baf7e96c63db55eaf/flask_cors-6.0.2-py3-none-any.whl", hash = "sha256:e57544d415dfd7da89a9564e1e3a9e515042df76e12130641ca6f3f2f03b699a", size = 13257, upload-time = "2025-12-12T20:31:41.3Z" }, +] + +[[package]] +name = "flask-jwt-oidc" +version = "0.9.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "cachelib" }, + { name = "cryptography" }, + { name = "flask" }, + { name = "pyjwt" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/8f/59/8827de70afedb42ce19c28aeb2d166e9751538f5b7fa5b6303354ff6fb5d/flask_jwt_oidc-0.9.0.tar.gz", hash = "sha256:6c6169b52b73dbdc06f2e11b9481f382c4125a1b181f88f7270992200cda69a3", size = 7532, upload-time = "2026-03-14T15:53:01.502Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/04/08/85dde23b8855e8beb1a5014632fcf8da20242e99669af9fc4c1432bf1a64/flask_jwt_oidc-0.9.0-py3-none-any.whl", hash = "sha256:7ce75f002e7a1ef3639366bf03f62b86e9a3afbd2d1818cbcb71a196b027e55c", size = 9679, upload-time = "2026-03-14T15:53:00.026Z" }, +] + +[[package]] +name = "flask-login" +version = "0.6.3" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "flask" }, + { name = "werkzeug" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/c3/6e/2f4e13e373bb49e68c02c51ceadd22d172715a06716f9299d9df01b6ddb2/Flask-Login-0.6.3.tar.gz", hash = "sha256:5e23d14a607ef12806c699590b89d0f0e0d67baeec599d75947bf9c147330333", size = 48834, upload-time = "2023-10-30T14:53:21.151Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/59/f5/67e9cc5c2036f58115f9fe0f00d203cf6780c3ff8ae0e705e7a9d9e8ff9e/Flask_Login-0.6.3-py3-none-any.whl", hash = "sha256:849b25b82a436bf830a054e74214074af59097171562ab10bfa999e6b78aae5d", size = 17303, upload-time = "2023-10-30T14:53:19.636Z" }, +] + +[[package]] +name = "flask-marshmallow" +version = "1.4.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "flask" }, + { name = "marshmallow" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/09/43/6e5c19e8abc01f5daf1d3c8ad169c495335390572b8bead3f7e7302131c6/flask_marshmallow-1.4.0.tar.gz", hash = "sha256:98c90a253052c72d2ddddc925539ac33bbd780c6fba86478ffe18e3b89d8b471", size = 40970, upload-time = "2026-02-04T16:07:59.916Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/70/9b/7d0605c6f90d640547c3c9a0b95bc3bb17e252ae0f46f1dbfa90d2e06518/flask_marshmallow-1.4.0-py3-none-any.whl", hash = "sha256:b758fc2c428d0cbee6fd0ccf0d55524fe9e426a86a177dcc0fc8cd71ad4b7c59", size = 12254, upload-time = "2026-02-04T16:07:58.878Z" }, +] + +[[package]] +name = "flask-migrate" +version = "4.1.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "alembic" }, + { name = "flask" }, + { name = "flask-sqlalchemy" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/5a/8e/47c7b3c93855ceffc2eabfa271782332942443321a07de193e4198f920cf/flask_migrate-4.1.0.tar.gz", hash = "sha256:1a336b06eb2c3ace005f5f2ded8641d534c18798d64061f6ff11f79e1434126d", size = 21965, upload-time = "2025-01-10T18:51:11.848Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d2/c4/3f329b23d769fe7628a5fc57ad36956f1fb7132cf8837be6da762b197327/Flask_Migrate-4.1.0-py3-none-any.whl", hash = "sha256:24d8051af161782e0743af1b04a152d007bad9772b2bca67b7ec1e8ceeb3910d", size = 21237, upload-time = "2025-01-10T18:51:09.527Z" }, +] + +[[package]] +name = "flask-restx" +version = "1.3.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "aniso8601" }, + { name = "flask" }, + { name = "importlib-resources" }, + { name = "jsonschema" }, + { name = "referencing" }, + { name = "werkzeug" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/43/89/9b9ca58cbb8e9ec46f4a510ba93878e0c88d518bf03c350e3b1b7ad85cbe/flask-restx-1.3.2.tar.gz", hash = "sha256:0ae13d77e7d7e4dce513970cfa9db45364aef210e99022de26d2b73eb4dbced5", size = 2814719, upload-time = "2025-09-23T20:34:25.21Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/7a/3f/b82cd8e733a355db1abb8297afbf59ec972c00ef90bf8d4eed287958b204/flask_restx-1.3.2-py2.py3-none-any.whl", hash = "sha256:6e035496e8223668044fc45bf769e526352fd648d9e159bd631d94fd645a687b", size = 2799859, upload-time = "2025-09-23T20:34:23.055Z" }, +] + +[[package]] +name = "flask-socketio" +version = "5.6.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "blinker" }, + { name = "click" }, + { name = "flask" }, + { name = "jinja2" }, + { name = "python-socketio" }, + { name = "werkzeug" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/4b/61/3287c8a8fe4c3c59f2573d71aea7d334a113383ed3e6eb96e290dc80115f/flask_socketio-5.6.1.tar.gz", hash = "sha256:fe5bd995c3ed4da9a98f335d0d830fa1a19d84a64789f6265642a671fdacaeac", size = 37857, upload-time = "2026-02-21T13:07:52.858Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/08/98/2a46f4a3117c17fd36e07ad8b085054451e96723baaeea245682156ba546/flask_socketio-5.6.1-py3-none-any.whl", hash = "sha256:51a3f71b28b4476c650829607e3a993e076034db6c3cc31f718f0a4b45939d42", size = 18683, upload-time = "2026-02-21T13:07:51.442Z" }, +] + +[[package]] +name = "flask-sqlalchemy" +version = "3.1.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "flask" }, + { name = "sqlalchemy" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/91/53/b0a9fcc1b1297f51e68b69ed3b7c3c40d8c45be1391d77ae198712914392/flask_sqlalchemy-3.1.1.tar.gz", hash = "sha256:e4b68bb881802dda1a7d878b2fc84c06d1ee57fb40b874d3dc97dabfa36b8312", size = 81899, upload-time = "2023-09-11T21:42:36.147Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/1d/6a/89963a5c6ecf166e8be29e0d1bf6806051ee8fe6c82e232842e3aeac9204/flask_sqlalchemy-3.1.1-py3-none-any.whl", hash = "sha256:4ba4be7f419dc72f4efd8802d69974803c37259dd42f3913b0dcf75c9447e0a0", size = 25125, upload-time = "2023-09-11T21:42:34.514Z" }, +] + +[[package]] +name = "gevent" +version = "25.9.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "cffi", marker = "platform_python_implementation == 'CPython' and sys_platform == 'win32'" }, + { name = "greenlet", marker = "platform_python_implementation == 'CPython'" }, + { name = "zope-event" }, + { name = "zope-interface" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/9e/48/b3ef2673ffb940f980966694e40d6d32560f3ffa284ecaeb5ea3a90a6d3f/gevent-25.9.1.tar.gz", hash = "sha256:adf9cd552de44a4e6754c51ff2e78d9193b7fa6eab123db9578a210e657235dd", size = 5059025, upload-time = "2025-09-17T16:15:34.528Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/15/1a/948f8167b2cdce573cf01cec07afc64d0456dc134b07900b26ac7018b37e/gevent-25.9.1-cp314-cp314-macosx_11_0_universal2.whl", hash = "sha256:1a3fe4ea1c312dbf6b375b416925036fe79a40054e6bf6248ee46526ea628be1", size = 2982934, upload-time = "2025-09-17T14:54:11.302Z" }, + { url = "https://files.pythonhosted.org/packages/9b/ec/726b146d1d3aad82e03d2e1e1507048ab6072f906e83f97f40667866e582/gevent-25.9.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:0adb937f13e5fb90cca2edf66d8d7e99d62a299687400ce2edee3f3504009356", size = 1813982, upload-time = "2025-09-17T15:41:28.506Z" }, + { url = "https://files.pythonhosted.org/packages/35/5d/5f83f17162301662bd1ce702f8a736a8a8cac7b7a35e1d8b9866938d1f9d/gevent-25.9.1-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:427f869a2050a4202d93cf7fd6ab5cffb06d3e9113c10c967b6e2a0d45237cb8", size = 1894902, upload-time = "2025-09-17T15:49:03.702Z" }, + { url = "https://files.pythonhosted.org/packages/83/cd/cf5e74e353f60dab357829069ffc300a7bb414c761f52cf8c0c6e9728b8d/gevent-25.9.1-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:c049880175e8c93124188f9d926af0a62826a3b81aa6d3074928345f8238279e", size = 1861792, upload-time = "2025-09-17T15:49:23.279Z" }, + { url = "https://files.pythonhosted.org/packages/dd/65/b9a4526d4a4edce26fe4b3b993914ec9dc64baabad625a3101e51adb17f3/gevent-25.9.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:b5a67a0974ad9f24721034d1e008856111e0535f1541499f72a733a73d658d1c", size = 2113215, upload-time = "2025-09-17T15:15:16.34Z" }, + { url = "https://files.pythonhosted.org/packages/e5/be/7d35731dfaf8370795b606e515d964a0967e129db76ea7873f552045dd39/gevent-25.9.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:1d0f5d8d73f97e24ea8d24d8be0f51e0cf7c54b8021c1fddb580bf239474690f", size = 1833449, upload-time = "2025-09-17T15:52:43.75Z" }, + { url = "https://files.pythonhosted.org/packages/65/58/7bc52544ea5e63af88c4a26c90776feb42551b7555a1c89c20069c168a3f/gevent-25.9.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:ddd3ff26e5c4240d3fbf5516c2d9d5f2a998ef87cfb73e1429cfaeaaec860fa6", size = 2176034, upload-time = "2025-09-17T15:24:15.676Z" }, + { url = "https://files.pythonhosted.org/packages/c2/69/a7c4ba2ffbc7c7dbf6d8b4f5d0f0a421f7815d229f4909854266c445a3d4/gevent-25.9.1-cp314-cp314-win_amd64.whl", hash = "sha256:bb63c0d6cb9950cc94036a4995b9cc4667b8915366613449236970f4394f94d7", size = 1703019, upload-time = "2025-09-17T19:30:55.272Z" }, +] + +[[package]] +name = "greenlet" +version = "3.3.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/a3/51/1664f6b78fc6ebbd98019a1fd730e83fa78f2db7058f72b1463d3612b8db/greenlet-3.3.2.tar.gz", hash = "sha256:2eaf067fc6d886931c7962e8c6bede15d2f01965560f3359b27c80bde2d151f2", size = 188267, upload-time = "2026-02-20T20:54:15.531Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/3f/ae/8bffcbd373b57a5992cd077cbe8858fff39110480a9d50697091faea6f39/greenlet-3.3.2-cp314-cp314-macosx_11_0_universal2.whl", hash = "sha256:8d1658d7291f9859beed69a776c10822a0a799bc4bfe1bd4272bb60e62507dab", size = 279650, upload-time = "2026-02-20T20:18:00.783Z" }, + { url = "https://files.pythonhosted.org/packages/d1/c0/45f93f348fa49abf32ac8439938726c480bd96b2a3c6f4d949ec0124b69f/greenlet-3.3.2-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:18cb1b7337bca281915b3c5d5ae19f4e76d35e1df80f4ad3c1a7be91fadf1082", size = 650295, upload-time = "2026-02-20T20:47:34.036Z" }, + { url = "https://files.pythonhosted.org/packages/b3/de/dd7589b3f2b8372069ab3e4763ea5329940fc7ad9dcd3e272a37516d7c9b/greenlet-3.3.2-cp314-cp314-manylinux_2_24_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:c2e47408e8ce1c6f1ceea0dffcdf6ebb85cc09e55c7af407c99f1112016e45e9", size = 662163, upload-time = "2026-02-20T20:56:01.295Z" }, + { url = "https://files.pythonhosted.org/packages/cd/ac/85804f74f1ccea31ba518dcc8ee6f14c79f73fe36fa1beba38930806df09/greenlet-3.3.2-cp314-cp314-manylinux_2_24_s390x.manylinux_2_28_s390x.whl", hash = "sha256:e3cb43ce200f59483eb82949bf1835a99cf43d7571e900d7c8d5c62cdf25d2f9", size = 675371, upload-time = "2026-02-20T21:02:49.664Z" }, + { url = "https://files.pythonhosted.org/packages/d2/d8/09bfa816572a4d83bccd6750df1926f79158b1c36c5f73786e26dbe4ee38/greenlet-3.3.2-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:63d10328839d1973e5ba35e98cccbca71b232b14051fd957b6f8b6e8e80d0506", size = 664160, upload-time = "2026-02-20T20:21:04.015Z" }, + { url = "https://files.pythonhosted.org/packages/48/cf/56832f0c8255d27f6c35d41b5ec91168d74ec721d85f01a12131eec6b93c/greenlet-3.3.2-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:8e4ab3cfb02993c8cc248ea73d7dae6cec0253e9afa311c9b37e603ca9fad2ce", size = 1619181, upload-time = "2026-02-20T20:49:36.052Z" }, + { url = "https://files.pythonhosted.org/packages/0a/23/b90b60a4aabb4cec0796e55f25ffbfb579a907c3898cd2905c8918acaa16/greenlet-3.3.2-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:94ad81f0fd3c0c0681a018a976e5c2bd2ca2d9d94895f23e7bb1af4e8af4e2d5", size = 1687713, upload-time = "2026-02-20T20:21:11.684Z" }, + { url = "https://files.pythonhosted.org/packages/f3/ca/2101ca3d9223a1dc125140dbc063644dca76df6ff356531eb27bc267b446/greenlet-3.3.2-cp314-cp314-win_amd64.whl", hash = "sha256:8c4dd0f3997cf2512f7601563cc90dfb8957c0cff1e3a1b23991d4ea1776c492", size = 232034, upload-time = "2026-02-20T20:20:08.186Z" }, + { url = "https://files.pythonhosted.org/packages/f6/4a/ecf894e962a59dea60f04877eea0fd5724618da89f1867b28ee8b91e811f/greenlet-3.3.2-cp314-cp314-win_arm64.whl", hash = "sha256:cd6f9e2bbd46321ba3bbb4c8a15794d32960e3b0ae2cc4d49a1a53d314805d71", size = 231437, upload-time = "2026-02-20T20:18:59.722Z" }, + { url = "https://files.pythonhosted.org/packages/98/6d/8f2ef704e614bcf58ed43cfb8d87afa1c285e98194ab2cfad351bf04f81e/greenlet-3.3.2-cp314-cp314t-macosx_11_0_universal2.whl", hash = "sha256:e26e72bec7ab387ac80caa7496e0f908ff954f31065b0ffc1f8ecb1338b11b54", size = 286617, upload-time = "2026-02-20T20:19:29.856Z" }, + { url = "https://files.pythonhosted.org/packages/5e/0d/93894161d307c6ea237a43988f27eba0947b360b99ac5239ad3fe09f0b47/greenlet-3.3.2-cp314-cp314t-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8b466dff7a4ffda6ca975979bab80bdadde979e29fc947ac3be4451428d8b0e4", size = 655189, upload-time = "2026-02-20T20:47:35.742Z" }, + { url = "https://files.pythonhosted.org/packages/f5/2c/d2d506ebd8abcb57386ec4f7ba20f4030cbe56eae541bc6fd6ef399c0b41/greenlet-3.3.2-cp314-cp314t-manylinux_2_24_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:b8bddc5b73c9720bea487b3bffdb1840fe4e3656fba3bd40aa1489e9f37877ff", size = 658225, upload-time = "2026-02-20T20:56:02.527Z" }, + { url = "https://files.pythonhosted.org/packages/d1/67/8197b7e7e602150938049d8e7f30de1660cfb87e4c8ee349b42b67bdb2e1/greenlet-3.3.2-cp314-cp314t-manylinux_2_24_s390x.manylinux_2_28_s390x.whl", hash = "sha256:59b3e2c40f6706b05a9cd299c836c6aa2378cabe25d021acd80f13abf81181cf", size = 666581, upload-time = "2026-02-20T21:02:51.526Z" }, + { url = "https://files.pythonhosted.org/packages/8e/30/3a09155fbf728673a1dea713572d2d31159f824a37c22da82127056c44e4/greenlet-3.3.2-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b26b0f4428b871a751968285a1ac9648944cea09807177ac639b030bddebcea4", size = 657907, upload-time = "2026-02-20T20:21:05.259Z" }, + { url = "https://files.pythonhosted.org/packages/f3/fd/d05a4b7acd0154ed758797f0a43b4c0962a843bedfe980115e842c5b2d08/greenlet-3.3.2-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:1fb39a11ee2e4d94be9a76671482be9398560955c9e568550de0224e41104727", size = 1618857, upload-time = "2026-02-20T20:49:37.309Z" }, + { url = "https://files.pythonhosted.org/packages/6f/e1/50ee92a5db521de8f35075b5eff060dd43d39ebd46c2181a2042f7070385/greenlet-3.3.2-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:20154044d9085151bc309e7689d6f7ba10027f8f5a8c0676ad398b951913d89e", size = 1680010, upload-time = "2026-02-20T20:21:13.427Z" }, + { url = "https://files.pythonhosted.org/packages/29/4b/45d90626aef8e65336bed690106d1382f7a43665e2249017e9527df8823b/greenlet-3.3.2-cp314-cp314t-win_amd64.whl", hash = "sha256:c04c5e06ec3e022cbfe2cd4a846e1d4e50087444f875ff6d2c2ad8445495cf1a", size = 237086, upload-time = "2026-02-20T20:20:45.786Z" }, +] + +[[package]] +name = "gunicorn" +version = "25.2.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "packaging" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/dd/13/dd3f8e40ea3ee907a6cbf3d1f1f81afcc3ecd0087d313baabfe95372f15c/gunicorn-25.2.0.tar.gz", hash = "sha256:10bd7adb36d44945d97d0a1fdf9a0fb086ae9c7b39e56b4dece8555a6bf4a09c", size = 632709, upload-time = "2026-03-24T22:49:54.433Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/11/53/fb024445837e02cd5cf989cf349bfac6f3f433c05184ea5d49c8ade751c6/gunicorn-25.2.0-py3-none-any.whl", hash = "sha256:88f5b444d0055bf298435384af7294f325e2273fd37ba9f9ff7b98e0a1e5dfdc", size = 211659, upload-time = "2026-03-24T22:49:52.528Z" }, +] + +[[package]] +name = "h11" +version = "0.16.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/01/ee/02a2c011bdab74c6fb3c75474d40b3052059d95df7e73351460c8588d963/h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1", size = 101250, upload-time = "2025-04-24T03:35:25.427Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/04/4b/29cac41a4d98d144bf5f6d33995617b185d14b22401f75ca86f384e87ff1/h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86", size = 37515, upload-time = "2025-04-24T03:35:24.344Z" }, +] + +[[package]] +name = "idna" +version = "3.11" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/6f/6d/0703ccc57f3a7233505399edb88de3cbd678da106337b9fcde432b65ed60/idna-3.11.tar.gz", hash = "sha256:795dafcc9c04ed0c1fb032c2aa73654d8e8c5023a7df64a53f39190ada629902", size = 194582, upload-time = "2025-10-12T14:55:20.501Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/0e/61/66938bbb5fc52dbdf84594873d5b51fb1f7c7794e9c0f5bd885f30bc507b/idna-3.11-py3-none-any.whl", hash = "sha256:771a87f49d9defaf64091e6e6fe9c18d4833f140bd19464795bc32d966ca37ea", size = 71008, upload-time = "2025-10-12T14:55:18.883Z" }, +] + +[[package]] +name = "importlib-resources" +version = "6.5.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/cf/8c/f834fbf984f691b4f7ff60f50b514cc3de5cc08abfc3295564dd89c5e2e7/importlib_resources-6.5.2.tar.gz", hash = "sha256:185f87adef5bcc288449d98fb4fba07cea78bc036455dd44c5fc4a2fe78fed2c", size = 44693, upload-time = "2025-01-03T18:51:56.698Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a4/ed/1f1afb2e9e7f38a545d628f864d562a5ae64fe6f7a10e28ffb9b185b4e89/importlib_resources-6.5.2-py3-none-any.whl", hash = "sha256:789cfdc3ed28c78b67a06acb8126751ced69a3d5f79c095a98298cd8a760ccec", size = 37461, upload-time = "2025-01-03T18:51:54.306Z" }, +] + +[[package]] +name = "iniconfig" +version = "2.3.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/72/34/14ca021ce8e5dfedc35312d08ba8bf51fdd999c576889fc2c24cb97f4f10/iniconfig-2.3.0.tar.gz", hash = "sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730", size = 20503, upload-time = "2025-10-18T21:55:43.219Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/cb/b1/3846dd7f199d53cb17f49cba7e651e9ce294d8497c8c150530ed11865bb8/iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12", size = 7484, upload-time = "2025-10-18T21:55:41.639Z" }, +] + +[[package]] +name = "isort" +version = "8.0.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/ef/7c/ec4ab396d31b3b395e2e999c8f46dec78c5e29209fac49d1f4dace04041d/isort-8.0.1.tar.gz", hash = "sha256:171ac4ff559cdc060bcfff550bc8404a486fee0caab245679c2abe7cb253c78d", size = 769592, upload-time = "2026-02-28T10:08:20.685Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/3e/95/c7c34aa53c16353c56d0b802fba48d5f5caa2cdee7958acbcb795c830416/isort-8.0.1-py3-none-any.whl", hash = "sha256:28b89bc70f751b559aeca209e6120393d43fbe2490de0559662be7a9787e3d75", size = 89733, upload-time = "2026-02-28T10:08:19.466Z" }, +] + +[[package]] +name = "itsdangerous" +version = "2.2.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/9c/cb/8ac0172223afbccb63986cc25049b154ecfb5e85932587206f42317be31d/itsdangerous-2.2.0.tar.gz", hash = "sha256:e0050c0b7da1eea53ffaf149c0cfbb5c6e2e2b69c4bef22c81fa6eb73e5f6173", size = 54410, upload-time = "2024-04-16T21:28:15.614Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/04/96/92447566d16df59b2a776c0fb82dbc4d9e07cd95062562af01e408583fc4/itsdangerous-2.2.0-py3-none-any.whl", hash = "sha256:c6242fc49e35958c8b15141343aa660db5fc54d4f13a1db01a3f5891b98700ef", size = 16234, upload-time = "2024-04-16T21:28:14.499Z" }, +] + +[[package]] +name = "jinja2" +version = "3.1.6" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "markupsafe" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/df/bf/f7da0350254c0ed7c72f3e33cef02e048281fec7ecec5f032d4aac52226b/jinja2-3.1.6.tar.gz", hash = "sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d", size = 245115, upload-time = "2025-03-05T20:05:02.478Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/62/a1/3d680cbfd5f4b8f15abc1d571870c5fc3e594bb582bc3b64ea099db13e56/jinja2-3.1.6-py3-none-any.whl", hash = "sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67", size = 134899, upload-time = "2025-03-05T20:05:00.369Z" }, +] + +[[package]] +name = "jsonschema" +version = "4.26.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "attrs" }, + { name = "jsonschema-specifications" }, + { name = "referencing" }, + { name = "rpds-py" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/b3/fc/e067678238fa451312d4c62bf6e6cf5ec56375422aee02f9cb5f909b3047/jsonschema-4.26.0.tar.gz", hash = "sha256:0c26707e2efad8aa1bfc5b7ce170f3fccc2e4918ff85989ba9ffa9facb2be326", size = 366583, upload-time = "2026-01-07T13:41:07.246Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/69/90/f63fb5873511e014207a475e2bb4e8b2e570d655b00ac19a9a0ca0a385ee/jsonschema-4.26.0-py3-none-any.whl", hash = "sha256:d489f15263b8d200f8387e64b4c3a75f06629559fb73deb8fdfb525f2dab50ce", size = 90630, upload-time = "2026-01-07T13:41:05.306Z" }, +] + +[[package]] +name = "jsonschema-specifications" +version = "2025.9.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "referencing" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/19/74/a633ee74eb36c44aa6d1095e7cc5569bebf04342ee146178e2d36600708b/jsonschema_specifications-2025.9.1.tar.gz", hash = "sha256:b540987f239e745613c7a9176f3edb72b832a4ac465cf02712288397832b5e8d", size = 32855, upload-time = "2025-09-08T01:34:59.186Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/41/45/1a4ed80516f02155c51f51e8cedb3c1902296743db0bbc66608a0db2814f/jsonschema_specifications-2025.9.1-py3-none-any.whl", hash = "sha256:98802fee3a11ee76ecaca44429fda8a41bff98b00a0f2838151b113f210cc6fe", size = 18437, upload-time = "2025-09-08T01:34:57.871Z" }, +] + +[[package]] +name = "kombu" +version = "5.6.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "amqp" }, + { name = "packaging" }, + { name = "tzdata" }, + { name = "vine" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/b6/a5/607e533ed6c83ae1a696969b8e1c137dfebd5759a2e9682e26ff1b97740b/kombu-5.6.2.tar.gz", hash = "sha256:8060497058066c6f5aed7c26d7cd0d3b574990b09de842a8c5aaed0b92cc5a55", size = 472594, upload-time = "2025-12-29T20:30:07.779Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/fb/0f/834427d8c03ff1d7e867d3db3d176470c64871753252b21b4f4897d1fa45/kombu-5.6.2-py3-none-any.whl", hash = "sha256:efcfc559da324d41d61ca311b0c64965ea35b4c55cc04ee36e55386145dace93", size = 214219, upload-time = "2025-12-29T20:30:05.74Z" }, +] + +[[package]] +name = "mako" +version = "1.3.10" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "markupsafe" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/9e/38/bd5b78a920a64d708fe6bc8e0a2c075e1389d53bef8413725c63ba041535/mako-1.3.10.tar.gz", hash = "sha256:99579a6f39583fa7e5630a28c3c1f440e4e97a414b80372649c0ce338da2ea28", size = 392474, upload-time = "2025-04-10T12:44:31.16Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/87/fb/99f81ac72ae23375f22b7afdb7642aba97c00a713c217124420147681a2f/mako-1.3.10-py3-none-any.whl", hash = "sha256:baef24a52fc4fc514a0887ac600f9f1cff3d82c61d4d700a1fa84d597b88db59", size = 78509, upload-time = "2025-04-10T12:50:53.297Z" }, +] + +[[package]] +name = "markupsafe" +version = "3.0.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/7e/99/7690b6d4034fffd95959cbe0c02de8deb3098cc577c67bb6a24fe5d7caa7/markupsafe-3.0.3.tar.gz", hash = "sha256:722695808f4b6457b320fdc131280796bdceb04ab50fe1795cd540799ebe1698", size = 80313, upload-time = "2025-09-27T18:37:40.426Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/33/8a/8e42d4838cd89b7dde187011e97fe6c3af66d8c044997d2183fbd6d31352/markupsafe-3.0.3-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:eaa9599de571d72e2daf60164784109f19978b327a3910d3e9de8c97b5b70cfe", size = 11619, upload-time = "2025-09-27T18:37:06.342Z" }, + { url = "https://files.pythonhosted.org/packages/b5/64/7660f8a4a8e53c924d0fa05dc3a55c9cee10bbd82b11c5afb27d44b096ce/markupsafe-3.0.3-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:c47a551199eb8eb2121d4f0f15ae0f923d31350ab9280078d1e5f12b249e0026", size = 12029, upload-time = "2025-09-27T18:37:07.213Z" }, + { url = "https://files.pythonhosted.org/packages/da/ef/e648bfd021127bef5fa12e1720ffed0c6cbb8310c8d9bea7266337ff06de/markupsafe-3.0.3-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f34c41761022dd093b4b6896d4810782ffbabe30f2d443ff5f083e0cbbb8c737", size = 24408, upload-time = "2025-09-27T18:37:09.572Z" }, + { url = "https://files.pythonhosted.org/packages/41/3c/a36c2450754618e62008bf7435ccb0f88053e07592e6028a34776213d877/markupsafe-3.0.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:457a69a9577064c05a97c41f4e65148652db078a3a509039e64d3467b9e7ef97", size = 23005, upload-time = "2025-09-27T18:37:10.58Z" }, + { url = "https://files.pythonhosted.org/packages/bc/20/b7fdf89a8456b099837cd1dc21974632a02a999ec9bf7ca3e490aacd98e7/markupsafe-3.0.3-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:e8afc3f2ccfa24215f8cb28dcf43f0113ac3c37c2f0f0806d8c70e4228c5cf4d", size = 22048, upload-time = "2025-09-27T18:37:11.547Z" }, + { url = "https://files.pythonhosted.org/packages/9a/a7/591f592afdc734f47db08a75793a55d7fbcc6902a723ae4cfbab61010cc5/markupsafe-3.0.3-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:ec15a59cf5af7be74194f7ab02d0f59a62bdcf1a537677ce67a2537c9b87fcda", size = 23821, upload-time = "2025-09-27T18:37:12.48Z" }, + { url = "https://files.pythonhosted.org/packages/7d/33/45b24e4f44195b26521bc6f1a82197118f74df348556594bd2262bda1038/markupsafe-3.0.3-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:0eb9ff8191e8498cca014656ae6b8d61f39da5f95b488805da4bb029cccbfbaf", size = 21606, upload-time = "2025-09-27T18:37:13.485Z" }, + { url = "https://files.pythonhosted.org/packages/ff/0e/53dfaca23a69fbfbbf17a4b64072090e70717344c52eaaaa9c5ddff1e5f0/markupsafe-3.0.3-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:2713baf880df847f2bece4230d4d094280f4e67b1e813eec43b4c0e144a34ffe", size = 23043, upload-time = "2025-09-27T18:37:14.408Z" }, + { url = "https://files.pythonhosted.org/packages/46/11/f333a06fc16236d5238bfe74daccbca41459dcd8d1fa952e8fbd5dccfb70/markupsafe-3.0.3-cp314-cp314-win32.whl", hash = "sha256:729586769a26dbceff69f7a7dbbf59ab6572b99d94576a5592625d5b411576b9", size = 14747, upload-time = "2025-09-27T18:37:15.36Z" }, + { url = "https://files.pythonhosted.org/packages/28/52/182836104b33b444e400b14f797212f720cbc9ed6ba34c800639d154e821/markupsafe-3.0.3-cp314-cp314-win_amd64.whl", hash = "sha256:bdc919ead48f234740ad807933cdf545180bfbe9342c2bb451556db2ed958581", size = 15341, upload-time = "2025-09-27T18:37:16.496Z" }, + { url = "https://files.pythonhosted.org/packages/6f/18/acf23e91bd94fd7b3031558b1f013adfa21a8e407a3fdb32745538730382/markupsafe-3.0.3-cp314-cp314-win_arm64.whl", hash = "sha256:5a7d5dc5140555cf21a6fefbdbf8723f06fcd2f63ef108f2854de715e4422cb4", size = 14073, upload-time = "2025-09-27T18:37:17.476Z" }, + { url = "https://files.pythonhosted.org/packages/3c/f0/57689aa4076e1b43b15fdfa646b04653969d50cf30c32a102762be2485da/markupsafe-3.0.3-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:1353ef0c1b138e1907ae78e2f6c63ff67501122006b0f9abad68fda5f4ffc6ab", size = 11661, upload-time = "2025-09-27T18:37:18.453Z" }, + { url = "https://files.pythonhosted.org/packages/89/c3/2e67a7ca217c6912985ec766c6393b636fb0c2344443ff9d91404dc4c79f/markupsafe-3.0.3-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:1085e7fbddd3be5f89cc898938f42c0b3c711fdcb37d75221de2666af647c175", size = 12069, upload-time = "2025-09-27T18:37:19.332Z" }, + { url = "https://files.pythonhosted.org/packages/f0/00/be561dce4e6ca66b15276e184ce4b8aec61fe83662cce2f7d72bd3249d28/markupsafe-3.0.3-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1b52b4fb9df4eb9ae465f8d0c228a00624de2334f216f178a995ccdcf82c4634", size = 25670, upload-time = "2025-09-27T18:37:20.245Z" }, + { url = "https://files.pythonhosted.org/packages/50/09/c419f6f5a92e5fadde27efd190eca90f05e1261b10dbd8cbcb39cd8ea1dc/markupsafe-3.0.3-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:fed51ac40f757d41b7c48425901843666a6677e3e8eb0abcff09e4ba6e664f50", size = 23598, upload-time = "2025-09-27T18:37:21.177Z" }, + { url = "https://files.pythonhosted.org/packages/22/44/a0681611106e0b2921b3033fc19bc53323e0b50bc70cffdd19f7d679bb66/markupsafe-3.0.3-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:f190daf01f13c72eac4efd5c430a8de82489d9cff23c364c3ea822545032993e", size = 23261, upload-time = "2025-09-27T18:37:22.167Z" }, + { url = "https://files.pythonhosted.org/packages/5f/57/1b0b3f100259dc9fffe780cfb60d4be71375510e435efec3d116b6436d43/markupsafe-3.0.3-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:e56b7d45a839a697b5eb268c82a71bd8c7f6c94d6fd50c3d577fa39a9f1409f5", size = 24835, upload-time = "2025-09-27T18:37:23.296Z" }, + { url = "https://files.pythonhosted.org/packages/26/6a/4bf6d0c97c4920f1597cc14dd720705eca0bf7c787aebc6bb4d1bead5388/markupsafe-3.0.3-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:f3e98bb3798ead92273dc0e5fd0f31ade220f59a266ffd8a4f6065e0a3ce0523", size = 22733, upload-time = "2025-09-27T18:37:24.237Z" }, + { url = "https://files.pythonhosted.org/packages/14/c7/ca723101509b518797fedc2fdf79ba57f886b4aca8a7d31857ba3ee8281f/markupsafe-3.0.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:5678211cb9333a6468fb8d8be0305520aa073f50d17f089b5b4b477ea6e67fdc", size = 23672, upload-time = "2025-09-27T18:37:25.271Z" }, + { url = "https://files.pythonhosted.org/packages/fb/df/5bd7a48c256faecd1d36edc13133e51397e41b73bb77e1a69deab746ebac/markupsafe-3.0.3-cp314-cp314t-win32.whl", hash = "sha256:915c04ba3851909ce68ccc2b8e2cd691618c4dc4c4232fb7982bca3f41fd8c3d", size = 14819, upload-time = "2025-09-27T18:37:26.285Z" }, + { url = "https://files.pythonhosted.org/packages/1a/8a/0402ba61a2f16038b48b39bccca271134be00c5c9f0f623208399333c448/markupsafe-3.0.3-cp314-cp314t-win_amd64.whl", hash = "sha256:4faffd047e07c38848ce017e8725090413cd80cbc23d86e55c587bf979e579c9", size = 15426, upload-time = "2025-09-27T18:37:27.316Z" }, + { url = "https://files.pythonhosted.org/packages/70/bc/6f1c2f612465f5fa89b95bead1f44dcb607670fd42891d8fdcd5d039f4f4/markupsafe-3.0.3-cp314-cp314t-win_arm64.whl", hash = "sha256:32001d6a8fc98c8cb5c947787c5d08b0a50663d139f1305bac5885d98d9b40fa", size = 14146, upload-time = "2025-09-27T18:37:28.327Z" }, +] + +[[package]] +name = "marshmallow" +version = "4.2.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/7f/ed/ecdd3a8259680dc9626ed5971b110c9be560962e11f7b0319b45ec2092b1/marshmallow-4.2.3.tar.gz", hash = "sha256:3e3fef6b3603721a25a723b8caedfa488369bddaf9bc03b40b9442c90aebd22b", size = 222932, upload-time = "2026-03-25T23:27:18.237Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/58/2e/ce3278954d44903ccf8606c2a16e6b3ad8e10146c21de1b7b9b0f5812b23/marshmallow-4.2.3-py3-none-any.whl", hash = "sha256:c84fd89817ecea690bde1eb925036070e5e9883148217585adc56d5cfbc082b8", size = 48876, upload-time = "2026-03-25T23:27:16.907Z" }, +] + +[[package]] +name = "marshmallow-sqlalchemy" +version = "1.4.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "marshmallow" }, + { name = "sqlalchemy" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/1d/8c/861ed468b99773866d59e315a73a02538f503c99167d24b3b3f1c8e0242c/marshmallow_sqlalchemy-1.4.2.tar.gz", hash = "sha256:6410304bf98ec26ea35f3f9d3cee82e51fd093c434612add32a0bdcdb5668f7c", size = 51428, upload-time = "2025-04-09T23:44:54.734Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/26/62/9d87301c861b9bded849082d5c5d306dcfd0c3c304b7ed70d2151caaa4da/marshmallow_sqlalchemy-1.4.2-py3-none-any.whl", hash = "sha256:65aee301c4601e76a2fdb02764a65c18913afba2a3506a326c625d13ab405b40", size = 16740, upload-time = "2025-04-09T23:44:52.999Z" }, +] + +[[package]] +name = "mccabe" +version = "0.7.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/e7/ff/0ffefdcac38932a54d2b5eed4e0ba8a408f215002cd178ad1df0f2806ff8/mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325", size = 9658, upload-time = "2022-01-24T01:14:51.113Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/27/1a/1f68f9ba0c207934b35b86a8ca3aad8395a3d6dd7921c0686e23853ff5a9/mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e", size = 7350, upload-time = "2022-01-24T01:14:49.62Z" }, +] + +[[package]] +name = "minio" +version = "7.2.20" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "argon2-cffi" }, + { name = "certifi" }, + { name = "pycryptodome" }, + { name = "typing-extensions" }, + { name = "urllib3" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/40/df/6dfc6540f96a74125a11653cce717603fd5b7d0001a8e847b3e54e72d238/minio-7.2.20.tar.gz", hash = "sha256:95898b7a023fbbfde375985aa77e2cd6a0762268db79cf886f002a9ea8e68598", size = 136113, upload-time = "2025-11-27T00:37:15.569Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/3e/9a/b697530a882588a84db616580f2ba5d1d515c815e11c30d219145afeec87/minio-7.2.20-py3-none-any.whl", hash = "sha256:eb33dd2fb80e04c3726a76b13241c6be3c4c46f8d81e1d58e757786f6501897e", size = 93751, upload-time = "2025-11-27T00:37:13.993Z" }, +] + +[[package]] +name = "packaging" +version = "26.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/65/ee/299d360cdc32edc7d2cf530f3accf79c4fca01e96ffc950d8a52213bd8e4/packaging-26.0.tar.gz", hash = "sha256:00243ae351a257117b6a241061796684b084ed1c516a08c48a3f7e147a9d80b4", size = 143416, upload-time = "2026-01-21T20:50:39.064Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b7/b9/c538f279a4e237a006a2c98387d081e9eb060d203d8ed34467cc0f0b9b53/packaging-26.0-py3-none-any.whl", hash = "sha256:b36f1fef9334a5588b4166f8bcd26a14e521f2b55e6b9de3aaa80d3ff7a37529", size = 74366, upload-time = "2026-01-21T20:50:37.788Z" }, +] + +[[package]] +name = "platformdirs" +version = "4.9.4" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/19/56/8d4c30c8a1d07013911a8fdbd8f89440ef9f08d07a1b50ab8ca8be5a20f9/platformdirs-4.9.4.tar.gz", hash = "sha256:1ec356301b7dc906d83f371c8f487070e99d3ccf9e501686456394622a01a934", size = 28737, upload-time = "2026-03-05T18:34:13.271Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/63/d7/97f7e3a6abb67d8080dd406fd4df842c2be0efaf712d1c899c32a075027c/platformdirs-4.9.4-py3-none-any.whl", hash = "sha256:68a9a4619a666ea6439f2ff250c12a853cd1cbd5158d258bd824a7df6be2f868", size = 21216, upload-time = "2026-03-05T18:34:12.172Z" }, +] + +[[package]] +name = "pluggy" +version = "1.6.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f9/e2/3e91f31a7d2b083fe6ef3fa267035b518369d9511ffab804f839851d2779/pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3", size = 69412, upload-time = "2025-05-15T12:30:07.975Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746", size = 20538, upload-time = "2025-05-15T12:30:06.134Z" }, +] + +[[package]] +name = "psycopg2-binary" +version = "2.9.11" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/ac/6c/8767aaa597ba424643dc87348c6f1754dd9f48e80fdc1b9f7ca5c3a7c213/psycopg2-binary-2.9.11.tar.gz", hash = "sha256:b6aed9e096bf63f9e75edf2581aa9a7e7186d97ab5c177aa6c87797cd591236c", size = 379620, upload-time = "2025-10-10T11:14:48.041Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/64/12/93ef0098590cf51d9732b4f139533732565704f45bdc1ffa741b7c95fb54/psycopg2_binary-2.9.11-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:92e3b669236327083a2e33ccfa0d320dd01b9803b3e14dd986a4fc54aa00f4e1", size = 3756567, upload-time = "2025-10-10T11:13:11.885Z" }, + { url = "https://files.pythonhosted.org/packages/7c/a9/9d55c614a891288f15ca4b5209b09f0f01e3124056924e17b81b9fa054cc/psycopg2_binary-2.9.11-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:e0deeb03da539fa3577fcb0b3f2554a97f7e5477c246098dbb18091a4a01c16f", size = 3864755, upload-time = "2025-10-10T11:13:17.727Z" }, + { url = "https://files.pythonhosted.org/packages/13/1e/98874ce72fd29cbde93209977b196a2edae03f8490d1bd8158e7f1daf3a0/psycopg2_binary-2.9.11-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:9b52a3f9bb540a3e4ec0f6ba6d31339727b2950c9772850d6545b7eae0b9d7c5", size = 4411646, upload-time = "2025-10-10T11:13:24.432Z" }, + { url = "https://files.pythonhosted.org/packages/5a/bd/a335ce6645334fb8d758cc358810defca14a1d19ffbc8a10bd38a2328565/psycopg2_binary-2.9.11-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:db4fd476874ccfdbb630a54426964959e58da4c61c9feba73e6094d51303d7d8", size = 4468701, upload-time = "2025-10-10T11:13:29.266Z" }, + { url = "https://files.pythonhosted.org/packages/44/d6/c8b4f53f34e295e45709b7568bf9b9407a612ea30387d35eb9fa84f269b4/psycopg2_binary-2.9.11-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:47f212c1d3be608a12937cc131bd85502954398aaa1320cb4c14421a0ffccf4c", size = 4166293, upload-time = "2025-10-10T11:13:33.336Z" }, + { url = "https://files.pythonhosted.org/packages/4b/e0/f8cc36eadd1b716ab36bb290618a3292e009867e5c97ce4aba908cb99644/psycopg2_binary-2.9.11-cp314-cp314-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:e35b7abae2b0adab776add56111df1735ccc71406e56203515e228a8dc07089f", size = 3983184, upload-time = "2025-10-30T02:55:32.483Z" }, + { url = "https://files.pythonhosted.org/packages/53/3e/2a8fe18a4e61cfb3417da67b6318e12691772c0696d79434184a511906dc/psycopg2_binary-2.9.11-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:fcf21be3ce5f5659daefd2b3b3b6e4727b028221ddc94e6c1523425579664747", size = 3652650, upload-time = "2025-10-10T11:13:38.181Z" }, + { url = "https://files.pythonhosted.org/packages/76/36/03801461b31b29fe58d228c24388f999fe814dfc302856e0d17f97d7c54d/psycopg2_binary-2.9.11-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:9bd81e64e8de111237737b29d68039b9c813bdf520156af36d26819c9a979e5f", size = 3298663, upload-time = "2025-10-10T11:13:44.878Z" }, + { url = "https://files.pythonhosted.org/packages/97/77/21b0ea2e1a73aa5fa9222b2a6b8ba325c43c3a8d54272839c991f2345656/psycopg2_binary-2.9.11-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:32770a4d666fbdafab017086655bcddab791d7cb260a16679cc5a7338b64343b", size = 3044737, upload-time = "2025-10-30T02:55:35.69Z" }, + { url = "https://files.pythonhosted.org/packages/67/69/f36abe5f118c1dca6d3726ceae164b9356985805480731ac6712a63f24f0/psycopg2_binary-2.9.11-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:c3cb3a676873d7506825221045bd70e0427c905b9c8ee8d6acd70cfcbd6e576d", size = 3347643, upload-time = "2025-10-10T11:13:53.499Z" }, + { url = "https://files.pythonhosted.org/packages/e1/36/9c0c326fe3a4227953dfb29f5d0c8ae3b8eb8c1cd2967aa569f50cb3c61f/psycopg2_binary-2.9.11-cp314-cp314-win_amd64.whl", hash = "sha256:4012c9c954dfaccd28f94e84ab9f94e12df76b4afb22331b1f0d3154893a6316", size = 2803913, upload-time = "2025-10-10T11:13:57.058Z" }, +] + +[[package]] +name = "pyasn1" +version = "0.6.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/5c/5f/6583902b6f79b399c9c40674ac384fd9cd77805f9e6205075f828ef11fb2/pyasn1-0.6.3.tar.gz", hash = "sha256:697a8ecd6d98891189184ca1fa05d1bb00e2f84b5977c481452050549c8a72cf", size = 148685, upload-time = "2026-03-17T01:06:53.382Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/5d/a0/7d793dce3fa811fe047d6ae2431c672364b462850c6235ae306c0efd025f/pyasn1-0.6.3-py3-none-any.whl", hash = "sha256:a80184d120f0864a52a073acc6fc642847d0be408e7c7252f31390c0f4eadcde", size = 83997, upload-time = "2026-03-17T01:06:52.036Z" }, +] + +[[package]] +name = "pycparser" +version = "3.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/1b/7d/92392ff7815c21062bea51aa7b87d45576f649f16458d78b7cf94b9ab2e6/pycparser-3.0.tar.gz", hash = "sha256:600f49d217304a5902ac3c37e1281c9fe94e4d0489de643a9504c5cdfdfc6b29", size = 103492, upload-time = "2026-01-21T14:26:51.89Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/0c/c3/44f3fbbfa403ea2a7c779186dc20772604442dde72947e7d01069cbe98e3/pycparser-3.0-py3-none-any.whl", hash = "sha256:b727414169a36b7d524c1c3e31839a521725078d7b2ff038656844266160a992", size = 48172, upload-time = "2026-01-21T14:26:50.693Z" }, +] + +[[package]] +name = "pycryptodome" +version = "3.23.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/8e/a6/8452177684d5e906854776276ddd34eca30d1b1e15aa1ee9cefc289a33f5/pycryptodome-3.23.0.tar.gz", hash = "sha256:447700a657182d60338bab09fdb27518f8856aecd80ae4c6bdddb67ff5da44ef", size = 4921276, upload-time = "2025-05-17T17:21:45.242Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/db/6c/a1f71542c969912bb0e106f64f60a56cc1f0fabecf9396f45accbe63fa68/pycryptodome-3.23.0-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:187058ab80b3281b1de11c2e6842a357a1f71b42cb1e15bce373f3d238135c27", size = 2495627, upload-time = "2025-05-17T17:20:47.139Z" }, + { url = "https://files.pythonhosted.org/packages/6e/4e/a066527e079fc5002390c8acdd3aca431e6ea0a50ffd7201551175b47323/pycryptodome-3.23.0-cp37-abi3-macosx_10_9_x86_64.whl", hash = "sha256:cfb5cd445280c5b0a4e6187a7ce8de5a07b5f3f897f235caa11f1f435f182843", size = 1640362, upload-time = "2025-05-17T17:20:50.392Z" }, + { url = "https://files.pythonhosted.org/packages/50/52/adaf4c8c100a8c49d2bd058e5b551f73dfd8cb89eb4911e25a0c469b6b4e/pycryptodome-3.23.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:67bd81fcbe34f43ad9422ee8fd4843c8e7198dd88dd3d40e6de42ee65fbe1490", size = 2182625, upload-time = "2025-05-17T17:20:52.866Z" }, + { url = "https://files.pythonhosted.org/packages/5f/e9/a09476d436d0ff1402ac3867d933c61805ec2326c6ea557aeeac3825604e/pycryptodome-3.23.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c8987bd3307a39bc03df5c8e0e3d8be0c4c3518b7f044b0f4c15d1aa78f52575", size = 2268954, upload-time = "2025-05-17T17:20:55.027Z" }, + { url = "https://files.pythonhosted.org/packages/f9/c5/ffe6474e0c551d54cab931918127c46d70cab8f114e0c2b5a3c071c2f484/pycryptodome-3.23.0-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:aa0698f65e5b570426fc31b8162ed4603b0c2841cbb9088e2b01641e3065915b", size = 2308534, upload-time = "2025-05-17T17:20:57.279Z" }, + { url = "https://files.pythonhosted.org/packages/18/28/e199677fc15ecf43010f2463fde4c1a53015d1fe95fb03bca2890836603a/pycryptodome-3.23.0-cp37-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:53ecbafc2b55353edcebd64bf5da94a2a2cdf5090a6915bcca6eca6cc452585a", size = 2181853, upload-time = "2025-05-17T17:20:59.322Z" }, + { url = "https://files.pythonhosted.org/packages/ce/ea/4fdb09f2165ce1365c9eaefef36625583371ee514db58dc9b65d3a255c4c/pycryptodome-3.23.0-cp37-abi3-musllinux_1_2_i686.whl", hash = "sha256:156df9667ad9f2ad26255926524e1c136d6664b741547deb0a86a9acf5ea631f", size = 2342465, upload-time = "2025-05-17T17:21:03.83Z" }, + { url = "https://files.pythonhosted.org/packages/22/82/6edc3fc42fe9284aead511394bac167693fb2b0e0395b28b8bedaa07ef04/pycryptodome-3.23.0-cp37-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:dea827b4d55ee390dc89b2afe5927d4308a8b538ae91d9c6f7a5090f397af1aa", size = 2267414, upload-time = "2025-05-17T17:21:06.72Z" }, + { url = "https://files.pythonhosted.org/packages/59/fe/aae679b64363eb78326c7fdc9d06ec3de18bac68be4b612fc1fe8902693c/pycryptodome-3.23.0-cp37-abi3-win32.whl", hash = "sha256:507dbead45474b62b2bbe318eb1c4c8ee641077532067fec9c1aa82c31f84886", size = 1768484, upload-time = "2025-05-17T17:21:08.535Z" }, + { url = "https://files.pythonhosted.org/packages/54/2f/e97a1b8294db0daaa87012c24a7bb714147c7ade7656973fd6c736b484ff/pycryptodome-3.23.0-cp37-abi3-win_amd64.whl", hash = "sha256:c75b52aacc6c0c260f204cbdd834f76edc9fb0d8e0da9fbf8352ef58202564e2", size = 1799636, upload-time = "2025-05-17T17:21:10.393Z" }, + { url = "https://files.pythonhosted.org/packages/18/3d/f9441a0d798bf2b1e645adc3265e55706aead1255ccdad3856dbdcffec14/pycryptodome-3.23.0-cp37-abi3-win_arm64.whl", hash = "sha256:11eeeb6917903876f134b56ba11abe95c0b0fd5e3330def218083c7d98bbcb3c", size = 1703675, upload-time = "2025-05-17T17:21:13.146Z" }, +] + +[[package]] +name = "pygments" +version = "2.19.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/b0/77/a5b8c569bf593b0140bde72ea885a803b82086995367bf2037de0159d924/pygments-2.19.2.tar.gz", hash = "sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887", size = 4968631, upload-time = "2025-06-21T13:39:12.283Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c7/21/705964c7812476f378728bdf590ca4b771ec72385c533964653c68e86bdc/pygments-2.19.2-py3-none-any.whl", hash = "sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b", size = 1225217, upload-time = "2025-06-21T13:39:07.939Z" }, +] + +[[package]] +name = "pyjwt" +version = "2.12.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/c2/27/a3b6e5bf6ff856d2509292e95c8f57f0df7017cf5394921fc4e4ef40308a/pyjwt-2.12.1.tar.gz", hash = "sha256:c74a7a2adf861c04d002db713dd85f84beb242228e671280bf709d765b03672b", size = 102564, upload-time = "2026-03-13T19:27:37.25Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e5/7a/8dd906bd22e79e47397a61742927f6747fe93242ef86645ee9092e610244/pyjwt-2.12.1-py3-none-any.whl", hash = "sha256:28ca37c070cad8ba8cd9790cd940535d40274d22f80ab87f3ac6a713e6e8454c", size = 29726, upload-time = "2026-03-13T19:27:35.677Z" }, +] + +[[package]] +name = "pylint" +version = "4.0.5" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "astroid" }, + { name = "colorama", marker = "sys_platform == 'win32'" }, + { name = "dill" }, + { name = "isort" }, + { name = "mccabe" }, + { name = "platformdirs" }, + { name = "tomlkit" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/e4/b6/74d9a8a68b8067efce8d07707fe6a236324ee1e7808d2eb3646ec8517c7d/pylint-4.0.5.tar.gz", hash = "sha256:8cd6a618df75deb013bd7eb98327a95f02a6fb839205a6bbf5456ef96afb317c", size = 1572474, upload-time = "2026-02-20T09:07:33.621Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d5/6f/9ac2548e290764781f9e7e2aaf0685b086379dabfb29ca38536985471eaf/pylint-4.0.5-py3-none-any.whl", hash = "sha256:00f51c9b14a3b3ae08cff6b2cdd43f28165c78b165b628692e428fb1f8dc2cf2", size = 536694, upload-time = "2026-02-20T09:07:31.028Z" }, +] + +[[package]] +name = "pytest" +version = "9.0.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "sys_platform == 'win32'" }, + { name = "iniconfig" }, + { name = "packaging" }, + { name = "pluggy" }, + { name = "pygments" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/d1/db/7ef3487e0fb0049ddb5ce41d3a49c235bf9ad299b6a25d5780a89f19230f/pytest-9.0.2.tar.gz", hash = "sha256:75186651a92bd89611d1d9fc20f0b4345fd827c41ccd5c299a868a05d70edf11", size = 1568901, upload-time = "2025-12-06T21:30:51.014Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/3b/ab/b3226f0bd7cdcf710fbede2b3548584366da3b19b5021e74f5bde2a8fa3f/pytest-9.0.2-py3-none-any.whl", hash = "sha256:711ffd45bf766d5264d487b917733b453d917afd2b0ad65223959f59089f875b", size = 374801, upload-time = "2025-12-06T21:30:49.154Z" }, +] + +[[package]] +name = "pytest-cov" +version = "7.1.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "coverage" }, + { name = "pluggy" }, + { name = "pytest" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/b1/51/a849f96e117386044471c8ec2bd6cfebacda285da9525c9106aeb28da671/pytest_cov-7.1.0.tar.gz", hash = "sha256:30674f2b5f6351aa09702a9c8c364f6a01c27aae0c1366ae8016160d1efc56b2", size = 55592, upload-time = "2026-03-21T20:11:16.284Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/9d/7a/d968e294073affff457b041c2be9868a40c1c71f4a35fcc1e45e5493067b/pytest_cov-7.1.0-py3-none-any.whl", hash = "sha256:a0461110b7865f9a271aa1b51e516c9a95de9d696734a2f71e3e78f46e1d4678", size = 22876, upload-time = "2026-03-21T20:11:14.438Z" }, +] + +[[package]] +name = "python-dateutil" +version = "2.9.0.post0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "six" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/66/c0/0c8b6ad9f17a802ee498c46e004a0eb49bc148f2fd230864601a86dcf6db/python-dateutil-2.9.0.post0.tar.gz", hash = "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3", size = 342432, upload-time = "2024-03-01T18:36:20.211Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ec/57/56b9bcc3c9c6a792fcbaf139543cee77261f3651ca9da0c93f5c1221264b/python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427", size = 229892, upload-time = "2024-03-01T18:36:18.57Z" }, +] + +[[package]] +name = "python-dotenv" +version = "1.2.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/82/ed/0301aeeac3e5353ef3d94b6ec08bbcabd04a72018415dcb29e588514bba8/python_dotenv-1.2.2.tar.gz", hash = "sha256:2c371a91fbd7ba082c2c1dc1f8bf89ca22564a087c2c287cd9b662adde799cf3", size = 50135, upload-time = "2026-03-01T16:00:26.196Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/0b/d7/1959b9648791274998a9c3526f6d0ec8fd2233e4d4acce81bbae76b44b2a/python_dotenv-1.2.2-py3-none-any.whl", hash = "sha256:1d8214789a24de455a8b8bd8ae6fe3c6b69a5e3d64aa8a8e5d68e694bbcb285a", size = 22101, upload-time = "2026-03-01T16:00:25.09Z" }, +] + +[[package]] +name = "python-engineio" +version = "4.13.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "simple-websocket" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/34/12/bdef9dbeedbe2cdeba2a2056ad27b1fb081557d34b69a97f574843462cae/python_engineio-4.13.1.tar.gz", hash = "sha256:0a853fcef52f5b345425d8c2b921ac85023a04dfcf75d7b74696c61e940fd066", size = 92348, upload-time = "2026-02-06T23:38:06.12Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/aa/54/0cce26da03a981f949bb8449c9778537f75f5917c172e1d2992ff25cb57d/python_engineio-4.13.1-py3-none-any.whl", hash = "sha256:f32ad10589859c11053ad7d9bb3c9695cdf862113bfb0d20bc4d890198287399", size = 59847, upload-time = "2026-02-06T23:38:04.861Z" }, +] + +[[package]] +name = "python-jose" +version = "3.5.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "ecdsa" }, + { name = "pyasn1" }, + { name = "rsa" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/c6/77/3a1c9039db7124eb039772b935f2244fbb73fc8ee65b9acf2375da1c07bf/python_jose-3.5.0.tar.gz", hash = "sha256:fb4eaa44dbeb1c26dcc69e4bd7ec54a1cb8dd64d3b4d81ef08d90ff453f2b01b", size = 92726, upload-time = "2025-05-28T17:31:54.288Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d9/c3/0bd11992072e6a1c513b16500a5d07f91a24017c5909b02c72c62d7ad024/python_jose-3.5.0-py2.py3-none-any.whl", hash = "sha256:abd1202f23d34dfad2c3d28cb8617b90acf34132c7afd60abd0b0b7d3cb55771", size = 34624, upload-time = "2025-05-28T17:31:52.802Z" }, +] + +[package.optional-dependencies] +cryptography = [ + { name = "cryptography" }, +] + +[[package]] +name = "python-socketio" +version = "5.16.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "bidict" }, + { name = "python-engineio" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/59/81/cf8284f45e32efa18d3848ed82cdd4dcc1b657b082458fbe01ad3e1f2f8d/python_socketio-5.16.1.tar.gz", hash = "sha256:f863f98eacce81ceea2e742f6388e10ca3cdd0764be21d30d5196470edf5ea89", size = 128508, upload-time = "2026-02-06T23:42:07Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/07/c7/deb8c5e604404dbf10a3808a858946ca3547692ff6316b698945bb72177e/python_socketio-5.16.1-py3-none-any.whl", hash = "sha256:a3eb1702e92aa2f2b5d3ba00261b61f062cce51f1cfb6900bf3ab4d1934d2d35", size = 82054, upload-time = "2026-02-06T23:42:05.772Z" }, +] + +[[package]] +name = "queue-api" +version = "0.0.0" +source = { editable = "." } +dependencies = [ + { name = "alembic" }, + { name = "amqp" }, + { name = "click" }, + { name = "filelock" }, + { name = "flask" }, + { name = "flask-admin" }, + { name = "flask-caching" }, + { name = "flask-compress" }, + { name = "flask-cors" }, + { name = "flask-jwt-oidc" }, + { name = "flask-login" }, + { name = "flask-marshmallow" }, + { name = "flask-migrate" }, + { name = "flask-restx" }, + { name = "flask-socketio" }, + { name = "flask-sqlalchemy" }, + { name = "gevent" }, + { name = "gunicorn" }, + { name = "jinja2" }, + { name = "kombu" }, + { name = "markupsafe" }, + { name = "marshmallow" }, + { name = "marshmallow-sqlalchemy" }, + { name = "minio" }, + { name = "psycopg2-binary" }, + { name = "python-dateutil" }, + { name = "python-dotenv" }, + { name = "python-jose", extra = ["cryptography"] }, + { name = "redis" }, + { name = "requests" }, + { name = "snowplow-tracker" }, + { name = "sqlalchemy" }, + { name = "wtforms" }, +] + +[package.dev-dependencies] +dev = [ + { name = "isort" }, + { name = "pylint" }, + { name = "pytest" }, + { name = "pytest-cov" }, + { name = "ruff" }, +] + +[package.metadata] +requires-dist = [ + { name = "alembic", specifier = ">=1.18,<1.19" }, + { name = "amqp", specifier = ">=5.3,<5.4" }, + { name = "click", specifier = ">=8.3,<8.4" }, + { name = "filelock", specifier = ">=3.25,<3.26" }, + { name = "flask", specifier = ">=3.1,<3.2" }, + { name = "flask-admin", specifier = ">=2.0,<2.1" }, + { name = "flask-caching", specifier = ">=2.3,<2.4" }, + { name = "flask-compress", specifier = ">=1.23,<1.24" }, + { name = "flask-cors", specifier = ">=6.0,<6.1" }, + { name = "flask-jwt-oidc", specifier = ">=0.9,<0.10" }, + { name = "flask-login", specifier = ">=0.6,<0.7" }, + { name = "flask-marshmallow", specifier = ">=1.4,<1.5" }, + { name = "flask-migrate", specifier = ">=4.1,<4.2" }, + { name = "flask-restx", specifier = ">=1.3,<1.4" }, + { name = "flask-socketio", specifier = ">=5.6,<5.7" }, + { name = "flask-sqlalchemy", specifier = ">=3.1,<3.2" }, + { name = "gevent", specifier = ">=25.9,<25.10" }, + { name = "gunicorn", specifier = ">=25.2,<25.3" }, + { name = "jinja2", specifier = ">=3.1,<3.2" }, + { name = "kombu", specifier = ">=5.6,<5.7" }, + { name = "markupsafe", specifier = ">=3.0,<3.1" }, + { name = "marshmallow", specifier = ">=4.2,<4.3" }, + { name = "marshmallow-sqlalchemy", specifier = ">=1.4,<1.5" }, + { name = "minio", specifier = ">=7.2,<7.3" }, + { name = "psycopg2-binary", specifier = ">=2.9,<2.10" }, + { name = "python-dateutil", specifier = ">=2.9,<2.10" }, + { name = "python-dotenv", specifier = ">=1.2,<1.3" }, + { name = "python-jose", extras = ["cryptography"], specifier = ">=3.5,<3.6" }, + { name = "redis", specifier = ">=7.4,<7.5" }, + { name = "requests", specifier = ">=2.33,<2.34" }, + { name = "snowplow-tracker", specifier = ">=1.1,<1.2" }, + { name = "sqlalchemy", specifier = ">=2.0,<2.1" }, + { name = "wtforms", specifier = ">=3.2,<3.3" }, +] + +[package.metadata.requires-dev] +dev = [ + { name = "isort", specifier = ">=8.0,<8.1" }, + { name = "pylint", specifier = ">=4.0,<4.1" }, + { name = "pytest", specifier = ">=9.0,<9.1" }, + { name = "pytest-cov", specifier = ">=7.1,<7.2" }, + { name = "ruff", specifier = ">=0.15.8" }, +] + +[[package]] +name = "redis" +version = "7.4.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/7b/7f/3759b1d0d72b7c92f0d70ffd9dc962b7b7b5ee74e135f9d7d8ab06b8a318/redis-7.4.0.tar.gz", hash = "sha256:64a6ea7bf567ad43c964d2c30d82853f8df927c5c9017766c55a1d1ed95d18ad", size = 4943913, upload-time = "2026-03-24T09:14:37.53Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/74/3a/95deec7db1eb53979973ebd156f3369a72732208d1391cd2e5d127062a32/redis-7.4.0-py3-none-any.whl", hash = "sha256:a9c74a5c893a5ef8455a5adb793a31bb70feb821c86eccb62eebef5a19c429ec", size = 409772, upload-time = "2026-03-24T09:14:35.968Z" }, +] + +[[package]] +name = "referencing" +version = "0.37.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "attrs" }, + { name = "rpds-py" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/22/f5/df4e9027acead3ecc63e50fe1e36aca1523e1719559c499951bb4b53188f/referencing-0.37.0.tar.gz", hash = "sha256:44aefc3142c5b842538163acb373e24cce6632bd54bdb01b21ad5863489f50d8", size = 78036, upload-time = "2025-10-13T15:30:48.871Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2c/58/ca301544e1fa93ed4f80d724bf5b194f6e4b945841c5bfd555878eea9fcb/referencing-0.37.0-py3-none-any.whl", hash = "sha256:381329a9f99628c9069361716891d34ad94af76e461dcb0335825aecc7692231", size = 26766, upload-time = "2025-10-13T15:30:47.625Z" }, +] + +[[package]] +name = "requests" +version = "2.33.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "certifi" }, + { name = "charset-normalizer" }, + { name = "idna" }, + { name = "urllib3" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/34/64/8860370b167a9721e8956ae116825caff829224fbca0ca6e7bf8ddef8430/requests-2.33.0.tar.gz", hash = "sha256:c7ebc5e8b0f21837386ad0e1c8fe8b829fa5f544d8df3b2253bff14ef29d7652", size = 134232, upload-time = "2026-03-25T15:10:41.586Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/56/5d/c814546c2333ceea4ba42262d8c4d55763003e767fa169adc693bd524478/requests-2.33.0-py3-none-any.whl", hash = "sha256:3324635456fa185245e24865e810cecec7b4caf933d7eb133dcde67d48cee69b", size = 65017, upload-time = "2026-03-25T15:10:40.382Z" }, +] + +[[package]] +name = "rpds-py" +version = "0.30.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/20/af/3f2f423103f1113b36230496629986e0ef7e199d2aa8392452b484b38ced/rpds_py-0.30.0.tar.gz", hash = "sha256:dd8ff7cf90014af0c0f787eea34794ebf6415242ee1d6fa91eaba725cc441e84", size = 69469, upload-time = "2025-11-30T20:24:38.837Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/86/81/dad16382ebbd3d0e0328776d8fd7ca94220e4fa0798d1dc5e7da48cb3201/rpds_py-0.30.0-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:68f19c879420aa08f61203801423f6cd5ac5f0ac4ac82a2368a9fcd6a9a075e0", size = 362099, upload-time = "2025-11-30T20:23:27.316Z" }, + { url = "https://files.pythonhosted.org/packages/2b/60/19f7884db5d5603edf3c6bce35408f45ad3e97e10007df0e17dd57af18f8/rpds_py-0.30.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:ec7c4490c672c1a0389d319b3a9cfcd098dcdc4783991553c332a15acf7249be", size = 353192, upload-time = "2025-11-30T20:23:29.151Z" }, + { url = "https://files.pythonhosted.org/packages/bf/c4/76eb0e1e72d1a9c4703c69607cec123c29028bff28ce41588792417098ac/rpds_py-0.30.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f251c812357a3fed308d684a5079ddfb9d933860fc6de89f2b7ab00da481e65f", size = 384080, upload-time = "2025-11-30T20:23:30.785Z" }, + { url = "https://files.pythonhosted.org/packages/72/87/87ea665e92f3298d1b26d78814721dc39ed8d2c74b86e83348d6b48a6f31/rpds_py-0.30.0-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ac98b175585ecf4c0348fd7b29c3864bda53b805c773cbf7bfdaffc8070c976f", size = 394841, upload-time = "2025-11-30T20:23:32.209Z" }, + { url = "https://files.pythonhosted.org/packages/77/ad/7783a89ca0587c15dcbf139b4a8364a872a25f861bdb88ed99f9b0dec985/rpds_py-0.30.0-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3e62880792319dbeb7eb866547f2e35973289e7d5696c6e295476448f5b63c87", size = 516670, upload-time = "2025-11-30T20:23:33.742Z" }, + { url = "https://files.pythonhosted.org/packages/5b/3c/2882bdac942bd2172f3da574eab16f309ae10a3925644e969536553cb4ee/rpds_py-0.30.0-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4e7fc54e0900ab35d041b0601431b0a0eb495f0851a0639b6ef90f7741b39a18", size = 408005, upload-time = "2025-11-30T20:23:35.253Z" }, + { url = "https://files.pythonhosted.org/packages/ce/81/9a91c0111ce1758c92516a3e44776920b579d9a7c09b2b06b642d4de3f0f/rpds_py-0.30.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47e77dc9822d3ad616c3d5759ea5631a75e5809d5a28707744ef79d7a1bcfcad", size = 382112, upload-time = "2025-11-30T20:23:36.842Z" }, + { url = "https://files.pythonhosted.org/packages/cf/8e/1da49d4a107027e5fbc64daeab96a0706361a2918da10cb41769244b805d/rpds_py-0.30.0-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:b4dc1a6ff022ff85ecafef7979a2c6eb423430e05f1165d6688234e62ba99a07", size = 399049, upload-time = "2025-11-30T20:23:38.343Z" }, + { url = "https://files.pythonhosted.org/packages/df/5a/7ee239b1aa48a127570ec03becbb29c9d5a9eb092febbd1699d567cae859/rpds_py-0.30.0-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:4559c972db3a360808309e06a74628b95eaccbf961c335c8fe0d590cf587456f", size = 415661, upload-time = "2025-11-30T20:23:40.263Z" }, + { url = "https://files.pythonhosted.org/packages/70/ea/caa143cf6b772f823bc7929a45da1fa83569ee49b11d18d0ada7f5ee6fd6/rpds_py-0.30.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:0ed177ed9bded28f8deb6ab40c183cd1192aa0de40c12f38be4d59cd33cb5c65", size = 565606, upload-time = "2025-11-30T20:23:42.186Z" }, + { url = "https://files.pythonhosted.org/packages/64/91/ac20ba2d69303f961ad8cf55bf7dbdb4763f627291ba3d0d7d67333cced9/rpds_py-0.30.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:ad1fa8db769b76ea911cb4e10f049d80bf518c104f15b3edb2371cc65375c46f", size = 591126, upload-time = "2025-11-30T20:23:44.086Z" }, + { url = "https://files.pythonhosted.org/packages/21/20/7ff5f3c8b00c8a95f75985128c26ba44503fb35b8e0259d812766ea966c7/rpds_py-0.30.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:46e83c697b1f1c72b50e5ee5adb4353eef7406fb3f2043d64c33f20ad1c2fc53", size = 553371, upload-time = "2025-11-30T20:23:46.004Z" }, + { url = "https://files.pythonhosted.org/packages/72/c7/81dadd7b27c8ee391c132a6b192111ca58d866577ce2d9b0ca157552cce0/rpds_py-0.30.0-cp314-cp314-win32.whl", hash = "sha256:ee454b2a007d57363c2dfd5b6ca4a5d7e2c518938f8ed3b706e37e5d470801ed", size = 215298, upload-time = "2025-11-30T20:23:47.696Z" }, + { url = "https://files.pythonhosted.org/packages/3e/d2/1aaac33287e8cfb07aab2e6b8ac1deca62f6f65411344f1433c55e6f3eb8/rpds_py-0.30.0-cp314-cp314-win_amd64.whl", hash = "sha256:95f0802447ac2d10bcc69f6dc28fe95fdf17940367b21d34e34c737870758950", size = 228604, upload-time = "2025-11-30T20:23:49.501Z" }, + { url = "https://files.pythonhosted.org/packages/e8/95/ab005315818cc519ad074cb7784dae60d939163108bd2b394e60dc7b5461/rpds_py-0.30.0-cp314-cp314-win_arm64.whl", hash = "sha256:613aa4771c99f03346e54c3f038e4cc574ac09a3ddfb0e8878487335e96dead6", size = 222391, upload-time = "2025-11-30T20:23:50.96Z" }, + { url = "https://files.pythonhosted.org/packages/9e/68/154fe0194d83b973cdedcdcc88947a2752411165930182ae41d983dcefa6/rpds_py-0.30.0-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:7e6ecfcb62edfd632e56983964e6884851786443739dbfe3582947e87274f7cb", size = 364868, upload-time = "2025-11-30T20:23:52.494Z" }, + { url = "https://files.pythonhosted.org/packages/83/69/8bbc8b07ec854d92a8b75668c24d2abcb1719ebf890f5604c61c9369a16f/rpds_py-0.30.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:a1d0bc22a7cdc173fedebb73ef81e07faef93692b8c1ad3733b67e31e1b6e1b8", size = 353747, upload-time = "2025-11-30T20:23:54.036Z" }, + { url = "https://files.pythonhosted.org/packages/ab/00/ba2e50183dbd9abcce9497fa5149c62b4ff3e22d338a30d690f9af970561/rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0d08f00679177226c4cb8c5265012eea897c8ca3b93f429e546600c971bcbae7", size = 383795, upload-time = "2025-11-30T20:23:55.556Z" }, + { url = "https://files.pythonhosted.org/packages/05/6f/86f0272b84926bcb0e4c972262f54223e8ecc556b3224d281e6598fc9268/rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5965af57d5848192c13534f90f9dd16464f3c37aaf166cc1da1cae1fd5a34898", size = 393330, upload-time = "2025-11-30T20:23:57.033Z" }, + { url = "https://files.pythonhosted.org/packages/cb/e9/0e02bb2e6dc63d212641da45df2b0bf29699d01715913e0d0f017ee29438/rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9a4e86e34e9ab6b667c27f3211ca48f73dba7cd3d90f8d5b11be56e5dbc3fb4e", size = 518194, upload-time = "2025-11-30T20:23:58.637Z" }, + { url = "https://files.pythonhosted.org/packages/ee/ca/be7bca14cf21513bdf9c0606aba17d1f389ea2b6987035eb4f62bd923f25/rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e5d3e6b26f2c785d65cc25ef1e5267ccbe1b069c5c21b8cc724efee290554419", size = 408340, upload-time = "2025-11-30T20:24:00.2Z" }, + { url = "https://files.pythonhosted.org/packages/c2/c7/736e00ebf39ed81d75544c0da6ef7b0998f8201b369acf842f9a90dc8fce/rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:626a7433c34566535b6e56a1b39a7b17ba961e97ce3b80ec62e6f1312c025551", size = 383765, upload-time = "2025-11-30T20:24:01.759Z" }, + { url = "https://files.pythonhosted.org/packages/4a/3f/da50dfde9956aaf365c4adc9533b100008ed31aea635f2b8d7b627e25b49/rpds_py-0.30.0-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:acd7eb3f4471577b9b5a41baf02a978e8bdeb08b4b355273994f8b87032000a8", size = 396834, upload-time = "2025-11-30T20:24:03.687Z" }, + { url = "https://files.pythonhosted.org/packages/4e/00/34bcc2565b6020eab2623349efbdec810676ad571995911f1abdae62a3a0/rpds_py-0.30.0-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:fe5fa731a1fa8a0a56b0977413f8cacac1768dad38d16b3a296712709476fbd5", size = 415470, upload-time = "2025-11-30T20:24:05.232Z" }, + { url = "https://files.pythonhosted.org/packages/8c/28/882e72b5b3e6f718d5453bd4d0d9cf8df36fddeb4ddbbab17869d5868616/rpds_py-0.30.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:74a3243a411126362712ee1524dfc90c650a503502f135d54d1b352bd01f2404", size = 565630, upload-time = "2025-11-30T20:24:06.878Z" }, + { url = "https://files.pythonhosted.org/packages/3b/97/04a65539c17692de5b85c6e293520fd01317fd878ea1995f0367d4532fb1/rpds_py-0.30.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:3e8eeb0544f2eb0d2581774be4c3410356eba189529a6b3e36bbbf9696175856", size = 591148, upload-time = "2025-11-30T20:24:08.445Z" }, + { url = "https://files.pythonhosted.org/packages/85/70/92482ccffb96f5441aab93e26c4d66489eb599efdcf96fad90c14bbfb976/rpds_py-0.30.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:dbd936cde57abfee19ab3213cf9c26be06d60750e60a8e4dd85d1ab12c8b1f40", size = 556030, upload-time = "2025-11-30T20:24:10.956Z" }, + { url = "https://files.pythonhosted.org/packages/20/53/7c7e784abfa500a2b6b583b147ee4bb5a2b3747a9166bab52fec4b5b5e7d/rpds_py-0.30.0-cp314-cp314t-win32.whl", hash = "sha256:dc824125c72246d924f7f796b4f63c1e9dc810c7d9e2355864b3c3a73d59ade0", size = 211570, upload-time = "2025-11-30T20:24:12.735Z" }, + { url = "https://files.pythonhosted.org/packages/d0/02/fa464cdfbe6b26e0600b62c528b72d8608f5cc49f96b8d6e38c95d60c676/rpds_py-0.30.0-cp314-cp314t-win_amd64.whl", hash = "sha256:27f4b0e92de5bfbc6f86e43959e6edd1425c33b5e69aab0984a72047f2bcf1e3", size = 226532, upload-time = "2025-11-30T20:24:14.634Z" }, +] + +[[package]] +name = "rsa" +version = "4.9.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pyasn1" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/da/8a/22b7beea3ee0d44b1916c0c1cb0ee3af23b700b6da9f04991899d0c555d4/rsa-4.9.1.tar.gz", hash = "sha256:e7bdbfdb5497da4c07dfd35530e1a902659db6ff241e39d9953cad06ebd0ae75", size = 29034, upload-time = "2025-04-16T09:51:18.218Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/64/8d/0133e4eb4beed9e425d9a98ed6e081a55d195481b7632472be1af08d2f6b/rsa-4.9.1-py3-none-any.whl", hash = "sha256:68635866661c6836b8d39430f97a996acbd61bfa49406748ea243539fe239762", size = 34696, upload-time = "2025-04-16T09:51:17.142Z" }, +] + +[[package]] +name = "ruff" +version = "0.15.8" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/14/b0/73cf7550861e2b4824950b8b52eebdcc5adc792a00c514406556c5b80817/ruff-0.15.8.tar.gz", hash = "sha256:995f11f63597ee362130d1d5a327a87cb6f3f5eae3094c620bcc632329a4d26e", size = 4610921, upload-time = "2026-03-26T18:39:38.675Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/4a/92/c445b0cd6da6e7ae51e954939cb69f97e008dbe750cfca89b8cedc081be7/ruff-0.15.8-py3-none-linux_armv6l.whl", hash = "sha256:cbe05adeba76d58162762d6b239c9056f1a15a55bd4b346cfd21e26cd6ad7bc7", size = 10527394, upload-time = "2026-03-26T18:39:41.566Z" }, + { url = "https://files.pythonhosted.org/packages/eb/92/f1c662784d149ad1414cae450b082cf736430c12ca78367f20f5ed569d65/ruff-0.15.8-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:d3e3d0b6ba8dca1b7ef9ab80a28e840a20070c4b62e56d675c24f366ef330570", size = 10905693, upload-time = "2026-03-26T18:39:30.364Z" }, + { url = "https://files.pythonhosted.org/packages/ca/f2/7a631a8af6d88bcef997eb1bf87cc3da158294c57044aafd3e17030613de/ruff-0.15.8-py3-none-macosx_11_0_arm64.whl", hash = "sha256:6ee3ae5c65a42f273f126686353f2e08ff29927b7b7e203b711514370d500de3", size = 10323044, upload-time = "2026-03-26T18:39:33.37Z" }, + { url = "https://files.pythonhosted.org/packages/67/18/1bf38e20914a05e72ef3b9569b1d5c70a7ef26cd188d69e9ca8ef588d5bf/ruff-0.15.8-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fdce027ada77baa448077ccc6ebb2fa9c3c62fd110d8659d601cf2f475858d94", size = 10629135, upload-time = "2026-03-26T18:39:44.142Z" }, + { url = "https://files.pythonhosted.org/packages/d2/e9/138c150ff9af60556121623d41aba18b7b57d95ac032e177b6a53789d279/ruff-0.15.8-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:12e617fc01a95e5821648a6df341d80456bd627bfab8a829f7cfc26a14a4b4a3", size = 10348041, upload-time = "2026-03-26T18:39:52.178Z" }, + { url = "https://files.pythonhosted.org/packages/02/f1/5bfb9298d9c323f842c5ddeb85f1f10ef51516ac7a34ba446c9347d898df/ruff-0.15.8-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:432701303b26416d22ba696c39f2c6f12499b89093b61360abc34bcc9bf07762", size = 11121987, upload-time = "2026-03-26T18:39:55.195Z" }, + { url = "https://files.pythonhosted.org/packages/10/11/6da2e538704e753c04e8d86b1fc55712fdbdcc266af1a1ece7a51fff0d10/ruff-0.15.8-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d910ae974b7a06a33a057cb87d2a10792a3b2b3b35e33d2699fdf63ec8f6b17a", size = 11951057, upload-time = "2026-03-26T18:39:19.18Z" }, + { url = "https://files.pythonhosted.org/packages/83/f0/c9208c5fd5101bf87002fed774ff25a96eea313d305f1e5d5744698dc314/ruff-0.15.8-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2033f963c43949d51e6fdccd3946633c6b37c484f5f98c3035f49c27395a8ab8", size = 11464613, upload-time = "2026-03-26T18:40:06.301Z" }, + { url = "https://files.pythonhosted.org/packages/f8/22/d7f2fabdba4fae9f3b570e5605d5eb4500dcb7b770d3217dca4428484b17/ruff-0.15.8-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0f29b989a55572fb885b77464cf24af05500806ab4edf9a0fd8977f9759d85b1", size = 11257557, upload-time = "2026-03-26T18:39:57.972Z" }, + { url = "https://files.pythonhosted.org/packages/71/8c/382a9620038cf6906446b23ce8632ab8c0811b8f9d3e764f58bedd0c9a6f/ruff-0.15.8-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:ac51d486bf457cdc985a412fb1801b2dfd1bd8838372fc55de64b1510eff4bec", size = 11169440, upload-time = "2026-03-26T18:39:22.205Z" }, + { url = "https://files.pythonhosted.org/packages/4d/0d/0994c802a7eaaf99380085e4e40c845f8e32a562e20a38ec06174b52ef24/ruff-0.15.8-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:c9861eb959edab053c10ad62c278835ee69ca527b6dcd72b47d5c1e5648964f6", size = 10605963, upload-time = "2026-03-26T18:39:46.682Z" }, + { url = "https://files.pythonhosted.org/packages/19/aa/d624b86f5b0aad7cef6bbf9cd47a6a02dfdc4f72c92a337d724e39c9d14b/ruff-0.15.8-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:8d9a5b8ea13f26ae90838afc33f91b547e61b794865374f114f349e9036835fb", size = 10357484, upload-time = "2026-03-26T18:39:49.176Z" }, + { url = "https://files.pythonhosted.org/packages/35/c3/e0b7835d23001f7d999f3895c6b569927c4d39912286897f625736e1fd04/ruff-0.15.8-py3-none-musllinux_1_2_i686.whl", hash = "sha256:c2a33a529fb3cbc23a7124b5c6ff121e4d6228029cba374777bd7649cc8598b8", size = 10830426, upload-time = "2026-03-26T18:40:03.702Z" }, + { url = "https://files.pythonhosted.org/packages/f0/51/ab20b322f637b369383adc341d761eaaa0f0203d6b9a7421cd6e783d81b9/ruff-0.15.8-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:75e5cd06b1cf3f47a3996cfc999226b19aa92e7cce682dcd62f80d7035f98f49", size = 11345125, upload-time = "2026-03-26T18:39:27.799Z" }, + { url = "https://files.pythonhosted.org/packages/37/e6/90b2b33419f59d0f2c4c8a48a4b74b460709a557e8e0064cf33ad894f983/ruff-0.15.8-py3-none-win32.whl", hash = "sha256:bc1f0a51254ba21767bfa9a8b5013ca8149dcf38092e6a9eb704d876de94dc34", size = 10571959, upload-time = "2026-03-26T18:39:36.117Z" }, + { url = "https://files.pythonhosted.org/packages/1f/a2/ef467cb77099062317154c63f234b8a7baf7cb690b99af760c5b68b9ee7f/ruff-0.15.8-py3-none-win_amd64.whl", hash = "sha256:04f79eff02a72db209d47d665ba7ebcad609d8918a134f86cb13dd132159fc89", size = 11743893, upload-time = "2026-03-26T18:39:25.01Z" }, + { url = "https://files.pythonhosted.org/packages/15/e2/77be4fff062fa78d9b2a4dea85d14785dac5f1d0c1fb58ed52331f0ebe28/ruff-0.15.8-py3-none-win_arm64.whl", hash = "sha256:cf891fa8e3bb430c0e7fac93851a5978fc99c8fa2c053b57b118972866f8e5f2", size = 11048175, upload-time = "2026-03-26T18:40:01.06Z" }, +] + +[[package]] +name = "simple-websocket" +version = "1.1.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "wsproto" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/b0/d4/bfa032f961103eba93de583b161f0e6a5b63cebb8f2c7d0c6e6efe1e3d2e/simple_websocket-1.1.0.tar.gz", hash = "sha256:7939234e7aa067c534abdab3a9ed933ec9ce4691b0713c78acb195560aa52ae4", size = 17300, upload-time = "2024-10-10T22:39:31.412Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/52/59/0782e51887ac6b07ffd1570e0364cf901ebc36345fea669969d2084baebb/simple_websocket-1.1.0-py3-none-any.whl", hash = "sha256:4af6069630a38ed6c561010f0e11a5bc0d4ca569b36306eb257cd9a192497c8c", size = 13842, upload-time = "2024-10-10T22:39:29.645Z" }, +] + +[[package]] +name = "six" +version = "1.17.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/94/e7/b2c673351809dca68a0e064b6af791aa332cf192da575fd474ed7d6f16a2/six-1.17.0.tar.gz", hash = "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81", size = 34031, upload-time = "2024-12-04T17:35:28.174Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b7/ce/149a00dd41f10bc29e5921b496af8b574d8413afcd5e30dfa0ed46c2cc5e/six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274", size = 11050, upload-time = "2024-12-04T17:35:26.475Z" }, +] + +[[package]] +name = "snowplow-tracker" +version = "1.1.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "requests" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/ff/77/1ab6e5bafb9c80d8128f065a355377a04ac5b3c38eb719d920a9909d346e/snowplow_tracker-1.1.0.tar.gz", hash = "sha256:95d8fdc8bd542fd12a0b9a076852239cbaf0599eda8721deaf5f93f7138fe755", size = 34135, upload-time = "2025-02-21T10:58:48.112Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/78/10/1c76269cbf2d6e127f4415044d9ddb0295858230678bbf4bfba905593c82/snowplow_tracker-1.1.0-py3-none-any.whl", hash = "sha256:24ea32ddac9cca547421bf9ab162f5f33c00711c6ef118ad5f78093cee962224", size = 44128, upload-time = "2025-02-21T10:58:45.818Z" }, +] + +[[package]] +name = "sqlalchemy" +version = "2.0.48" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "greenlet", marker = "platform_machine == 'AMD64' or platform_machine == 'WIN32' or platform_machine == 'aarch64' or platform_machine == 'amd64' or platform_machine == 'ppc64le' or platform_machine == 'win32' or platform_machine == 'x86_64'" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/1f/73/b4a9737255583b5fa858e0bb8e116eb94b88c910164ed2ed719147bde3de/sqlalchemy-2.0.48.tar.gz", hash = "sha256:5ca74f37f3369b45e1f6b7b06afb182af1fd5dde009e4ffd831830d98cbe5fe7", size = 9886075, upload-time = "2026-03-02T15:28:51.474Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/f7/b3/f437eaa1cf028bb3c927172c7272366393e73ccd104dcf5b6963f4ab5318/sqlalchemy-2.0.48-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:e2d0d88686e3d35a76f3e15a34e8c12d73fc94c1dea1cd55782e695cc14086dd", size = 2154401, upload-time = "2026-03-02T15:49:17.24Z" }, + { url = "https://files.pythonhosted.org/packages/6c/1c/b3abdf0f402aa3f60f0df6ea53d92a162b458fca2321d8f1f00278506402/sqlalchemy-2.0.48-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:49b7bddc1eebf011ea5ab722fdbe67a401caa34a350d278cc7733c0e88fecb1f", size = 3274528, upload-time = "2026-03-02T15:50:41.489Z" }, + { url = "https://files.pythonhosted.org/packages/f2/5e/327428a034407651a048f5e624361adf3f9fbac9d0fa98e981e9c6ff2f5e/sqlalchemy-2.0.48-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:426c5ca86415d9b8945c7073597e10de9644802e2ff502b8e1f11a7a2642856b", size = 3279523, upload-time = "2026-03-02T15:53:32.962Z" }, + { url = "https://files.pythonhosted.org/packages/2a/ca/ece73c81a918add0965b76b868b7b5359e068380b90ef1656ee995940c02/sqlalchemy-2.0.48-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:288937433bd44e3990e7da2402fabc44a3c6c25d3704da066b85b89a85474ae0", size = 3224312, upload-time = "2026-03-02T15:50:42.996Z" }, + { url = "https://files.pythonhosted.org/packages/88/11/fbaf1ae91fa4ee43f4fe79661cead6358644824419c26adb004941bdce7c/sqlalchemy-2.0.48-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:8183dc57ae7d9edc1346e007e840a9f3d6aa7b7f165203a99e16f447150140d2", size = 3246304, upload-time = "2026-03-02T15:53:34.937Z" }, + { url = "https://files.pythonhosted.org/packages/fa/a8/5fb0deb13930b4f2f698c5541ae076c18981173e27dd00376dbaea7a9c82/sqlalchemy-2.0.48-cp314-cp314-win32.whl", hash = "sha256:1182437cb2d97988cfea04cf6cdc0b0bb9c74f4d56ec3d08b81e23d621a28cc6", size = 2116565, upload-time = "2026-03-02T15:54:38.321Z" }, + { url = "https://files.pythonhosted.org/packages/95/7e/e83615cb63f80047f18e61e31e8e32257d39458426c23006deeaf48f463b/sqlalchemy-2.0.48-cp314-cp314-win_amd64.whl", hash = "sha256:144921da96c08feb9e2b052c5c5c1d0d151a292c6135623c6b2c041f2a45f9e0", size = 2142205, upload-time = "2026-03-02T15:54:39.831Z" }, + { url = "https://files.pythonhosted.org/packages/83/e3/69d8711b3f2c5135e9cde5f063bc1605860f0b2c53086d40c04017eb1f77/sqlalchemy-2.0.48-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5aee45fd2c6c0f2b9cdddf48c48535e7471e42d6fb81adfde801da0bd5b93241", size = 3563519, upload-time = "2026-03-02T15:57:52.387Z" }, + { url = "https://files.pythonhosted.org/packages/f8/4f/a7cce98facca73c149ea4578981594aaa5fd841e956834931de503359336/sqlalchemy-2.0.48-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7cddca31edf8b0653090cbb54562ca027c421c58ddde2c0685f49ff56a1690e0", size = 3528611, upload-time = "2026-03-02T16:04:42.097Z" }, + { url = "https://files.pythonhosted.org/packages/cd/7d/5936c7a03a0b0cb0fa0cc425998821c6029756b0855a8f7ee70fba1de955/sqlalchemy-2.0.48-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:7a936f1bb23d370b7c8cc079d5fce4c7d18da87a33c6744e51a93b0f9e97e9b3", size = 3472326, upload-time = "2026-03-02T15:57:54.423Z" }, + { url = "https://files.pythonhosted.org/packages/f4/33/cea7dfc31b52904efe3dcdc169eb4514078887dff1f5ae28a7f4c5d54b3c/sqlalchemy-2.0.48-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:e004aa9248e8cb0a5f9b96d003ca7c1c0a5da8decd1066e7b53f59eb8ce7c62b", size = 3478453, upload-time = "2026-03-02T16:04:44.584Z" }, + { url = "https://files.pythonhosted.org/packages/c8/95/32107c4d13be077a9cae61e9ae49966a35dc4bf442a8852dd871db31f62e/sqlalchemy-2.0.48-cp314-cp314t-win32.whl", hash = "sha256:b8438ec5594980d405251451c5b7ea9aa58dda38eb7ac35fb7e4c696712ee24f", size = 2147209, upload-time = "2026-03-02T15:52:54.274Z" }, + { url = "https://files.pythonhosted.org/packages/d2/d7/1e073da7a4bc645eb83c76067284a0374e643bc4be57f14cc6414656f92c/sqlalchemy-2.0.48-cp314-cp314t-win_amd64.whl", hash = "sha256:d854b3970067297f3a7fbd7a4683587134aa9b3877ee15aa29eea478dc68f933", size = 2182198, upload-time = "2026-03-02T15:52:55.606Z" }, + { url = "https://files.pythonhosted.org/packages/46/2c/9664130905f03db57961b8980b05cab624afd114bf2be2576628a9f22da4/sqlalchemy-2.0.48-py3-none-any.whl", hash = "sha256:a66fe406437dd65cacd96a72689a3aaaecaebbcd62d81c5ac1c0fdbeac835096", size = 1940202, upload-time = "2026-03-02T15:52:43.285Z" }, +] + +[[package]] +name = "tomlkit" +version = "0.14.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/c3/af/14b24e41977adb296d6bd1fb59402cf7d60ce364f90c890bd2ec65c43b5a/tomlkit-0.14.0.tar.gz", hash = "sha256:cf00efca415dbd57575befb1f6634c4f42d2d87dbba376128adb42c121b87064", size = 187167, upload-time = "2026-01-13T01:14:53.304Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b5/11/87d6d29fb5d237229d67973a6c9e06e048f01cf4994dee194ab0ea841814/tomlkit-0.14.0-py3-none-any.whl", hash = "sha256:592064ed85b40fa213469f81ac584f67a4f2992509a7c3ea2d632208623a3680", size = 39310, upload-time = "2026-01-13T01:14:51.965Z" }, +] + +[[package]] +name = "typing-extensions" +version = "4.15.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/72/94/1a15dd82efb362ac84269196e94cf00f187f7ed21c242792a923cdb1c61f/typing_extensions-4.15.0.tar.gz", hash = "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466", size = 109391, upload-time = "2025-08-25T13:49:26.313Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/18/67/36e9267722cc04a6b9f15c7f3441c2363321a3ea07da7ae0c0707beb2a9c/typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548", size = 44614, upload-time = "2025-08-25T13:49:24.86Z" }, +] + +[[package]] +name = "tzdata" +version = "2025.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/5e/a7/c202b344c5ca7daf398f3b8a477eeb205cf3b6f32e7ec3a6bac0629ca975/tzdata-2025.3.tar.gz", hash = "sha256:de39c2ca5dc7b0344f2eba86f49d614019d29f060fc4ebc8a417896a620b56a7", size = 196772, upload-time = "2025-12-13T17:45:35.667Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c7/b0/003792df09decd6849a5e39c28b513c06e84436a54440380862b5aeff25d/tzdata-2025.3-py2.py3-none-any.whl", hash = "sha256:06a47e5700f3081aab02b2e513160914ff0694bce9947d6b76ebd6bf57cfc5d1", size = 348521, upload-time = "2025-12-13T17:45:33.889Z" }, +] + +[[package]] +name = "urllib3" +version = "2.6.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/c7/24/5f1b3bdffd70275f6661c76461e25f024d5a38a46f04aaca912426a2b1d3/urllib3-2.6.3.tar.gz", hash = "sha256:1b62b6884944a57dbe321509ab94fd4d3b307075e0c2eae991ac71ee15ad38ed", size = 435556, upload-time = "2026-01-07T16:24:43.925Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/39/08/aaaad47bc4e9dc8c725e68f9d04865dbcb2052843ff09c97b08904852d84/urllib3-2.6.3-py3-none-any.whl", hash = "sha256:bf272323e553dfb2e87d9bfd225ca7b0f467b919d7bbd355436d3fd37cb0acd4", size = 131584, upload-time = "2026-01-07T16:24:42.685Z" }, +] + +[[package]] +name = "vine" +version = "5.1.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/bd/e4/d07b5f29d283596b9727dd5275ccbceb63c44a1a82aa9e4bfd20426762ac/vine-5.1.0.tar.gz", hash = "sha256:8b62e981d35c41049211cf62a0a1242d8c1ee9bd15bb196ce38aefd6799e61e0", size = 48980, upload-time = "2023-11-05T08:46:53.857Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/03/ff/7c0c86c43b3cbb927e0ccc0255cb4057ceba4799cd44ae95174ce8e8b5b2/vine-5.1.0-py3-none-any.whl", hash = "sha256:40fdf3c48b2cfe1c38a49e9ae2da6fda88e4794c810050a728bd7413811fb1dc", size = 9636, upload-time = "2023-11-05T08:46:51.205Z" }, +] + +[[package]] +name = "werkzeug" +version = "3.1.7" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "markupsafe" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/b5/43/76ded108b296a49f52de6bac5192ca1c4be84e886f9b5c9ba8427d9694fd/werkzeug-3.1.7.tar.gz", hash = "sha256:fb8c01fe6ab13b9b7cdb46892b99b1d66754e1d7ab8e542e865ec13f526b5351", size = 875700, upload-time = "2026-03-24T01:08:07.687Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/7f/b2/0bba9bbb4596d2d2f285a16c2ab04118f6b957d8441566e1abb892e6a6b2/werkzeug-3.1.7-py3-none-any.whl", hash = "sha256:4b314d81163a3e1a169b6a0be2a000a0e204e8873c5de6586f453c55688d422f", size = 226295, upload-time = "2026-03-24T01:08:06.133Z" }, +] + +[[package]] +name = "wsproto" +version = "1.3.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "h11" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/c7/79/12135bdf8b9c9367b8701c2c19a14c913c120b882d50b014ca0d38083c2c/wsproto-1.3.2.tar.gz", hash = "sha256:b86885dcf294e15204919950f666e06ffc6c7c114ca900b060d6e16293528294", size = 50116, upload-time = "2025-11-20T18:18:01.871Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a4/f5/10b68b7b1544245097b2a1b8238f66f2fc6dcaeb24ba5d917f52bd2eed4f/wsproto-1.3.2-py3-none-any.whl", hash = "sha256:61eea322cdf56e8cc904bd3ad7573359a242ba65688716b0710a5eb12beab584", size = 24405, upload-time = "2025-11-20T18:18:00.454Z" }, +] + +[[package]] +name = "wtforms" +version = "3.2.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "markupsafe" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/01/e4/633d080897e769ed5712dcfad626e55dbd6cf45db0ff4d9884315c6a82da/wtforms-3.2.1.tar.gz", hash = "sha256:df3e6b70f3192e92623128123ec8dca3067df9cfadd43d59681e210cfb8d4682", size = 137801, upload-time = "2024-10-21T11:34:00.108Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/08/c9/2088fb5645cd289c99ebe0d4cdcc723922a1d8e1beaefb0f6f76dff9b21c/wtforms-3.2.1-py3-none-any.whl", hash = "sha256:583bad77ba1dd7286463f21e11aa3043ca4869d03575921d1a1698d0715e0fd4", size = 152454, upload-time = "2024-10-21T11:33:58.44Z" }, +] + +[[package]] +name = "zope-event" +version = "6.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/46/33/d3eeac228fc14de76615612ee208be2d8a5b5b0fada36bf9b62d6b40600c/zope_event-6.1.tar.gz", hash = "sha256:6052a3e0cb8565d3d4ef1a3a7809336ac519bc4fe38398cb8d466db09adef4f0", size = 18739, upload-time = "2025-11-07T08:05:49.934Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c2/b0/956902e5e1302f8c5d124e219c6bf214e2649f92ad5fce85b05c039a04c9/zope_event-6.1-py3-none-any.whl", hash = "sha256:0ca78b6391b694272b23ec1335c0294cc471065ed10f7f606858fc54566c25a0", size = 6414, upload-time = "2025-11-07T08:05:48.874Z" }, +] + +[[package]] +name = "zope-interface" +version = "8.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/86/a4/77daa5ba398996d16bb43fc721599d27d03eae68fe3c799de1963c72e228/zope_interface-8.2.tar.gz", hash = "sha256:afb20c371a601d261b4f6edb53c3c418c249db1a9717b0baafc9a9bb39ba1224", size = 254019, upload-time = "2026-01-09T07:51:07.253Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/1a/da/3c89de3917751446728b8898b4d53318bc2f8f6bf8196e150a063c59905e/zope_interface-8.2-cp314-cp314-macosx_10_9_x86_64.whl", hash = "sha256:46c7e4e8cbc698398a67e56ca985d19cb92365b4aafbeb6a712e8c101090f4cb", size = 209223, upload-time = "2026-01-09T08:05:36.449Z" }, + { url = "https://files.pythonhosted.org/packages/00/7f/62d00ec53f0a6e5df0c984781e6f3999ed265129c4c3413df8128d1e0207/zope_interface-8.2-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:a87fc7517f825a97ff4a4ca4c8a950593c59e0f8e7bfe1b6f898a38d5ba9f9cf", size = 209366, upload-time = "2026-01-09T08:05:38.197Z" }, + { url = "https://files.pythonhosted.org/packages/ef/a2/f241986315174be8e00aabecfc2153cf8029c1327cab8ed53a9d979d7e08/zope_interface-8.2-cp314-cp314-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl", hash = "sha256:ccf52f7d44d669203c2096c1a0c2c15d52e36b2e7a9413df50f48392c7d4d080", size = 261037, upload-time = "2026-01-09T08:05:39.568Z" }, + { url = "https://files.pythonhosted.org/packages/02/cc/b321c51d6936ede296a1b8860cf173bee2928357fe1fff7f97234899173f/zope_interface-8.2-cp314-cp314-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:aae807efc7bd26302eb2fea05cd6de7d59269ed6ae23a6de1ee47add6de99b8c", size = 264219, upload-time = "2026-01-09T08:05:41.624Z" }, + { url = "https://files.pythonhosted.org/packages/ab/fb/5f5e7b40a2f4efd873fe173624795ca47eaa22e29051270c981361b45209/zope_interface-8.2-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:05a0e42d6d830f547e114de2e7cd15750dc6c0c78f8138e6c5035e51ddfff37c", size = 264390, upload-time = "2026-01-09T08:05:42.936Z" }, + { url = "https://files.pythonhosted.org/packages/f9/82/3f2bc594370bc3abd58e5f9085d263bf682a222f059ed46275cde0570810/zope_interface-8.2-cp314-cp314-win_amd64.whl", hash = "sha256:561ce42390bee90bae51cf1c012902a8033b2aaefbd0deed81e877562a116d48", size = 212585, upload-time = "2026-01-09T08:05:44.419Z" }, +] diff --git a/api/wsgi.py b/api/wsgi.py index 8f3afd9af..0b570318a 100644 --- a/api/wsgi.py +++ b/api/wsgi.py @@ -1,10 +1,33 @@ -import eventlet +from gevent import monkey +import os -#Monkey patch to allow for async actions (aka multiple workers) -eventlet.monkey_patch() +# Monkey patch to allow for async actions (aka multiple workers) +monkey.patch_all() from qsystem import application, socketio + +def _env_flag(name, default=False): + value = os.environ.get(name) + if value is None: + return default + return value.strip().lower() in {"1", "true", "yes", "on"} + + if __name__ == "__main__": - print("Starting socketio app with debug=" + application.config['REDIS_DEBUG']) - socketio.run(application, debug=True) + debug = _env_flag("WSGI_DEBUG", True) + host = os.environ.get("WSGI_HOST", "0.0.0.0") + port = int(os.environ.get("WSGI_PORT", "5000")) + use_reloader = _env_flag("WSGI_USE_RELOADER", False) + + print( + "Starting socketio app" + + f" with debug={debug}, host={host}, port={port}, reloader={use_reloader}" + ) + socketio.run( + application, + host=host, + port=port, + debug=debug, + use_reloader=use_reloader, + ) diff --git a/appointment-booking/.gitignore b/appointment-booking/.gitignore new file mode 100644 index 000000000..5945dc6d8 --- /dev/null +++ b/appointment-booking/.gitignore @@ -0,0 +1,25 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local +ci_output.txt + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/appointment-booking/.prettierrc b/appointment-booking/.prettierrc new file mode 100644 index 000000000..c03d068ab --- /dev/null +++ b/appointment-booking/.prettierrc @@ -0,0 +1,7 @@ +{ + "semi": false, + "singleQuote": true, + "trailingComma": "all", + "printWidth": 100, + "tabWidth": 2 +} diff --git a/appointment-booking/Dockerfile b/appointment-booking/Dockerfile new file mode 100644 index 000000000..7e1358bfc --- /dev/null +++ b/appointment-booking/Dockerfile @@ -0,0 +1,20 @@ +# Stage 1: Builder +FROM node:22-alpine AS builder + +WORKDIR /app + +COPY package*.json ./ +RUN npm ci + +COPY . . +RUN npm run build + +# Stage 2: Runtime +FROM nginx:1.25.3 + +COPY nginx.conf /etc/nginx/nginx.conf +RUN mkdir /app +COPY --from=builder /app/dist /app + +EXPOSE 8080 +CMD ["nginx", "-g", "daemon off;"] diff --git a/appointment-booking/README.md b/appointment-booking/README.md new file mode 100644 index 000000000..e4aebadd3 --- /dev/null +++ b/appointment-booking/README.md @@ -0,0 +1,96 @@ +# Appointment Booking App + +A React 19 + TypeScript appointment booking interface built for BC Gov. + +## Prerequisites + +- Node.js 22+ +- npm 10+ + +For database and backend setup, follow the instructions in the [root README](../README.md). + +## Local Development + +### Install dependencies + +```bash +cd appointment-booking +npm install +``` + +### Start the frontend + +```bash +# Proxies /api/v1 to http://localhost:5000 (default) +npm run dev + +# If your local API runs on port 5100 +npm run dev:local +``` + +Open `http://localhost:5173`. The frontend starts without a running backend — API calls will fail gracefully until the backend is running. + +### Run Checks + +```bash +# Run everything at once (lint + type-check + test + build + license) +npm run ci:check + +# Individually +npm run test +npm run lint +npm run type-check +``` + +### Build for Production + +```bash +npm run build +# Output in ./dist/ +``` + +--- + +## Docker + +### Run with Docker Compose (recommended) + +From the repository root: + +```bash +docker compose --profile api up --build +``` + +Starts the frontend, API, database, and Keycloak. Open `http://localhost:5173`. + +> Note: running Docker compose will occupy port 5173. If you then run `npm run dev`, Vite will fall back to port 5174. + +### Build and run manually + +```bash +docker build -t appointment-booking . +docker run -p 5173:8080 appointment-booking +``` + +--- + +## Runtime Config + +The app fetches `/config/configuration.json` on startup to get its configuration. The default file is at [`public/config/configuration.json`](./public/config/configuration.json) and is served as a static file by nginx. + +In OpenShift, a ConfigMap mounts over this file to provide environment-specific values without rebuilding the image. + +```json +{ + "apiBaseUrl": "http://localhost:5000/api/v1", + "requestTimeoutMs": 10000 +} +``` + +--- + +## License + +MIT + Apache-2.0 (for BC Gov design system components) + +See `LICENSE` file and run `npm run license-check` to verify all dependencies comply. diff --git a/appointment-booking/eslint.config.js b/appointment-booking/eslint.config.js new file mode 100644 index 000000000..4d44fdae7 --- /dev/null +++ b/appointment-booking/eslint.config.js @@ -0,0 +1,31 @@ +import js from '@eslint/js' +import globals from 'globals' +import reactHooks from 'eslint-plugin-react-hooks' +import reactRefresh from 'eslint-plugin-react-refresh' +import tseslint from 'typescript-eslint' +import prettier from 'eslint-config-prettier' +import prettierPlugin from 'eslint-plugin-prettier' +import { defineConfig, globalIgnores } from 'eslint/config' + +export default defineConfig([ + globalIgnores(['dist']), + { + files: ['**/*.{ts,tsx}'], + extends: [ + js.configs.recommended, + tseslint.configs.recommended, + reactHooks.configs.flat.recommended, + reactRefresh.configs.vite, + prettier, + ], + plugins: { + prettier: prettierPlugin, + }, + languageOptions: { + globals: globals.browser, + }, + rules: { + 'prettier/prettier': 'error', + }, + }, +]) diff --git a/appointment-booking/index.html b/appointment-booking/index.html new file mode 100644 index 000000000..9f7a58db0 --- /dev/null +++ b/appointment-booking/index.html @@ -0,0 +1,13 @@ + + + + + + + appointment-booking + + +
+ + + diff --git a/appointment-booking/nginx.conf b/appointment-booking/nginx.conf new file mode 100644 index 000000000..40bfd5899 --- /dev/null +++ b/appointment-booking/nginx.conf @@ -0,0 +1,50 @@ +worker_processes auto; +error_log /var/log/nginx/error.log; +pid /tmp/nginx.pid; + +events { + worker_connections 4096; +} + +http { + include /etc/nginx/mime.types; + client_body_temp_path /tmp/client_temp; + proxy_temp_path /tmp/proxy_temp_path; + fastcgi_temp_path /tmp/fastcgi_temp; + uwsgi_temp_path /tmp/uwsgi_temp; + scgi_temp_path /tmp/scgi_temp; + default_type application/octet-stream; + server_tokens off; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + access_log /var/log/nginx/access.log main; + + server { + listen 8080; + server_name _; + + add_header Strict-Transport-Security "max-age=31536000;"; + add_header X-XSS-Protection "1; mode=block"; + add_header X-Content-Type-Options "nosniff"; + add_header X-Frame-Options "DENY"; + add_header Cache-Control "no-cache,no-store,must-revalidate"; + add_header Pragma "no-cache"; + + root /app; + index index.html; + error_log /dev/stdout info; + access_log /dev/stdout; + + location / { + try_files $uri $uri/ /index.html; + } + + location /nginx_status { + stub_status on; + allow all; + access_log off; + } + } +} diff --git a/appointment-booking/package-lock.json b/appointment-booking/package-lock.json new file mode 100644 index 000000000..43d15e996 --- /dev/null +++ b/appointment-booking/package-lock.json @@ -0,0 +1,5685 @@ +{ + "name": "appointment-booking", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "appointment-booking", + "version": "0.0.0", + "dependencies": { + "@bcgov/design-system-react-components": "^0.7.0", + "@bcgov/design-tokens": "^4.0.0", + "react": "^19.2.6", + "react-dom": "^19.2.6" + }, + "devDependencies": { + "@eslint/js": "^10.0.1", + "@testing-library/dom": "^10.4.1", + "@testing-library/jest-dom": "^6.9.1", + "@testing-library/react": "^16.3.2", + "@types/node": "^24.12.3", + "@types/react": "^19.2.14", + "@types/react-dom": "^19.2.3", + "@typescript-eslint/eslint-plugin": "^8.59.3", + "@typescript-eslint/parser": "^8.59.3", + "@vitejs/plugin-react": "^6.0.1", + "eslint": "^10.3.0", + "eslint-config-prettier": "^10.1.8", + "eslint-plugin-prettier": "^5.5.5", + "eslint-plugin-react-hooks": "^7.1.1", + "eslint-plugin-react-refresh": "^0.5.2", + "globals": "^17.6.0", + "jsdom": "^29.1.1", + "license-checker": "^25.0.1", + "prettier": "^3.8.3", + "typescript": "~6.0.2", + "typescript-eslint": "^8.59.2", + "vite": "^8.0.12", + "vitest": "^4.1.6" + } + }, + "node_modules/@adobe/css-tools": { + "version": "4.4.4", + "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.4.4.tgz", + "integrity": "sha512-Elp+iwUx5rN5+Y8xLt5/GRoG20WGoDCQ/1Fb+1LiGtvwbDavuSk0jhD/eZdckHAuzcDzccnkv+rEjyWfRx18gg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@adobe/react-spectrum": { + "version": "3.47.0", + "resolved": "https://registry.npmjs.org/@adobe/react-spectrum/-/react-spectrum-3.47.0.tgz", + "integrity": "sha512-EDQuMzz0kUeiMUUlxoeLFQyyxOXaAC7qlBw2PYOUfFLYd87xcV7VVV0JxiYx8zGk1IIY3UgQHgXrS1fv7CgezQ==", + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "@internationalized/date": "^3.12.1", + "@react-types/shared": "^3.34.0", + "@spectrum-icons/ui": "^3.7.0", + "@spectrum-icons/workflow": "^4.3.0", + "@swc/helpers": "^0.5.0", + "client-only": "^0.0.1", + "clsx": "^2.0.0", + "react-aria": "3.48.0", + "react-aria-components": "1.17.0", + "react-stately": "3.46.0", + "react-transition-group": "^4.4.5", + "use-sync-external-store": "^1.6.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@adobe/react-spectrum-ui": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@adobe/react-spectrum-ui/-/react-spectrum-ui-1.2.1.tgz", + "integrity": "sha512-wcrbEE2O/9WnEn6avBnaVRRx88S5PLFsPLr4wffzlbMfXeQsy+RMQwaJd3cbzrn18/j04Isit7f7Emfn0dhrJA==", + "license": "Apache-2.0", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/@adobe/react-spectrum-workflow": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@adobe/react-spectrum-workflow/-/react-spectrum-workflow-2.3.5.tgz", + "integrity": "sha512-b53VIPwPWKb/T5gzE3qs+QlGP5gVrw/LnWV3xMksDU+CRl3rzOKUwxIGiZO8ICyYh1WiyqY4myGlPU/nAynBUg==", + "license": "Apache-2.0", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/@adobe/react-spectrum/node_modules/react-aria-components": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/react-aria-components/-/react-aria-components-1.17.0.tgz", + "integrity": "sha512-0EyisMgvsFJ2aML3crDYv2tW5vT2Ryf8PGzY/g63JjDdCbLshlwazhS8JNtPF1vkTkungJJ6sVJbKyX+YKSoFA==", + "license": "Apache-2.0", + "dependencies": { + "@internationalized/date": "^3.12.1", + "@react-types/shared": "^3.34.0", + "@swc/helpers": "^0.5.0", + "client-only": "^0.0.1", + "react-aria": "3.48.0", + "react-stately": "3.46.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@asamuzakjp/css-color": { + "version": "5.1.11", + "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-5.1.11.tgz", + "integrity": "sha512-KVw6qIiCTUQhByfTd78h2yD1/00waTmm9uy/R7Ck/ctUyAPj+AEDLkQIdJW0T8+qGgj3j5bpNKK7Q3G+LedJWg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@asamuzakjp/generational-cache": "^1.0.1", + "@csstools/css-calc": "^3.2.0", + "@csstools/css-color-parser": "^4.1.0", + "@csstools/css-parser-algorithms": "^4.0.0", + "@csstools/css-tokenizer": "^4.0.0" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/@asamuzakjp/dom-selector": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@asamuzakjp/dom-selector/-/dom-selector-7.1.1.tgz", + "integrity": "sha512-67RZDnYRc8H/8MLDgQCDE//zoqVFwajkepHZgmXrbwybzXOEwOWGPYGmALYl9J2DOLfFPPs6kKCqmbzV895hTQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@asamuzakjp/generational-cache": "^1.0.1", + "@asamuzakjp/nwsapi": "^2.3.9", + "bidi-js": "^1.0.3", + "css-tree": "^3.2.1", + "is-potential-custom-element-name": "^1.0.1" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/@asamuzakjp/generational-cache": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@asamuzakjp/generational-cache/-/generational-cache-1.0.1.tgz", + "integrity": "sha512-wajfB8KqzMCN2KGNFdLkReeHncd0AslUSrvHVvvYWuU8ghncRJoA50kT3zP9MVL0+9g4/67H+cdvBskj9THPzg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/@asamuzakjp/nwsapi": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/@asamuzakjp/nwsapi/-/nwsapi-2.3.9.tgz", + "integrity": "sha512-n8GuYSrI9bF7FFZ/SjhwevlHc8xaVlb/7HmHelnc/PZXBD2ZR49NnN9sMMuDdEGPeeRQ5d0hqlSlEpgCX3Wl0Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@babel/code-frame": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.0.tgz", + "integrity": "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.28.5", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.29.3", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.3.tgz", + "integrity": "sha512-LIVqM46zQWZhj17qA8wb4nW/ixr2y1Nw+r1etiAWgRM6U1IqP+LNhL1yg440jYZR72jCWcWbLWzIosH+uP1fqg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz", + "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@babel/code-frame": "^7.29.0", + "@babel/generator": "^7.29.0", + "@babel/helper-compilation-targets": "^7.28.6", + "@babel/helper-module-transforms": "^7.28.6", + "@babel/helpers": "^7.28.6", + "@babel/parser": "^7.29.0", + "@babel/template": "^7.28.6", + "@babel/traverse": "^7.29.0", + "@babel/types": "^7.29.0", + "@jridgewell/remapping": "^2.3.5", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.29.1", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.1.tgz", + "integrity": "sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.0", + "@babel/types": "^7.29.0", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.28.6.tgz", + "integrity": "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.28.6", + "@babel/helper-validator-option": "^7.27.1", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-globals": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz", + "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.28.6.tgz", + "integrity": "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.28.6", + "@babel/types": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.6.tgz", + "integrity": "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.28.6", + "@babel/helper-validator-identifier": "^7.28.5", + "@babel/traverse": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", + "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", + "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", + "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.29.2", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.2.tgz", + "integrity": "sha512-HoGuUs4sCZNezVEKdVcwqmZN8GoHirLUcLaYVNBK2J0DadGtdcqgr3BCbvH8+XUo4NGjNl3VOtSjEKNzqfFgKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.28.6", + "@babel/types": "^7.29.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.29.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.3.tgz", + "integrity": "sha512-b3ctpQwp+PROvU/cttc4OYl4MzfJUWy6FZg+PMXfzmt/+39iHVF0sDfqay8TQM3JA2EUOyKcFZt75jWriQijsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.0" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.29.2", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.2.tgz", + "integrity": "sha512-JiDShH45zKHWyGe4ZNVRrCjBz8Nh9TMmZG1kh4QTK8hCBTWBi8Da+i7s1fJw7/lYpM4ccepSNfqzZ/QvABBi5g==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/template": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.28.6.tgz", + "integrity": "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.28.6", + "@babel/parser": "^7.28.6", + "@babel/types": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.0.tgz", + "integrity": "sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.0", + "@babel/generator": "^7.29.0", + "@babel/helper-globals": "^7.28.0", + "@babel/parser": "^7.29.0", + "@babel/template": "^7.28.6", + "@babel/types": "^7.29.0", + "debug": "^4.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.0.tgz", + "integrity": "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.27.1", + "@babel/helper-validator-identifier": "^7.28.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bcgov/bc-sans": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@bcgov/bc-sans/-/bc-sans-2.1.0.tgz", + "integrity": "sha512-1MesF4NAVpM5dywoJ68wNcBylHbPqg1dDV/FNuQm0BbspETGlPmfX8LG8rtrCjCAPhWuL2qRT/lBYDUMvFTUnw==", + "license": "SIL", + "peer": true + }, + "node_modules/@bcgov/design-system-react-components": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@bcgov/design-system-react-components/-/design-system-react-components-0.7.0.tgz", + "integrity": "sha512-WiAqos9Tv8WxAzccpN/HnKj7oDF1neX2rOX8hfKFsA8BBitjbYbvDTjv9eCVdVwkqxw9RyJ5bvoUIrHiwkPU5w==", + "license": "Apache-2.0", + "dependencies": { + "@bcgov/design-tokens": "3.2.0", + "react-aria-components": "1.16.0" + }, + "optionalDependencies": { + "@rollup/rollup-linux-x64-gnu": "*" + }, + "peerDependencies": { + "@bcgov/bc-sans": "^2.1.0", + "react": "^16.14.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.14.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/@bcgov/design-system-react-components/node_modules/@bcgov/design-tokens": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@bcgov/design-tokens/-/design-tokens-3.2.0.tgz", + "integrity": "sha512-2D3mPFKTpNLeIp8ER9y8oDKxXE8+rBfcvuF4yFd7uUvDm0izZNFhambUi6sN3OdkmuZoGQO7AjlMtOQzsHtxzA==", + "license": "Apache-2.0" + }, + "node_modules/@bcgov/design-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@bcgov/design-tokens/-/design-tokens-4.0.0.tgz", + "integrity": "sha512-kcen18Q/snP6M6JQ6XUQTlWXM1Gnm6y8Zk0i29K+T/Y0m/ab4PufmGpl43l/EJKCnYgpOaZFSXDK7CCO6P0INw==", + "license": "Apache-2.0" + }, + "node_modules/@bramus/specificity": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/@bramus/specificity/-/specificity-2.4.2.tgz", + "integrity": "sha512-ctxtJ/eA+t+6q2++vj5j7FYX3nRu311q1wfYH3xjlLOsczhlhxAg2FWNUXhpGvAw3BWo1xBcvOV6/YLc2r5FJw==", + "dev": true, + "license": "MIT", + "dependencies": { + "css-tree": "^3.0.0" + }, + "bin": { + "specificity": "bin/cli.js" + } + }, + "node_modules/@csstools/color-helpers": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-6.0.2.tgz", + "integrity": "sha512-LMGQLS9EuADloEFkcTBR3BwV/CGHV7zyDxVRtVDTwdI2Ca4it0CCVTT9wCkxSgokjE5Ho41hEPgb8OEUwoXr6Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/@csstools/css-calc": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-3.2.1.tgz", + "integrity": "sha512-DtdHlgXh5ZkA43cwBcAm+huzgJiwx3ZTWVjBs94kwz2xKqSimDA3lBgCjphYgwgVUMWatSM0pDd8TILB1yrVVg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^4.0.0", + "@csstools/css-tokenizer": "^4.0.0" + } + }, + "node_modules/@csstools/css-color-parser": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-4.1.1.tgz", + "integrity": "sha512-eZ5XOtyhK+mggRafYUWzA0tvaYOFgdY8AkgQiCJF9qNAePnUo/zmsqqYubBBb3sQ8uNUaSKTY9s9klfRaAXL0g==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "dependencies": { + "@csstools/color-helpers": "^6.0.2", + "@csstools/css-calc": "^3.2.1" + }, + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^4.0.0", + "@csstools/css-tokenizer": "^4.0.0" + } + }, + "node_modules/@csstools/css-parser-algorithms": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-4.0.0.tgz", + "integrity": "sha512-+B87qS7fIG3L5h3qwJ/IFbjoVoOe/bpOdh9hAjXbvx0o8ImEmUsGXN0inFOnk2ChCFgqkkGFQ+TpM5rbhkKe4w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "peer": true, + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-tokenizer": "^4.0.0" + } + }, + "node_modules/@csstools/css-syntax-patches-for-csstree": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@csstools/css-syntax-patches-for-csstree/-/css-syntax-patches-for-csstree-1.1.4.tgz", + "integrity": "sha512-wgsqt92b7C7tQhIdPNxj0n9zuUbQlvAuI1exyzeNrOKOi62SD7ren8zqszmpVREjAOqg8cD2FqYhQfAuKjk4sw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "peerDependencies": { + "css-tree": "^3.2.1" + }, + "peerDependenciesMeta": { + "css-tree": { + "optional": true + } + } + }, + "node_modules/@csstools/css-tokenizer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-4.0.0.tgz", + "integrity": "sha512-QxULHAm7cNu72w97JUNCBFODFaXpbDg+dP8b/oWFAZ2MTRppA3U00Y2L1HqaS4J6yBqxwa/Y3nMBaxVKbB/NsA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "peer": true, + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/@emnapi/core": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz", + "integrity": "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==", + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "1.2.1", + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.10.0.tgz", + "integrity": "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==", + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/wasi-threads": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz", + "integrity": "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz", + "integrity": "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.23.5", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.5.tgz", + "integrity": "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^3.0.5", + "debug": "^4.3.1", + "minimatch": "^10.2.4" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.5.5.tgz", + "integrity": "sha512-eIJYKTCECbP/nsKaaruF6LW967mtbQbsw4JTtSVkUQc9MneSkbrgPJAbKl9nWr0ZeowV8BfsarBmPpBzGelA2w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/core": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz", + "integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/js": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-10.0.1.tgz", + "integrity": "sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "eslint": "^10.0.0" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/@eslint/object-schema": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.5.tgz", + "integrity": "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.1.tgz", + "integrity": "sha512-rZAP3aVgB9ds9KOeUSL+zZ21hPmo8dh6fnIFwRQj5EAZl9gzR7wxYbYXYysAM8CTqGmUGyp2S4kUdV17MnGuWQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1", + "levn": "^0.4.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@exodus/bytes": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/@exodus/bytes/-/bytes-1.15.0.tgz", + "integrity": "sha512-UY0nlA+feH81UGSHv92sLEPLCeZFjXOuHhrIo0HQydScuQc8s0A7kL/UdgwgDq8g8ilksmuoF35YVTNphV2aBQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + }, + "peerDependencies": { + "@noble/hashes": "^1.8.0 || ^2.0.0" + }, + "peerDependenciesMeta": { + "@noble/hashes": { + "optional": true + } + } + }, + "node_modules/@formatjs/ecma402-abstract": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/@formatjs/ecma402-abstract/-/ecma402-abstract-2.3.6.tgz", + "integrity": "sha512-HJnTFeRM2kVFVr5gr5kH1XP6K0JcJtE7Lzvtr3FS/so5f1kpsqqqxy5JF+FRaO6H2qmcMfAUIox7AJteieRtVw==", + "license": "MIT", + "dependencies": { + "@formatjs/fast-memoize": "2.2.7", + "@formatjs/intl-localematcher": "0.6.2", + "decimal.js": "^10.4.3", + "tslib": "^2.8.0" + } + }, + "node_modules/@formatjs/fast-memoize": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/@formatjs/fast-memoize/-/fast-memoize-2.2.7.tgz", + "integrity": "sha512-Yabmi9nSvyOMrlSeGGWDiH7rf3a7sIwplbvo/dlz9WCIjzIQAfy1RMf4S0X3yG724n5Ghu2GmEl5NJIV6O9sZQ==", + "license": "MIT", + "dependencies": { + "tslib": "^2.8.0" + } + }, + "node_modules/@formatjs/icu-messageformat-parser": { + "version": "2.11.4", + "resolved": "https://registry.npmjs.org/@formatjs/icu-messageformat-parser/-/icu-messageformat-parser-2.11.4.tgz", + "integrity": "sha512-7kR78cRrPNB4fjGFZg3Rmj5aah8rQj9KPzuLsmcSn4ipLXQvC04keycTI1F7kJYDwIXtT2+7IDEto842CfZBtw==", + "license": "MIT", + "dependencies": { + "@formatjs/ecma402-abstract": "2.3.6", + "@formatjs/icu-skeleton-parser": "1.8.16", + "tslib": "^2.8.0" + } + }, + "node_modules/@formatjs/icu-skeleton-parser": { + "version": "1.8.16", + "resolved": "https://registry.npmjs.org/@formatjs/icu-skeleton-parser/-/icu-skeleton-parser-1.8.16.tgz", + "integrity": "sha512-H13E9Xl+PxBd8D5/6TVUluSpxGNvFSlN/b3coUp0e0JpuWXXnQDiavIpY3NnvSp4xhEMoXyyBvVfdFX8jglOHQ==", + "license": "MIT", + "dependencies": { + "@formatjs/ecma402-abstract": "2.3.6", + "tslib": "^2.8.0" + } + }, + "node_modules/@formatjs/intl-localematcher": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/@formatjs/intl-localematcher/-/intl-localematcher-0.6.2.tgz", + "integrity": "sha512-XOMO2Hupl0wdd172Y06h6kLpBz6Dv+J4okPLl4LPtzbr8f66WbIoy4ev98EBuZ6ZK4h5ydTN6XneT4QVpD7cdA==", + "license": "MIT", + "dependencies": { + "tslib": "^2.8.0" + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz", + "integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/types": "^0.15.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.8", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz", + "integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.2", + "@humanfs/types": "^0.15.0", + "@humanwhocodes/retry": "^0.4.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/types": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz", + "integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@internationalized/date": { + "version": "3.12.1", + "resolved": "https://registry.npmjs.org/@internationalized/date/-/date-3.12.1.tgz", + "integrity": "sha512-6IedsVWXyq4P9Tj+TxuU8WGWM70hYLl12nbYU8jkikVpa6WXapFazPUcHUMDMoWftIDE2ILDkFFte6W2nFCkRQ==", + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0" + } + }, + "node_modules/@internationalized/message": { + "version": "3.1.9", + "resolved": "https://registry.npmjs.org/@internationalized/message/-/message-3.1.9.tgz", + "integrity": "sha512-x03MSVTaB/4JHtW1VAYaY/2cCuBrHbWM6ZvlgpKdnSdW28tZbqpR673RJrVJyXWRw1bpgYN89Tz7ohX5tgNgPA==", + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0", + "intl-messageformat": "^10.1.0" + } + }, + "node_modules/@internationalized/number": { + "version": "3.6.6", + "resolved": "https://registry.npmjs.org/@internationalized/number/-/number-3.6.6.tgz", + "integrity": "sha512-iFgmQaXHE0vytNfpLZWOC2mEJCBRzcUxt53Xf/yCXG93lRvqas237i3r7X4RKMwO3txiyZD4mQjKAByFv6UGSQ==", + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0" + } + }, + "node_modules/@internationalized/string": { + "version": "3.2.8", + "resolved": "https://registry.npmjs.org/@internationalized/string/-/string-3.2.8.tgz", + "integrity": "sha512-NdbMQUSfXLYIQol5VyMtinm9pZDciiMfN7RtmSuSB78io1hqwJ0naYfxyW6vgxWBkzWymQa/3uLDlbfmshtCaA==", + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@napi-rs/wasm-runtime": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.4.tgz", + "integrity": "sha512-3NQNNgA1YSlJb/kMH1ildASP9HW7/7kYnRI2szWJaofaS1hWmbGI4H+d3+22aGzXXN9IJ+n+GiFVcGipJP18ow==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@tybys/wasm-util": "^0.10.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "peerDependencies": { + "@emnapi/core": "^1.7.1", + "@emnapi/runtime": "^1.7.1" + } + }, + "node_modules/@oxc-project/types": { + "version": "0.129.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.129.0.tgz", + "integrity": "sha512-3oz8m3FGdr2nDXVqmFUw7jolKliC4MoyXYIG2c7gpjBnzUWQpUGIYcXYKxTdTi+N2jusvt610ckTMkxdwHkYEg==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/Boshen" + } + }, + "node_modules/@pkgr/core": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.2.9.tgz", + "integrity": "sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/pkgr" + } + }, + "node_modules/@react-aria/autocomplete": { + "version": "3.0.0-rc.6", + "resolved": "https://registry.npmjs.org/@react-aria/autocomplete/-/autocomplete-3.0.0-rc.6.tgz", + "integrity": "sha512-uymUNJ8NW+dX7lmgkHE+SklAbxwktycAJcI5lBBw6KPZyc0EdMHC+/Fc5CUz3enIAhNwd2oxxogcSHknquMzQA==", + "license": "Apache-2.0", + "dependencies": { + "@react-aria/combobox": "^3.15.0", + "@react-aria/focus": "^3.21.5", + "@react-aria/i18n": "^3.12.16", + "@react-aria/interactions": "^3.27.1", + "@react-aria/listbox": "^3.15.3", + "@react-aria/searchfield": "^3.8.12", + "@react-aria/textfield": "^3.18.5", + "@react-aria/utils": "^3.33.1", + "@react-stately/autocomplete": "3.0.0-beta.4", + "@react-stately/combobox": "^3.13.0", + "@react-types/autocomplete": "3.0.0-alpha.38", + "@react-types/button": "^3.15.1", + "@react-types/shared": "^3.33.1", + "@swc/helpers": "^0.5.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-aria/button": { + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/@react-aria/button/-/button-3.15.0.tgz", + "integrity": "sha512-p8KehQ+OmhvhYmsjkp4K/Yv0tufyEBOHu6woJlRYL6kq5m6GKY5MZp8pyO26FpSiOyjhnZe6wbTyvCifvaokwQ==", + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0", + "react-aria": "3.48.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-aria/collections": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@react-aria/collections/-/collections-3.1.0.tgz", + "integrity": "sha512-OwWoxHaAN0jNw7oo17TfTPY2KZksDme4p5a8KCnNBfm/a0zo+y4wiOUaFpGDmDT6HxwznyBcu3x3oSN7orTtvA==", + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0", + "react-aria": "3.48.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-aria/combobox": { + "version": "3.16.0", + "resolved": "https://registry.npmjs.org/@react-aria/combobox/-/combobox-3.16.0.tgz", + "integrity": "sha512-yPPLduVUluCBuIFSZ+WgBMgl5oH7A5oQTemSpvf9ZmJ2oABIe+h6VQcwkEtMdokveHrdbmWIB9BL0E5jdDczAA==", + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0", + "react-aria": "3.48.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-aria/dnd": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/@react-aria/dnd/-/dnd-3.12.0.tgz", + "integrity": "sha512-FqAaxIMCgpq83UQhJRpSR+o3K4XQQYbJMKxhBWGL84Wn1p6m8QmWGvRKAiHeUoQXlY8R6KNxlMR/KjJvV8/lBA==", + "license": "Apache-2.0", + "dependencies": { + "@react-types/shared": "^3.34.0", + "@swc/helpers": "^0.5.0", + "react-aria": "3.48.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-aria/focus": { + "version": "3.22.0", + "resolved": "https://registry.npmjs.org/@react-aria/focus/-/focus-3.22.0.tgz", + "integrity": "sha512-ZfDOVuVhqDsM9mkNji3QUZ/d40JhlVgXrDkrfXylM1035QCrcTHN7m2DpbE95sU2A8EQb4wikvt5jM6K/73BPg==", + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0", + "react-aria": "3.48.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-aria/i18n": { + "version": "3.13.0", + "resolved": "https://registry.npmjs.org/@react-aria/i18n/-/i18n-3.13.0.tgz", + "integrity": "sha512-APjw4EwmvlnIyDxixSWfjHvOFFkW2rVTyKZ4l9FV0v7hOerh+FWLE6mF1XnnX3pgz3yARkKWwhSR9xYcRK6tpg==", + "license": "Apache-2.0", + "dependencies": { + "@internationalized/date": "^3.12.1", + "@internationalized/message": "^3.1.9", + "@internationalized/string": "^3.2.8", + "@swc/helpers": "^0.5.0", + "react-aria": "3.48.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-aria/interactions": { + "version": "3.28.0", + "resolved": "https://registry.npmjs.org/@react-aria/interactions/-/interactions-3.28.0.tgz", + "integrity": "sha512-OXwdU1EWFdMxmr/K1CXNGJzmNlCClByb+PuCaqUyzBymHPCGVhawirLIon/CrIN5psh3AiWpHSh4H0WeJdVpng==", + "license": "Apache-2.0", + "dependencies": { + "@react-types/shared": "^3.34.0", + "@swc/helpers": "^0.5.0", + "react-aria": "3.48.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-aria/listbox": { + "version": "3.16.0", + "resolved": "https://registry.npmjs.org/@react-aria/listbox/-/listbox-3.16.0.tgz", + "integrity": "sha512-Jv6aTJECRntBvG+0ZQtXniAtHEQjvEi2QSm35FxRcsB8kgv7TmcinUOSZuHe5r8RDY2djILwdrqmfy6ApX0MDA==", + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0", + "react-aria": "3.48.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-aria/live-announcer": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@react-aria/live-announcer/-/live-announcer-3.5.0.tgz", + "integrity": "sha512-1b+Txq00WQ/PJPCsZT+CI5qP86DrfFGPuJL5ifKtdMVXrxNGJWrfu7jTj6q9AbAOOXLG11BJ6blILu7sZeRPxg==", + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0", + "react-aria": "3.48.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-aria/overlays": { + "version": "3.32.0", + "resolved": "https://registry.npmjs.org/@react-aria/overlays/-/overlays-3.32.0.tgz", + "integrity": "sha512-H9meBB14/M0bDwk8gZl8Fu8bwZN2El9LDlk5cNkgAozbEiRuQvTFOeE3RoP6XI6bwEnSBvb0ovPmx3/kNyOehQ==", + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0", + "react-aria": "3.48.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-aria/searchfield": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@react-aria/searchfield/-/searchfield-3.9.0.tgz", + "integrity": "sha512-B8oOFhwGDotb7enoQ0bmXjhVkx8BkzK/ZnMmr4aF2ezexSFpG/ELkWqJPlfwknCwoBgBzhmpIKZvkoxQHR/iIw==", + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0", + "react-aria": "3.48.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-aria/ssr": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/@react-aria/ssr/-/ssr-3.10.0.tgz", + "integrity": "sha512-mnelvACtfNWWKFCT1YHebxJRmfBmmANGwHQhCFPByMVTx1L8RumcaLxChYkE87g2KPuP5xX2il/oRn1DytW+qQ==", + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0", + "react-aria": "3.48.0" + }, + "engines": { + "node": ">= 12" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-aria/textfield": { + "version": "3.19.0", + "resolved": "https://registry.npmjs.org/@react-aria/textfield/-/textfield-3.19.0.tgz", + "integrity": "sha512-P5Da8QFV/bCp3oCXQAqaTWhXNtx4vWEjvoqa49oG5TM1blodLjFrzNyiRM7TmQU0VLwiQPAQrqD4yaDLXZ0Nqg==", + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0", + "react-aria": "3.48.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-aria/toolbar": { + "version": "3.0.0-beta.24", + "resolved": "https://registry.npmjs.org/@react-aria/toolbar/-/toolbar-3.0.0-beta.24.tgz", + "integrity": "sha512-B2Rmpko7Ghi2RbNfsGdbR7I+RQBDhPGVE4bU3/EwHz+P/vNe5LyGPTeSwqaOMsQTF9lKNCkY8424dVTCr6RUMg==", + "license": "Apache-2.0", + "dependencies": { + "@react-aria/focus": "^3.21.5", + "@react-aria/i18n": "^3.12.16", + "@react-aria/utils": "^3.33.1", + "@react-types/shared": "^3.33.1", + "@swc/helpers": "^0.5.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-aria/utils": { + "version": "3.34.0", + "resolved": "https://registry.npmjs.org/@react-aria/utils/-/utils-3.34.0.tgz", + "integrity": "sha512-ZM1ZXIqpwGTJjjL6o3JhlZkEaBpQdxuOCqLEvwEwooaj5GsYI3E9UfOl5vy3UW6bYiEEWl9pNBntrb9CR9kItQ==", + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0", + "react-aria": "3.48.0", + "react-stately": "3.46.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-aria/virtualizer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@react-aria/virtualizer/-/virtualizer-4.2.0.tgz", + "integrity": "sha512-j4Dj/PMQK+d/2E2Dxyr5ifPdg8IG/NYsfZJtPnvKHXeKlI3vj7F/InamujwCuEFHZBK3YmxlRPRGcoMdS66qfw==", + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0", + "react-aria": "3.48.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-spectrum/button": { + "version": "3.18.0", + "resolved": "https://registry.npmjs.org/@react-spectrum/button/-/button-3.18.0.tgz", + "integrity": "sha512-SmjsXt+mLK2cf8PGstNZvLBfjqE5TjHW15yPIATI6ddqMdcC9JZ3ldnBTdFji9P/B6Rlop4ajnAdDV6bpxLtXA==", + "license": "Apache-2.0", + "dependencies": { + "@adobe/react-spectrum": "3.47.0", + "@swc/helpers": "^0.5.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-spectrum/combobox": { + "version": "3.17.0", + "resolved": "https://registry.npmjs.org/@react-spectrum/combobox/-/combobox-3.17.0.tgz", + "integrity": "sha512-HuJjm7m5W/lvpak0KQXAdqkvO17GpIfQ6/AuddnXEyltWhl481oRok04b9VQKdZAy9xrmmpReFcvXJ4zFDIGvg==", + "license": "Apache-2.0", + "dependencies": { + "@adobe/react-spectrum": "3.47.0", + "@swc/helpers": "^0.5.0", + "react-stately": "3.46.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-spectrum/form": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/@react-spectrum/form/-/form-3.8.0.tgz", + "integrity": "sha512-zNFA1zRFvoEZAhK6HxWyo2yUDlUXqCaaySxHvuCaevq4Zw3DKndbxq72ax9YDaUAvYlhgnb/bI616JBCZUAhdA==", + "license": "Apache-2.0", + "dependencies": { + "@adobe/react-spectrum": "3.47.0", + "@swc/helpers": "^0.5.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-spectrum/provider": { + "version": "3.11.0", + "resolved": "https://registry.npmjs.org/@react-spectrum/provider/-/provider-3.11.0.tgz", + "integrity": "sha512-W2Gxbj8AcG5OR2K5Ua3K8qQqxdsiytEiz+2rhr6oQyBM8VafEgDcNPYSOTtfjrQM3snl2Uhp8LzwN0jwQe/6nQ==", + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "@adobe/react-spectrum": "3.47.0", + "@swc/helpers": "^0.5.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-spectrum/searchfield": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@react-spectrum/searchfield/-/searchfield-3.9.0.tgz", + "integrity": "sha512-so1IeolnYPsgjoIJmoGakUuQv+Ij5NVoWx2VTBc3o2sUva1GkxtFp6Woiow2Qqw0mFyoTwwoKi6zQJHLMqHhvQ==", + "license": "Apache-2.0", + "dependencies": { + "@adobe/react-spectrum": "3.47.0", + "@swc/helpers": "^0.5.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-spectrum/table": { + "version": "3.18.0", + "resolved": "https://registry.npmjs.org/@react-spectrum/table/-/table-3.18.0.tgz", + "integrity": "sha512-ckvjjz/Tp8Y/Ck/OOOXX/dTs8PtoWCy7+QDBxWzNpqvxcLiLviudNKJFhGfeyGGDi3IOMWRSaG5yWN9wrvItNQ==", + "license": "Apache-2.0", + "dependencies": { + "@adobe/react-spectrum": "3.47.0", + "@swc/helpers": "^0.5.0", + "react-stately": "3.46.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-stately/autocomplete": { + "version": "3.0.0-beta.4", + "resolved": "https://registry.npmjs.org/@react-stately/autocomplete/-/autocomplete-3.0.0-beta.4.tgz", + "integrity": "sha512-K2Uy7XEdseFvgwRQ8CyrYEHMupjVKEszddOapP8deNz4hntYvT1aRm0m+sKa5Kl/4kvg9c/3NZpQcrky/vRZIg==", + "license": "Apache-2.0", + "dependencies": { + "@react-stately/utils": "^3.11.0", + "@swc/helpers": "^0.5.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-stately/combobox": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/@react-stately/combobox/-/combobox-3.14.0.tgz", + "integrity": "sha512-WYWJK9IzWKDqnFk1HF6FGISrhPh/bzYkRLgd40Psyke5dwYusOrEUzG161P8v9vxAzs621pYB4hz2UhrRWsMPQ==", + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0", + "react-stately": "3.46.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-stately/grid": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/@react-stately/grid/-/grid-3.12.0.tgz", + "integrity": "sha512-MLCN3hyxRpaj4tUnQyc+aFR2/QBP2rmFcXGdADHO1c0kvxd9Vk+bEe88uA9MJTz2VClQ+AN7yRGCTIuME+QvNQ==", + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0", + "react-stately": "3.46.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-stately/layout": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/@react-stately/layout/-/layout-4.7.0.tgz", + "integrity": "sha512-63VvOKI8KXeD3SO7yt41511CdZ+9wK2LVY2mpY+c87ML5fVVgMTc/o1IsYWI07rW3IjEFcWoW93eItgMbJCXyg==", + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0", + "react-stately": "3.46.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-stately/searchfield": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/@react-stately/searchfield/-/searchfield-3.6.0.tgz", + "integrity": "sha512-cSSDXynj3oQdILHSthEaB2pAIXG0POHKqjZZ07k6L/A0fkyhkwAbR/hyg+idHCH7Ah9hWnS+YhicWE1b6nw1zg==", + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0", + "react-stately": "3.46.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-stately/selection": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/@react-stately/selection/-/selection-3.21.0.tgz", + "integrity": "sha512-SBafuZoJgDr7L9dCgMjat1Mx85xOnRO7E5UCtAj6TF/7yhisJVnrNkfnryOH2CunPyXCUgfUlUebkxeXjbW+lw==", + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0", + "react-stately": "3.46.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-stately/table": { + "version": "3.16.0", + "resolved": "https://registry.npmjs.org/@react-stately/table/-/table-3.16.0.tgz", + "integrity": "sha512-xuvkFuRj8SYE36T+hEed+30oPCzbkcGNduVBAOJGr9K0z7y/a3OxFdOnAv/OsCvKW1sLK231oTSFvZ36zRFndA==", + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0", + "react-stately": "3.46.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-stately/utils": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/@react-stately/utils/-/utils-3.12.0.tgz", + "integrity": "sha512-7q+iHz9cENvro1dVKgdTxNh1i1mtWuLUI6UHp10TAgpxM9DyRDvmuN35zLXYCmMDgx3WLY2xkwqoez8xd+CdxQ==", + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0", + "react-stately": "3.46.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-stately/virtualizer": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/@react-stately/virtualizer/-/virtualizer-4.5.0.tgz", + "integrity": "sha512-Yf1xA9U7PuuaHgxWExwO5MrWCqzDZZTPCzo9YCcsilkOFk2GxMcGNysM71funj+d4CMqsWjCNmgNhZQjBXKjNw==", + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0", + "react-stately": "3.46.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-types/autocomplete": { + "version": "3.0.0-alpha.38", + "resolved": "https://registry.npmjs.org/@react-types/autocomplete/-/autocomplete-3.0.0-alpha.38.tgz", + "integrity": "sha512-0XrlVC8drzcrCNzybbkZdLcTofXEzBsHuaFevt5awW1J0xBJ+SMLIQMDeUYrvKjjwXUBlCtjJJpOvitGt4Z+KA==", + "license": "Apache-2.0", + "dependencies": { + "@react-types/combobox": "^3.14.0", + "@react-types/searchfield": "^3.6.8", + "@react-types/shared": "^3.33.1" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-types/button": { + "version": "3.16.0", + "resolved": "https://registry.npmjs.org/@react-types/button/-/button-3.16.0.tgz", + "integrity": "sha512-Z5///n2Y1jtF0gokBq2Y1K1cpOwsWZ24HPeAm3eEmZrbBXMrxC2oEA5ZThsSHuIGsqiyNJiQ2scsDftmr+PkZw==", + "license": "Apache-2.0", + "dependencies": { + "@react-aria/button": "^3.15.0", + "@react-spectrum/button": "^3.18.0" + }, + "peerDependencies": { + "@react-spectrum/provider": "^3.0.0", + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-types/combobox": { + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/@react-types/combobox/-/combobox-3.15.0.tgz", + "integrity": "sha512-iWV9UfLg1P0XhEqPTbnhsVMHFwc0RnrZjHfCLwgilH0Af0z1CQ8RyWiT8cOd1eqbkOAiVgCv29Xs8PAxaQBHSg==", + "license": "Apache-2.0", + "dependencies": { + "@react-aria/combobox": "^3.16.0", + "@react-spectrum/combobox": "^3.17.0", + "@react-stately/combobox": "^3.14.0" + }, + "peerDependencies": { + "@react-spectrum/provider": "^3.0.0", + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-types/form": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/@react-types/form/-/form-3.8.0.tgz", + "integrity": "sha512-ff38E4/5xLxqVemicLw+GefRoWBJEAro+hDwFZ5sde6kslktYt2LHJ7+IkID6yQYy+T3qxXgIdfxX+O1rlpWvw==", + "license": "Apache-2.0", + "dependencies": { + "@react-spectrum/form": "^3.8.0", + "@react-types/shared": "^3.34.0" + }, + "peerDependencies": { + "@react-spectrum/provider": "^3.0.0", + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-types/grid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@react-types/grid/-/grid-3.4.0.tgz", + "integrity": "sha512-h+u3hKli9gVwfYx6cabkTNZrP+HQ97vAmTugGIk5IAfouE6kjhoDaDzVD0VUvIWqc12LIkrqe1LdBMZ0ofbV6A==", + "license": "Apache-2.0", + "dependencies": { + "@react-stately/grid": "^3.12.0" + }, + "peerDependencies": { + "@react-spectrum/provider": "^3.0.0", + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-types/searchfield": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/@react-types/searchfield/-/searchfield-3.7.0.tgz", + "integrity": "sha512-/JBVYkXLB4EozPEfgpYW7C9tzw4xUmdVmuf7g+8ip/AsFgsyW/FjdLpbaXESXR78D0nppWaNxUxcdUXcuo+eEg==", + "license": "Apache-2.0", + "dependencies": { + "@react-aria/searchfield": "^3.9.0", + "@react-spectrum/searchfield": "^3.9.0", + "@react-stately/searchfield": "^3.6.0" + }, + "peerDependencies": { + "@react-spectrum/provider": "^3.0.0", + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-types/shared": { + "version": "3.34.0", + "resolved": "https://registry.npmjs.org/@react-types/shared/-/shared-3.34.0.tgz", + "integrity": "sha512-gp6xo/s2lX54AlTjOiqwDnxA7UW79BNvI9dB9pr3LZTzRKCd1ZA+ZbgKw/ReIiWuvvVw/8QFJpnqeeFyLocMcQ==", + "license": "Apache-2.0", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-types/table": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/@react-types/table/-/table-3.14.0.tgz", + "integrity": "sha512-emTYu9biFFlVEN208EmYpnO3bzi0f7q+07rnerUWRRRqXQpgNW/G5Tc6ifgCUXLp+KjwzLIeoDl4hs3ZnG5NSA==", + "license": "Apache-2.0", + "dependencies": { + "@react-spectrum/table": "^3.18.0", + "@react-stately/table": "^3.16.0", + "@react-types/shared": "^3.34.0" + }, + "peerDependencies": { + "@react-spectrum/provider": "^3.0.0", + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.0.0.tgz", + "integrity": "sha512-TWMZnRLMe63C2Lhyicviu7ZHaU4kxa6PS3rofvc9GmcvptzNN11BcfQ4Sl7MwTOsisQoa2keB/EBdNCAnUo8vA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.0.0.tgz", + "integrity": "sha512-6XcD+8k0gPVItNagEw78/qqcBDwKcwDYS8V2hRmVsfUSIrd8cWe/CBvRDI5toqFyPfj+FJr6t8U6Xj2P2prEew==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.0.0.tgz", + "integrity": "sha512-iN/tWVXRQDWvmZlKdceP1Dwug9GDpEymhb9p4xnEe6zvCg5lFmzVljl+1qR1NVx3yfGpr2Na+CuLmv5IU8uzfQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.0.0.tgz", + "integrity": "sha512-jjQMDvvwSOuhOwMszD/klSOjyWMM3zI64hWTj9KT5x4MxRbZAf+7vLQ6qouRhtsLVFHr3f0ILaJAfgENPiQdAQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.0.0.tgz", + "integrity": "sha512-d//Dtg2x6/m3mbV64yUGNnDGNZaDGRpDLLNGerHQUVObuNaIQaaDp25yUiqGXtHEXX+NP2d0wAlmKgpYgIAJ2A==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.0.0.tgz", + "integrity": "sha512-n7Ofp0mx+aB2cC+Sdy5YtMnXtY9lchnHbY+3Yt0uq9JsWQExf4f5Whu0tK0R8Jdc9S6RchTHjIFY7uc92puOVQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.0.0.tgz", + "integrity": "sha512-EIVjy2cgd7uuMMo94FVkBp7F6DhcZAUwNURkSG3RwUmvAXR6s0ISxM81U+IydcZByPG0pZIHsf1b6kTxoFDgJA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.0.0.tgz", + "integrity": "sha512-JEwwOPcwTLAcpDQlqSmjEmfs63xJnSiUNIGvLcDLUHCWK4XowpS/7c7tUsUH6uT/ct6bMUTdXKfI8967FYj6mg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.0.0.tgz", + "integrity": "sha512-0wjCFhLrihtAubnT9iA0N++0pSV0z5Hg7tNGdNJ4RFaINceHadoF+kiFGyY1qSSNVIAZtLotG8Ju1bgDPkjnFA==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.0.0.tgz", + "integrity": "sha512-Dfn7iak9BcMMePxcoJfpSbWqnEyrp/dRF63/8qW/eHBdOZov6x5aShLLEYGYdIeSJ6vMLK/XCVB+lGIxm41bQA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.0.0.tgz", + "integrity": "sha512-5/utzzDmD/pD/bmuaUcbTf/sZYy0aztwIVlfpoW1fTjCZ0BaPOMVWGZL1zvgxyi7ZIVYWlxKONHmSbHuiOh8Jw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.0.0.tgz", + "integrity": "sha512-ouJs8VcUomfLfpbUECqFMRqdV4x6aeAK3MA4m6vTrJJjKyWTV5KnxZx7Jd9G+GlDaQQxubcba00x16OyJ1meig==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-wasm32-wasi": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.0.0.tgz", + "integrity": "sha512-E+oHKGiDA+lsKMmFtffDDw91EryDT7uJocrIuCHqhm6bCTM6xFK+3gaCkYOHfPwQr0cCNarSM2xaELoQDz9jJg==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "1.10.0", + "@emnapi/runtime": "1.10.0", + "@napi-rs/wasm-runtime": "^1.1.4" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.0.0.tgz", + "integrity": "sha512-yYK02n8Rngo+gbm1y6G0+7jk1sJ/2Wt7K0me0Y7k/ErBpyf+LJ2gFpqWVTcRV1rUepBlQRmpgWkTQCiiwrK0Ow==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.0.0.tgz", + "integrity": "sha512-14bpChMahXRRXiTwahSl+zzHPW6qQTXtkMuJBFlbo+pqSAews2d4BdCSHfrJ/MBsCZtpmTafsY+1QhBzitcmdg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.0-rc.7", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-rc.7.tgz", + "integrity": "sha512-qujRfC8sFVInYSPPMLQByRh7zhwkGFS4+tyMQ83srV1qrxL4g8E2tyxVVyxd0+8QeBM1mIk9KbWxkegRr76XzA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.60.4.tgz", + "integrity": "sha512-Boiz5+MsaROEWDf+GGEwF8VMHGhlUoQMtIPjOgA5fv4osupqTVnJteQNKJwUcnUog2G55jYXH7KZFFiJe0TEzQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@spectrum-icons/ui": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/@spectrum-icons/ui/-/ui-3.7.0.tgz", + "integrity": "sha512-86iQSDfJb3Ama1WSJ/mEiFy4DJT7e/v4pSmEuX4aKKMzbNYft+O40N18S2POUnmblrb7MQneLC/pgIp1SDBwEQ==", + "license": "Apache-2.0", + "dependencies": { + "@adobe/react-spectrum-ui": "1.2.1", + "@babel/runtime": "^7.24.4", + "@swc/helpers": "^0.5.0" + }, + "peerDependencies": { + "@adobe/react-spectrum": "^3.47.0", + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@spectrum-icons/workflow": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@spectrum-icons/workflow/-/workflow-4.3.0.tgz", + "integrity": "sha512-ILuhgWh9jMXaEVMRuOYgTAjMc22cKyvCtUDyZmc8OEMfOYuejj+Gcp5t6DhaCfE0M9rORtVxCrRgsO2WyEgfUw==", + "license": "Apache-2.0", + "dependencies": { + "@adobe/react-spectrum-workflow": "2.3.5", + "@swc/helpers": "^0.5.0" + }, + "peerDependencies": { + "@adobe/react-spectrum": "^3.47.0", + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@standard-schema/spec": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", + "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@swc/helpers": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.21.tgz", + "integrity": "sha512-jI/VAmtdjB/RnI8GTnokyX7Ug8c+g+ffD6QRLa6XQewtnGyukKkKSk3wLTM3b5cjt1jNh9x0jfVlagdN2gDKQg==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.8.0" + } + }, + "node_modules/@testing-library/dom": { + "version": "10.4.1", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.1.tgz", + "integrity": "sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.10.4", + "@babel/runtime": "^7.12.5", + "@types/aria-query": "^5.0.1", + "aria-query": "5.3.0", + "dom-accessibility-api": "^0.5.9", + "lz-string": "^1.5.0", + "picocolors": "1.1.1", + "pretty-format": "^27.0.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@testing-library/dom/node_modules/aria-query": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", + "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "dequal": "^2.0.3" + } + }, + "node_modules/@testing-library/dom/node_modules/dom-accessibility-api": { + "version": "0.5.16", + "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz", + "integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@testing-library/jest-dom": { + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.9.1.tgz", + "integrity": "sha512-zIcONa+hVtVSSep9UT3jZ5rizo2BsxgyDYU7WFD5eICBE7no3881HGeb/QkGfsJs6JTkY1aQhT7rIPC7e+0nnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@adobe/css-tools": "^4.4.0", + "aria-query": "^5.0.0", + "css.escape": "^1.5.1", + "dom-accessibility-api": "^0.6.3", + "picocolors": "^1.1.1", + "redent": "^3.0.0" + }, + "engines": { + "node": ">=14", + "npm": ">=6", + "yarn": ">=1" + } + }, + "node_modules/@testing-library/react": { + "version": "16.3.2", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-16.3.2.tgz", + "integrity": "sha512-XU5/SytQM+ykqMnAnvB2umaJNIOsLF3PVv//1Ew4CTcpz0/BRyy/af40qqrt7SjKpDdT1saBMc42CUok5gaw+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.12.5" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@testing-library/dom": "^10.0.0", + "@types/react": "^18.0.0 || ^19.0.0", + "@types/react-dom": "^18.0.0 || ^19.0.0", + "react": "^18.0.0 || ^19.0.0", + "react-dom": "^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@tybys/wasm-util": { + "version": "0.10.2", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.2.tgz", + "integrity": "sha512-RoBvJ2X0wuKlWFIjrwffGw1IqZHKQqzIchKaadZZfnNpsAYp2mM0h36JtPCjNDAHGgYez/15uMBpfGwchhiMgg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@types/aria-query": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", + "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/chai": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", + "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" + } + }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/esrecurse": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", + "integrity": "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "24.12.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.12.4.tgz", + "integrity": "sha512-GUUEShf+PBCGW2KaXwcIt3Yk+e3pkKwWKb9GSyM9WQVE+ep2jzmHdGsHzu4wgcZy5fN9FBdVzjpBQsYlpfpgLA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "undici-types": "~7.16.0" + } + }, + "node_modules/@types/react": { + "version": "19.2.14", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.14.tgz", + "integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "19.2.3", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz", + "integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==", + "dev": true, + "license": "MIT", + "peer": true, + "peerDependencies": { + "@types/react": "^19.2.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.59.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.59.3.tgz", + "integrity": "sha512-PwFvSKsXGShKGW6n5bZOhGHEcCZXM8HofLK9fNsEwZXzFRjoY+XT1Vsf1zgyXdwTr0ZYz1/2tkZ0DBTT9jZjhw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.12.2", + "@typescript-eslint/scope-manager": "8.59.3", + "@typescript-eslint/type-utils": "8.59.3", + "@typescript-eslint/utils": "8.59.3", + "@typescript-eslint/visitor-keys": "8.59.3", + "ignore": "^7.0.5", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.59.3", + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.59.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.59.3.tgz", + "integrity": "sha512-HPwA+hVkfcriajbNvTmZv4VRauibay+cWArYUYq7u7W7PmGShMxbPxLvrwDme55a6d5alG3nrYfhyJ/G28XlLg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@typescript-eslint/scope-manager": "8.59.3", + "@typescript-eslint/types": "8.59.3", + "@typescript-eslint/typescript-estree": "8.59.3", + "@typescript-eslint/visitor-keys": "8.59.3", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.59.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.59.3.tgz", + "integrity": "sha512-ECiUWa/KYRGDFUqTNehaRgzDshnJfkTABJxVemHk4ko22gcr0ukloKjWvyQ64g8YCV/UI47kN1dbmjf/GaQYng==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.59.3", + "@typescript-eslint/types": "^8.59.3", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.59.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.59.3.tgz", + "integrity": "sha512-t2LvZnoEfzKtnPjgeEu41xw5gxq9mQVfYy4OoZ4Vlt0sk3JwxmhCca/AR7DwOiHrjWgjAj6as4AhRLKSDfvZIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.59.3", + "@typescript-eslint/visitor-keys": "8.59.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.59.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.59.3.tgz", + "integrity": "sha512-PcIJHjmaREXLgIAIzLnSY9VucEzz8FKXsRgFa1DmdGCK/5tJpW03TKJF01Q6VZd1lLdz2sIKPWaDUZN9dp//dw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.59.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.59.3.tgz", + "integrity": "sha512-g71d8QD8UaiHGvrJwyIS1hCX5r63w6Jll+4VEYhEAHXTDIqX1JgxhTAbEHtKntL9kuc4jRo7/GWw5xfCepSccQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.59.3", + "@typescript-eslint/typescript-estree": "8.59.3", + "@typescript-eslint/utils": "8.59.3", + "debug": "^4.4.3", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.59.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.59.3.tgz", + "integrity": "sha512-ePFoH0g4ludssdRFqqDxQePCxU4WQyRa9+XVwjm7yLn0FKhMeoetC+qBEEI1Eyb1pGSDveTIT09Bvw2WhlGayg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.59.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.59.3.tgz", + "integrity": "sha512-CbRjVRAf7Lr9Kr8RopKcbY45p2VfmmHrm0ygOCYFi7oU8q19m0Fs/6iHS7kNOmwpp+ob07ZVcAqlxUod9lYdmg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/project-service": "8.59.3", + "@typescript-eslint/tsconfig-utils": "8.59.3", + "@typescript-eslint/types": "8.59.3", + "@typescript-eslint/visitor-keys": "8.59.3", + "debug": "^4.4.3", + "minimatch": "^10.2.2", + "semver": "^7.7.3", + "tinyglobby": "^0.2.15", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.0.tgz", + "integrity": "sha512-AcM7dV/5ul4EekoQ29Agm5vri8JNqRyj39o0qpX6vDF2GZrtutZl5RwgD1XnZjiTAfncsJhMI48QQH3sN87YNA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.59.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.59.3.tgz", + "integrity": "sha512-JAvT14goBzRzzzZyqq3P9BLArIxTtQURUtFgQ/V7FO+eU+Gg6ES+5ymOPP1wRxXcxAYeivCk4uS3jCKWI1K8Zg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.9.1", + "@typescript-eslint/scope-manager": "8.59.3", + "@typescript-eslint/types": "8.59.3", + "@typescript-eslint/typescript-estree": "8.59.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.59.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.59.3.tgz", + "integrity": "sha512-f1UQF7ggd42YiwI5wGrRaPsa+P0CINBlrkLPmGfpq/u/I/oVtecoEIfFR9ag/oa1sLOsRNZ6xehf6qMZhQGBDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.59.3", + "eslint-visitor-keys": "^5.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@vitejs/plugin-react": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-6.0.1.tgz", + "integrity": "sha512-l9X/E3cDb+xY3SWzlG1MOGt2usfEHGMNIaegaUGFsLkb3RCn/k8/TOXBcab+OndDI4TBtktT8/9BwwW8Vi9KUQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rolldown/pluginutils": "1.0.0-rc.7" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "peerDependencies": { + "@rolldown/plugin-babel": "^0.1.7 || ^0.2.0", + "babel-plugin-react-compiler": "^1.0.0", + "vite": "^8.0.0" + }, + "peerDependenciesMeta": { + "@rolldown/plugin-babel": { + "optional": true + }, + "babel-plugin-react-compiler": { + "optional": true + } + } + }, + "node_modules/@vitest/expect": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.6.tgz", + "integrity": "sha512-7EHDquPthALSV0jhhjgEW8FXaviMx7rSqu8W6oqCoAuOhKov814P99QDV1pxMA3QPv21YudvJngIhjrNI4opLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@standard-schema/spec": "^1.1.0", + "@types/chai": "^5.2.2", + "@vitest/spy": "4.1.6", + "@vitest/utils": "4.1.6", + "chai": "^6.2.2", + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/mocker": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.1.6.tgz", + "integrity": "sha512-MCFc63czMjEInOlcY2cpQCvCN+KgbAn+60xu9cMgP4sKaLC5JNAKw7JH8QdAnoAC88hW1IiSNZ+GgVXlN1UcMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "4.1.6", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.21" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@vitest/pretty-format": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.1.6.tgz", + "integrity": "sha512-h5SxD/IzNhZYnrSZRsUZQIC+vD0GY8cUvq0iwsmkFKixRCKLLWqCXa/FIQ4S1R+sI+PGoojkHsdNrbZiM9Qpgw==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.1.6.tgz", + "integrity": "sha512-nOPCmn2+yD0ZNmKdsXGv/UxMMWbMuKeD6GyYncNwdkYDxpQvrPSKYj2rWuDjC2Y4b6w6hjip5dBKFzEUuZe3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/utils": "4.1.6", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/snapshot": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.1.6.tgz", + "integrity": "sha512-YhsdE6xAVfTDmzjxL2ZDUvjj+ZsgyOKe+TdQzqkD72wIOmHka8NuGQ6NpTNZv9D2Z63fbwWKJPeVpEw4EQgYxw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "4.1.6", + "@vitest/utils": "4.1.6", + "magic-string": "^0.30.21", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.1.6.tgz", + "integrity": "sha512-JFKxMx6udhwKh/Ldo270e17QX710vgunMkuPAvXjHSvC6oqLWAHhVhjg/I71q0u0CBSErIODV1Kjv0FQNSWjdg==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.1.6.tgz", + "integrity": "sha512-FxIY+U81R3LGKCxaHHFRQ5+g6/iRgGLmeHWdp2Amj4ljQRrEIWHmZyDfDYBRZlpyqA7qKxtS9DD1dhk8RnRIVQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "4.1.6", + "convert-source-map": "^2.0.0", + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true, + "license": "ISC" + }, + "node_modules/acorn": { + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", + "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", + "dev": true, + "license": "MIT", + "peer": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", + "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/aria-hidden": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/aria-hidden/-/aria-hidden-1.2.6.tgz", + "integrity": "sha512-ik3ZgC9dY/lYVVM++OISsaYDeg1tb0VtP5uL3ouh1koGOaUMDPpbFIei4JkFimWUFPn90sbMNMXQAIVOlnYKJA==", + "license": "MIT", + "dependencies": { + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/aria-query": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.2.tgz", + "integrity": "sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha512-M1HQyIXcBGtVywBt8WVdim+lrNaK7VHp99Qt5pSNziXznKHViIBbXWtfRTpEFpF/c4FdfxNAsCCwPp5phBYJtw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==", + "dev": true, + "license": "MIT" + }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/baseline-browser-mapping": { + "version": "2.10.29", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.29.tgz", + "integrity": "sha512-Asa2krT+XTPZINCS+2QcyS8WTkObE77RwkydwF7h6DmnKqbvlalz93m/dnphUyCa6SWSP51VgtEUf2FN+gelFQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "baseline-browser-mapping": "dist/cli.cjs" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/bidi-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/bidi-js/-/bidi-js-1.0.3.tgz", + "integrity": "sha512-RKshQI1R3YQ+n9YJz2QQ147P66ELpa1FQEg20Dk8oW9t2KgLbpDLLp9aGZ7y8WHSshDknG0bknqGw5/tyCs5tw==", + "dev": true, + "license": "MIT", + "dependencies": { + "require-from-string": "^2.0.2" + } + }, + "node_modules/brace-expansion": { + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz", + "integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/browserslist": { + "version": "4.28.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.2.tgz", + "integrity": "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "baseline-browser-mapping": "^2.10.12", + "caniuse-lite": "^1.0.30001782", + "electron-to-chromium": "^1.5.328", + "node-releases": "^2.0.36", + "update-browserslist-db": "^1.2.3" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001792", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001792.tgz", + "integrity": "sha512-hVLMUZFgR4JJ6ACt1uEESvQN1/dBVqPAKY0hgrV70eN3391K6juAfTjKZLKvOMsx8PxA7gsY1/tLMMTcfFLLpw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/chai": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz", + "integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/client-only": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", + "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==", + "license": "MIT" + }, + "node_modules/clsx": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true, + "license": "MIT" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/css-tree": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.2.1.tgz", + "integrity": "sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "mdn-data": "2.27.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" + } + }, + "node_modules/css.escape": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz", + "integrity": "sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==", + "dev": true, + "license": "MIT" + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "license": "MIT" + }, + "node_modules/data-urls": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-7.0.0.tgz", + "integrity": "sha512-23XHcCF+coGYevirZceTVD7NdJOqVn+49IHyxgszm+JIiHLoB2TkmPtsYkNWT1pvRSGkc35L6NHs0yHkN2SumA==", + "dev": true, + "license": "MIT", + "dependencies": { + "whatwg-mimetype": "^5.0.0", + "whatwg-url": "^16.0.0" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/debuglog": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/debuglog/-/debuglog-1.0.1.tgz", + "integrity": "sha512-syBZ+rnAK3EgMsH2aYEOLUW7mZSY9Gb+0wUMCFsZvcmiz+HigA0LOcq/HoQqVuGG+EKykunc7QG2bzrponfaSw==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/decimal.js": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", + "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", + "license": "MIT" + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/dezalgo": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.4.tgz", + "integrity": "sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==", + "dev": true, + "license": "ISC", + "dependencies": { + "asap": "^2.0.0", + "wrappy": "1" + } + }, + "node_modules/dom-accessibility-api": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.6.3.tgz", + "integrity": "sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==", + "dev": true, + "license": "MIT" + }, + "node_modules/dom-helpers": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz", + "integrity": "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.8.7", + "csstype": "^3.0.2" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.5.354", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.354.tgz", + "integrity": "sha512-JaBHwWcfIdmSAfWM5l3uwjGd431j8YEMikZ+K/2nXVuBqJKyZ0f+2h4n4JY5AyNiZmnY9qQr2RU3v9DxDmHMNg==", + "dev": true, + "license": "ISC" + }, + "node_modules/entities": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-8.0.0.tgz", + "integrity": "sha512-zwfzJecQ/Uej6tusMqwAqU/6KL2XaB2VZ2Jg54Je6ahNBGNH6Ek6g3jjNCF0fG9EWQKGZNddNjU5F1ZQn/sBnA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20.19.0" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-module-lexer": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.1.0.tgz", + "integrity": "sha512-n27zTYMjYu1aj4MjCWzSP7G9r75utsaoc8m61weK+W8JMBGGQybd43GstCXZ3WNmSFtGT9wi59qQTW6mhTR5LQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.3.0.tgz", + "integrity": "sha512-XbEXaRva5cF0ZQB8w6MluHA0kZZfV2DuCMJ3ozyEOHLwDpZX2Lmm/7Pp0xdJmI0GL1W05VH5VwIFHEm1Vcw2gw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.2", + "@eslint/config-array": "^0.23.5", + "@eslint/config-helpers": "^0.5.5", + "@eslint/core": "^1.2.1", + "@eslint/plugin-kit": "^0.7.1", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.14.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^9.1.2", + "eslint-visitor-keys": "^5.0.1", + "espree": "^11.2.0", + "esquery": "^1.7.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "minimatch": "^10.2.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-config-prettier": { + "version": "10.1.8", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.8.tgz", + "integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==", + "dev": true, + "license": "MIT", + "peer": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "funding": { + "url": "https://opencollective.com/eslint-config-prettier" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, + "node_modules/eslint-plugin-prettier": { + "version": "5.5.5", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.5.5.tgz", + "integrity": "sha512-hscXkbqUZ2sPithAuLm5MXL+Wph+U7wHngPBv9OMWwlP8iaflyxpjTYZkmdgB4/vPIhemRlBEoLrH7UC1n7aUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "prettier-linter-helpers": "^1.0.1", + "synckit": "^0.11.12" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-plugin-prettier" + }, + "peerDependencies": { + "@types/eslint": ">=8.0.0", + "eslint": ">=8.0.0", + "eslint-config-prettier": ">= 7.0.0 <10.0.0 || >=10.1.0", + "prettier": ">=3.0.0" + }, + "peerDependenciesMeta": { + "@types/eslint": { + "optional": true + }, + "eslint-config-prettier": { + "optional": true + } + } + }, + "node_modules/eslint-plugin-react-hooks": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-7.1.1.tgz", + "integrity": "sha512-f2I7Gw6JbvCexzIInuSbZpfdQ44D7iqdWX01FKLvrPgqxoE7oMj8clOfto8U6vYiz4yd5oKu39rRSVOe1zRu0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.24.4", + "@babel/parser": "^7.24.4", + "hermes-parser": "^0.25.1", + "zod": "^3.25.0 || ^4.0.0", + "zod-validation-error": "^3.5.0 || ^4.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 || ^10.0.0" + } + }, + "node_modules/eslint-plugin-react-refresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.5.2.tgz", + "integrity": "sha512-hmgTH57GfzoTFjVN0yBwTggnsVUF2tcqi7RJZHqi9lIezSs4eFyAMktA68YD4r5kNw1mxyY4dmkyoFDb3FIqrA==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "eslint": "^9 || ^10" + } + }, + "node_modules/eslint-scope": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-9.1.2.tgz", + "integrity": "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@types/esrecurse": "^4.3.1", + "@types/estree": "^1.0.8", + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-11.2.0.tgz", + "integrity": "sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.16.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^5.0.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz", + "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/expect-type": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.3.0.tgz", + "integrity": "sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-diff": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/flatted": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz", + "integrity": "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==", + "dev": true, + "license": "ISC" + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true, + "license": "ISC" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/glob/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/glob/node_modules/brace-expansion": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.14.tgz", + "integrity": "sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/globals": { + "version": "17.6.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-17.6.0.tgz", + "integrity": "sha512-sepffkT8stwnIYbsMBpoCHJuJM5l98FUF2AnE07hfvE0m/qp3R586hw4jF4uadbhvg1ooIdzuu7CsfD2jzCaNA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/hasown": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.3.tgz", + "integrity": "sha512-ej4AhfhfL2Q2zpMmLo7U1Uv9+PyhIZpgQLGT1F9miIGmiCJIoCgSmczFdrc97mWT4kVY72KA+WnnhJ5pghSvSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hermes-estree": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/hermes-estree/-/hermes-estree-0.25.1.tgz", + "integrity": "sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw==", + "dev": true, + "license": "MIT" + }, + "node_modules/hermes-parser": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/hermes-parser/-/hermes-parser-0.25.1.tgz", + "integrity": "sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hermes-estree": "0.25.1" + } + }, + "node_modules/hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true, + "license": "ISC" + }, + "node_modules/html-encoding-sniffer": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-6.0.0.tgz", + "integrity": "sha512-CV9TW3Y3f8/wT0BRFc1/KAVQ3TUHiXmaAb6VW9vtiMFf7SLoMd1PdAc4W3KFOFETBJUb90KatHqlsZMWV+R9Gg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.6.0" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dev": true, + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/intl-messageformat": { + "version": "10.7.18", + "resolved": "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-10.7.18.tgz", + "integrity": "sha512-m3Ofv/X/tV8Y3tHXLohcuVuhWKo7BBq62cqY15etqmLxg2DZ34AGGgQDeR+SCta2+zICb1NX83af0GJmbQ1++g==", + "license": "BSD-3-Clause", + "dependencies": { + "@formatjs/ecma402-abstract": "2.3.6", + "@formatjs/fast-memoize": "2.2.7", + "@formatjs/icu-messageformat-parser": "2.11.4", + "tslib": "^2.8.0" + } + }, + "node_modules/is-core-module": { + "version": "2.16.2", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.2.tgz", + "integrity": "sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT" + }, + "node_modules/jsdom": { + "version": "29.1.1", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-29.1.1.tgz", + "integrity": "sha512-ECi4Fi2f7BdJtUKTflYRTiaMxIB0O6zfR1fX0GXpUrf6flp8QIYn1UT20YQqdSOfk2dfkCwS8LAFoJDEppNK5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@asamuzakjp/css-color": "^5.1.11", + "@asamuzakjp/dom-selector": "^7.1.1", + "@bramus/specificity": "^2.4.2", + "@csstools/css-syntax-patches-for-csstree": "^1.1.3", + "@exodus/bytes": "^1.15.0", + "css-tree": "^3.2.1", + "data-urls": "^7.0.0", + "decimal.js": "^10.6.0", + "html-encoding-sniffer": "^6.0.0", + "is-potential-custom-element-name": "^1.0.1", + "lru-cache": "^11.3.5", + "parse5": "^8.0.1", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^6.0.1", + "undici": "^7.25.0", + "w3c-xmlserializer": "^5.0.0", + "webidl-conversions": "^8.0.1", + "whatwg-mimetype": "^5.0.0", + "whatwg-url": "^16.0.1", + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24.0.0" + }, + "peerDependencies": { + "canvas": "^3.0.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jsdom/node_modules/lru-cache": { + "version": "11.3.6", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.3.6.tgz", + "integrity": "sha512-Gf/KoL3C/MlI7Bt0PGI9I+TeTC/I6r/csU58N4BSNc4lppLBeKsOdFYkK+dX0ABDUMJNfCHTyPpzwwO21Awd3A==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/license-checker": { + "version": "25.0.1", + "resolved": "https://registry.npmjs.org/license-checker/-/license-checker-25.0.1.tgz", + "integrity": "sha512-mET5AIwl7MR2IAKYYoVBBpV0OnkKQ1xGj2IMMeEFIs42QAkEVjRtFZGWmQ28WeU7MP779iAgOaOy93Mn44mn6g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "chalk": "^2.4.1", + "debug": "^3.1.0", + "mkdirp": "^0.5.1", + "nopt": "^4.0.1", + "read-installed": "~4.0.3", + "semver": "^5.5.0", + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0", + "spdx-satisfies": "^4.0.0", + "treeify": "^1.1.0" + }, + "bin": { + "license-checker": "bin/license-checker" + } + }, + "node_modules/license-checker/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/license-checker/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/lightningcss": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz", + "integrity": "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.32.0", + "lightningcss-darwin-arm64": "1.32.0", + "lightningcss-darwin-x64": "1.32.0", + "lightningcss-freebsd-x64": "1.32.0", + "lightningcss-linux-arm-gnueabihf": "1.32.0", + "lightningcss-linux-arm64-gnu": "1.32.0", + "lightningcss-linux-arm64-musl": "1.32.0", + "lightningcss-linux-x64-gnu": "1.32.0", + "lightningcss-linux-x64-musl": "1.32.0", + "lightningcss-win32-arm64-msvc": "1.32.0", + "lightningcss-win32-x64-msvc": "1.32.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.32.0.tgz", + "integrity": "sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.32.0.tgz", + "integrity": "sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.32.0.tgz", + "integrity": "sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.32.0.tgz", + "integrity": "sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.32.0.tgz", + "integrity": "sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.32.0.tgz", + "integrity": "sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.32.0.tgz", + "integrity": "sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.32.0.tgz", + "integrity": "sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.32.0.tgz", + "integrity": "sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.32.0.tgz", + "integrity": "sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.32.0.tgz", + "integrity": "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "license": "MIT", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/lz-string": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", + "integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==", + "dev": true, + "license": "MIT", + "bin": { + "lz-string": "bin/bin.js" + } + }, + "node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/mdn-data": { + "version": "2.27.1", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.27.1.tgz", + "integrity": "sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==", + "dev": true, + "license": "CC0-1.0" + }, + "node_modules/min-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", + "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/minimatch": { + "version": "10.2.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz", + "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.5" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.12", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz", + "integrity": "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-releases": { + "version": "2.0.44", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.44.tgz", + "integrity": "sha512-5WUyunoPMsvvEhS8AxHtRzP+oA8UCkJ7YRxatWKjngndhDGLiqEVAQKWjFAiAiuL8zMRGzGSJxFnLetoa43qGQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/nopt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", + "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", + "dev": true, + "license": "ISC", + "dependencies": { + "abbrev": "1", + "osenv": "^0.1.4" + }, + "bin": { + "nopt": "bin/nopt.js" + } + }, + "node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "node_modules/normalize-package-data/node_modules/resolve": { + "version": "1.22.12", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.12.tgz", + "integrity": "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "is-core-module": "^2.16.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/normalize-package-data/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/npm-normalize-package-bin": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz", + "integrity": "sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==", + "dev": true, + "license": "ISC" + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/obug": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.1.tgz", + "integrity": "sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ==", + "dev": true, + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT" + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha512-B5JU3cabzk8c67mRRd3ECmROafjYMXbuzlwtqdM8IbS8ktlTix8aFGb2bAGKrSRIlnfKwovGUUr72JUPyOb6kQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "deprecated": "This package is no longer supported.", + "dev": true, + "license": "ISC", + "dependencies": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parse5": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-8.0.1.tgz", + "integrity": "sha512-z1e/HMG90obSGeidlli3hj7cbocou0/wa5HacvI3ASx34PecNjNQeaHNo5WIZpWofN9kgkqV1q5YvXe3F0FoPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "entities": "^8.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, + "license": "MIT" + }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", + "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.14", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.14.tgz", + "integrity": "sha512-SoSL4+OSEtR99LHFZQiJLkT59C5B1amGO1NzTwj7TT1qCUgUO6hxOvzkOYxD+vMrXBM3XJIKzokoERdqQq/Zmg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.11", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.3.tgz", + "integrity": "sha512-7igPTM53cGHMW8xWuVTydi2KO233VFiTNyF5hLJqpilHfmn8C8gPf+PS7dUT64YcXFbiMGZxS9pCSxL/Dxm/Jw==", + "dev": true, + "license": "MIT", + "peer": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-linter-helpers": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.1.tgz", + "integrity": "sha512-SxToR7P8Y2lWmv/kTzVLC1t/GDI2WGjMwNhLLE9qtH8Q13C+aEmuRlzDst4Up4s0Wc8sF2M+J57iB3cMLqftfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-diff": "^1.1.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/pretty-format": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", + "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^17.0.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/pretty-format/node_modules/react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", + "dev": true, + "license": "MIT" + }, + "node_modules/prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/react": { + "version": "19.2.6", + "resolved": "https://registry.npmjs.org/react/-/react-19.2.6.tgz", + "integrity": "sha512-sfWGGfavi0xr8Pg0sVsyHMAOziVYKgPLNrS7ig+ivMNb3wbCBw3KxtflsGBAwD3gYQlE/AEZsTLgToRrSCjb0Q==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-aria": { + "version": "3.48.0", + "resolved": "https://registry.npmjs.org/react-aria/-/react-aria-3.48.0.tgz", + "integrity": "sha512-jQjd4rBEIMqecBaAKYJbVGK6EqIHLa5znVQ7jwFyK5vCyljoj6KhgtiahmcIPsG5vG5vEDLw+ba+bEWn6A2P4w==", + "license": "Apache-2.0", + "dependencies": { + "@internationalized/date": "^3.12.1", + "@internationalized/number": "^3.6.6", + "@internationalized/string": "^3.2.8", + "@react-types/shared": "^3.34.0", + "@swc/helpers": "^0.5.0", + "aria-hidden": "^1.2.3", + "clsx": "^2.0.0", + "react-stately": "3.46.0", + "use-sync-external-store": "^1.6.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/react-aria-components": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/react-aria-components/-/react-aria-components-1.16.0.tgz", + "integrity": "sha512-MjHbTLpMFzzD2Tv5KbeXoZwPczuUWZcRavVvQQlNHRtXHH38D+sToMEYpNeir7Wh3K/XWtzeX3EujfJW6QNkrw==", + "license": "Apache-2.0", + "dependencies": { + "@internationalized/date": "^3.12.0", + "@internationalized/string": "^3.2.7", + "@react-aria/autocomplete": "3.0.0-rc.6", + "@react-aria/collections": "^3.0.3", + "@react-aria/dnd": "^3.11.6", + "@react-aria/focus": "^3.21.5", + "@react-aria/interactions": "^3.27.1", + "@react-aria/live-announcer": "^3.4.4", + "@react-aria/overlays": "^3.31.2", + "@react-aria/ssr": "^3.9.10", + "@react-aria/textfield": "^3.18.5", + "@react-aria/toolbar": "3.0.0-beta.24", + "@react-aria/utils": "^3.33.1", + "@react-aria/virtualizer": "^4.1.13", + "@react-stately/autocomplete": "3.0.0-beta.4", + "@react-stately/layout": "^4.6.0", + "@react-stately/selection": "^3.20.9", + "@react-stately/table": "^3.15.4", + "@react-stately/utils": "^3.11.0", + "@react-stately/virtualizer": "^4.4.6", + "@react-types/form": "^3.7.18", + "@react-types/grid": "^3.3.8", + "@react-types/shared": "^3.33.1", + "@react-types/table": "^3.13.6", + "@swc/helpers": "^0.5.0", + "client-only": "^0.0.1", + "react-aria": "^3.47.0", + "react-stately": "^3.45.0", + "use-sync-external-store": "^1.6.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/react-dom": { + "version": "19.2.6", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.6.tgz", + "integrity": "sha512-0prMI+hvBbPjsWnxDLxlCGyM8PN6UuWjEUCYmZhO67xIV9Xasa/r/vDnq+Xyq4Lo27g8QSbO5YzARu0D1Sps3g==", + "license": "MIT", + "peer": true, + "dependencies": { + "scheduler": "^0.27.0" + }, + "peerDependencies": { + "react": "^19.2.6" + } + }, + "node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "license": "MIT" + }, + "node_modules/react-stately": { + "version": "3.46.0", + "resolved": "https://registry.npmjs.org/react-stately/-/react-stately-3.46.0.tgz", + "integrity": "sha512-OdxhWvHgs2L4OJGIs7hnuTr5WjjMM6enhNEAMRqiekhF8+ITvA2LRwNftOZwcogaoCslGYq5S2VQTQwnm0GbCA==", + "license": "Apache-2.0", + "dependencies": { + "@internationalized/date": "^3.12.1", + "@internationalized/number": "^3.6.6", + "@internationalized/string": "^3.2.8", + "@react-types/shared": "^3.34.0", + "@swc/helpers": "^0.5.0", + "use-sync-external-store": "^1.6.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/react-transition-group": { + "version": "4.4.5", + "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz", + "integrity": "sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g==", + "license": "BSD-3-Clause", + "dependencies": { + "@babel/runtime": "^7.5.5", + "dom-helpers": "^5.0.1", + "loose-envify": "^1.4.0", + "prop-types": "^15.6.2" + }, + "peerDependencies": { + "react": ">=16.6.0", + "react-dom": ">=16.6.0" + } + }, + "node_modules/read-installed": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/read-installed/-/read-installed-4.0.3.tgz", + "integrity": "sha512-O03wg/IYuV/VtnK2h/KXEt9VIbMUFbk3ERG0Iu4FhLZw0EP0T9znqrYDGn6ncbEsXUFaUjiVAWXHzxwt3lhRPQ==", + "deprecated": "This package is no longer supported.", + "dev": true, + "license": "ISC", + "dependencies": { + "debuglog": "^1.0.1", + "read-package-json": "^2.0.0", + "readdir-scoped-modules": "^1.0.0", + "semver": "2 || 3 || 4 || 5", + "slide": "~1.1.3", + "util-extend": "^1.0.1" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.2" + } + }, + "node_modules/read-installed/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/read-package-json": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-2.1.2.tgz", + "integrity": "sha512-D1KmuLQr6ZSJS0tW8hf3WGpRlwszJOXZ3E8Yd/DNRaM5d+1wVRZdHlpGBLAuovjr28LbWvjpWkBHMxpRGGjzNA==", + "deprecated": "This package is no longer supported. Please use @npmcli/package-json instead.", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.1", + "json-parse-even-better-errors": "^2.3.0", + "normalize-package-data": "^2.0.0", + "npm-normalize-package-bin": "^1.0.0" + } + }, + "node_modules/readdir-scoped-modules": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/readdir-scoped-modules/-/readdir-scoped-modules-1.1.0.tgz", + "integrity": "sha512-asaikDeqAQg7JifRsZn1NJZXo9E+VwlyCfbkZhwyISinqk5zNS6266HS5kah6P0SaQKGF6SkNnZVHUzHFYxYDw==", + "deprecated": "This functionality has been moved to @npmcli/fs", + "dev": true, + "license": "ISC", + "dependencies": { + "debuglog": "^1.0.1", + "dezalgo": "^1.0.0", + "graceful-fs": "^4.1.2", + "once": "^1.3.0" + } + }, + "node_modules/redent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", + "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", + "dev": true, + "license": "MIT", + "dependencies": { + "indent-string": "^4.0.0", + "strip-indent": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/rolldown": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.0.0.tgz", + "integrity": "sha512-yD986aXDESFGS95spT1LAv0jssywP4npMEjmMHyN2/5+eE8qQJUype2AaKkRiLgBgyD0LFlubwAht7VmY8rGoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@oxc-project/types": "=0.129.0", + "@rolldown/pluginutils": "1.0.0" + }, + "bin": { + "rolldown": "bin/cli.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "optionalDependencies": { + "@rolldown/binding-android-arm64": "1.0.0", + "@rolldown/binding-darwin-arm64": "1.0.0", + "@rolldown/binding-darwin-x64": "1.0.0", + "@rolldown/binding-freebsd-x64": "1.0.0", + "@rolldown/binding-linux-arm-gnueabihf": "1.0.0", + "@rolldown/binding-linux-arm64-gnu": "1.0.0", + "@rolldown/binding-linux-arm64-musl": "1.0.0", + "@rolldown/binding-linux-ppc64-gnu": "1.0.0", + "@rolldown/binding-linux-s390x-gnu": "1.0.0", + "@rolldown/binding-linux-x64-gnu": "1.0.0", + "@rolldown/binding-linux-x64-musl": "1.0.0", + "@rolldown/binding-openharmony-arm64": "1.0.0", + "@rolldown/binding-wasm32-wasi": "1.0.0", + "@rolldown/binding-win32-arm64-msvc": "1.0.0", + "@rolldown/binding-win32-x64-msvc": "1.0.0" + } + }, + "node_modules/rolldown/node_modules/@rolldown/pluginutils": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0.tgz", + "integrity": "sha512-aKs/3GSWyV0mrhNmt/96/Z3yczC3yvrzYATCiCXQebBsGyYzjNdUphRVLeJQ67ySKVXRfMxt2lm12pmXvbPFQQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "dev": true, + "license": "ISC", + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=v12.22.7" + } + }, + "node_modules/scheduler": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", + "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true, + "license": "ISC" + }, + "node_modules/slide": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz", + "integrity": "sha512-NwrtjCg+lZoqhFU8fOwl4ay2ei8PaqCBOUV3/ektPY9trO1yQ1oXEfmHAhKArUVUr/hOHvy5f6AdP17dCM0zMw==", + "dev": true, + "license": "ISC", + "engines": { + "node": "*" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/spdx-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/spdx-compare/-/spdx-compare-1.0.0.tgz", + "integrity": "sha512-C1mDZOX0hnu0ep9dfmuoi03+eOdDoz2yvK79RxbcrVEG1NO1Ph35yW102DHWKN4pk80nwCgeMmSY5L25VE4D9A==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-find-index": "^1.0.2", + "spdx-expression-parse": "^3.0.0", + "spdx-ranges": "^2.0.0" + } + }, + "node_modules/spdx-correct": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", + "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", + "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", + "dev": true, + "license": "CC-BY-3.0" + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.23", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.23.tgz", + "integrity": "sha512-CWLcCCH7VLu13TgOH+r8p1O/Znwhqv/dbb6lqWy67G+pT1kHmeD/+V36AVb/vq8QMIQwVShJ6Ssl5FPh0fuSdw==", + "dev": true, + "license": "CC0-1.0" + }, + "node_modules/spdx-ranges": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/spdx-ranges/-/spdx-ranges-2.1.1.tgz", + "integrity": "sha512-mcdpQFV7UDAgLpXEE/jOMqvK4LBoO0uTQg0uvXUewmEFhpiZx5yJSZITHB8w1ZahKdhfZqP5GPEOKLyEq5p8XA==", + "dev": true, + "license": "(MIT AND CC-BY-3.0)" + }, + "node_modules/spdx-satisfies": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/spdx-satisfies/-/spdx-satisfies-4.0.1.tgz", + "integrity": "sha512-WVzZ/cXAzoNmjCWiEluEA3BjHp5tiUmmhn9MK+X0tBbR9sOqtC6UQwmgCNrAIZvNlMuBUYAaHYfb2oqlF9SwKA==", + "dev": true, + "license": "MIT", + "dependencies": { + "spdx-compare": "^1.0.0", + "spdx-expression-parse": "^3.0.0", + "spdx-ranges": "^2.0.0" + } + }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true, + "license": "MIT" + }, + "node_modules/std-env": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.1.0.tgz", + "integrity": "sha512-Rq7ybcX2RuC55r9oaPVEW7/xu3tj8u4GeBYHBWCychFtzMIr86A7e3PPEBPT37sHStKX3+TiX/Fr/ACmJLVlLQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/strip-indent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", + "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "min-indent": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", + "dev": true, + "license": "MIT" + }, + "node_modules/synckit": { + "version": "0.11.12", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.11.12.tgz", + "integrity": "sha512-Bh7QjT8/SuKUIfObSXNHNSK6WHo6J1tHCqJsuaFDP7gP0fkzSfTxI8y85JrppZ0h8l0maIgc2tfuZQ6/t3GtnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@pkgr/core": "^0.2.9" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/synckit" + } + }, + "node_modules/tinybench": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.1.2.tgz", + "integrity": "sha512-dAqSqE/RabpBKI8+h26GfLq6Vb3JVXs30XYQjdMjaj/c2tS8IYYMbIzP599KtRj7c57/wYApb3QjgRgXmrCukA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.16", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.16.tgz", + "integrity": "sha512-pn99VhoACYR8nFHhxqix+uvsbXineAasWm5ojXoN8xEwK5Kd3/TrhNn1wByuD52UxWRLy8pu+kRMniEi6Eq9Zg==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyrainbow": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.1.0.tgz", + "integrity": "sha512-Bf+ILmBgretUrdJxzXM0SgXLZ3XfiaUuOj/IKQHuTXip+05Xn+uyEYdVg0kYDipTBcLrCVyUzAPz7QmArb0mmw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tldts": { + "version": "7.0.30", + "resolved": "https://registry.npmjs.org/tldts/-/tldts-7.0.30.tgz", + "integrity": "sha512-ELrFxuqsDdHUwoh0XxDbxuLD3Wnz49Z57IFvTtvWy1hJdcMZjXLIuonjilCiWHlT2GbE4Wlv1wKVTzDFnXH1aw==", + "dev": true, + "license": "MIT", + "dependencies": { + "tldts-core": "^7.0.30" + }, + "bin": { + "tldts": "bin/cli.js" + } + }, + "node_modules/tldts-core": { + "version": "7.0.30", + "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.0.30.tgz", + "integrity": "sha512-uiHN8PIB1VmWyS98eZYja4xzlYqeFZVjb4OuYlJQnZAuJhMw4PbKQOKgHKhBdJR3FE/t5mUQ1Kd80++B+qhD1Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/tough-cookie": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-6.0.1.tgz", + "integrity": "sha512-LktZQb3IeoUWB9lqR5EWTHgW/VTITCXg4D21M+lvybRVdylLrRMnqaIONLVb5mav8vM19m44HIcGq4qASeu2Qw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "tldts": "^7.0.5" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/tr46": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-6.0.0.tgz", + "integrity": "sha512-bLVMLPtstlZ4iMQHpFHTR7GAGj2jxi8Dg0s2h2MafAE4uSWF98FC/3MomU51iQAMf8/qDUbKWf5GxuvvVcXEhw==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/treeify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/treeify/-/treeify-1.1.0.tgz", + "integrity": "sha512-1m4RA7xVAJrSGrrXGs0L3YTwyvBs2S8PbRHaLZAkFw7JR8oIFwYtysxlBZhYIa7xSyiYJKZ3iGrrk55cGA3i9A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/ts-api-utils": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz", + "integrity": "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/typescript": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/typescript-eslint": { + "version": "8.59.3", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.59.3.tgz", + "integrity": "sha512-KgusgyDgG4LI8Ih/sWaCtZ06tckLAS5CvT5A4D1Q7bYVoAAyzwiZvE4BmwDHkhRVkvhRBepKeASoFzQetha7Fg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.59.3", + "@typescript-eslint/parser": "8.59.3", + "@typescript-eslint/typescript-estree": "8.59.3", + "@typescript-eslint/utils": "8.59.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/undici": { + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.25.0.tgz", + "integrity": "sha512-xXnp4kTyor2Zq+J1FfPI6Eq3ew5h6Vl0F/8d9XU5zZQf1tX9s2Su1/3PiMmUANFULpmksxkClamIZcaUqryHsQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.18.1" + } + }, + "node_modules/undici-types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", + "dev": true, + "license": "MIT" + }, + "node_modules/update-browserslist-db": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", + "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/use-sync-external-store": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.6.0.tgz", + "integrity": "sha512-Pp6GSwGP/NrPIrxVFAIkOQeyw8lFenOHijQWkUTrDvrF4ALqylP2C/KCkeS9dpUM3KvYRQhna5vt7IL95+ZQ9w==", + "license": "MIT", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/util-extend": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/util-extend/-/util-extend-1.0.3.tgz", + "integrity": "sha512-mLs5zAK+ctllYBj+iAQvlDCwoxU/WDOUaJkcFudeiAX6OajC6BKXJUa9a+tbtkC11dz2Ufb7h0lyvIOVn4LADA==", + "dev": true, + "license": "MIT" + }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "node_modules/vite": { + "version": "8.0.12", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.0.12.tgz", + "integrity": "sha512-w2dDofOWv2QB09ZITZBsvKTVAlYvPR4IAmrY/v0ir9KvLs0xybR7i48wxhM1/oyBWO34wPns+bPGw5ZrZqDpZg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "lightningcss": "^1.32.0", + "picomatch": "^4.0.4", + "postcss": "^8.5.14", + "rolldown": "1.0.0", + "tinyglobby": "^0.2.16" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "@vitejs/devtools": "^0.1.18", + "esbuild": "^0.27.0 || ^0.28.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "@vitejs/devtools": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vitest": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.1.6.tgz", + "integrity": "sha512-6lvjbS3p9b4CrdCmguzbh2/4uoXhGE2q71R4OX5sqF9R1bo9Xd6fGrMAfvp5wnCzlBnFVdCOp6onuTQVbo8iUQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/expect": "4.1.6", + "@vitest/mocker": "4.1.6", + "@vitest/pretty-format": "4.1.6", + "@vitest/runner": "4.1.6", + "@vitest/snapshot": "4.1.6", + "@vitest/spy": "4.1.6", + "@vitest/utils": "4.1.6", + "es-module-lexer": "^2.0.0", + "expect-type": "^1.3.0", + "magic-string": "^0.30.21", + "obug": "^2.1.1", + "pathe": "^2.0.3", + "picomatch": "^4.0.3", + "std-env": "^4.0.0-rc.1", + "tinybench": "^2.9.0", + "tinyexec": "^1.0.2", + "tinyglobby": "^0.2.15", + "tinyrainbow": "^3.1.0", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0", + "why-is-node-running": "^2.3.0" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^20.0.0 || ^22.0.0 || >=24.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@opentelemetry/api": "^1.9.0", + "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0", + "@vitest/browser-playwright": "4.1.6", + "@vitest/browser-preview": "4.1.6", + "@vitest/browser-webdriverio": "4.1.6", + "@vitest/coverage-istanbul": "4.1.6", + "@vitest/coverage-v8": "4.1.6", + "@vitest/ui": "4.1.6", + "happy-dom": "*", + "jsdom": "*", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@opentelemetry/api": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser-playwright": { + "optional": true + }, + "@vitest/browser-preview": { + "optional": true + }, + "@vitest/browser-webdriverio": { + "optional": true + }, + "@vitest/coverage-istanbul": { + "optional": true + }, + "@vitest/coverage-v8": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + }, + "vite": { + "optional": false + } + } + }, + "node_modules/w3c-xmlserializer": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", + "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/webidl-conversions": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz", + "integrity": "sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20" + } + }, + "node_modules/whatwg-mimetype": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-5.0.0.tgz", + "integrity": "sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20" + } + }, + "node_modules/whatwg-url": { + "version": "16.0.1", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-16.0.1.tgz", + "integrity": "sha512-1to4zXBxmXHV3IiSSEInrreIlu02vUOvrhxJJH5vcxYTBDAx51cqZiKdyTxlecdKNSjj8EcxGBxNf6Vg+945gw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.11.0", + "tr46": "^6.0.0", + "webidl-conversions": "^8.0.1" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/why-is-node-running": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/xml-name-validator": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", + "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "dev": true, + "license": "MIT" + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true, + "license": "ISC" + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/zod": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz", + "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "node_modules/zod-validation-error": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-4.0.2.tgz", + "integrity": "sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.0.0" + }, + "peerDependencies": { + "zod": "^3.25.0 || ^4.0.0" + } + } + } +} diff --git a/appointment-booking/package.json b/appointment-booking/package.json new file mode 100644 index 000000000..0944c0690 --- /dev/null +++ b/appointment-booking/package.json @@ -0,0 +1,51 @@ +{ + "name": "appointment-booking", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "dev:local": "API_PROXY_TARGET=http://localhost:5100 vite", + "build": "tsc -b && vite build", + "test": "vitest run", + "test:watch": "vitest", + "lint": "eslint .", + "format": "prettier --write src", + "format:check": "prettier --check src", + "type-check": "tsc --noEmit", + "preview": "vite preview", + "license-check": "license-checker --production --onlyAllow \"MIT;Apache-2.0;ISC;BSD-2-Clause;BSD-3-Clause;0BSD\" --excludePackages \"appointment-booking@0.0.0;@bcgov/bc-sans@2.1.0\"", + "ci:check": "npm run lint && npm run type-check && npm run test && npm run build && npm run license-check" + }, + "dependencies": { + "@bcgov/design-system-react-components": "^0.7.0", + "@bcgov/design-tokens": "^4.0.0", + "react": "^19.2.6", + "react-dom": "^19.2.6" + }, + "devDependencies": { + "@eslint/js": "^10.0.1", + "@testing-library/dom": "^10.4.1", + "@testing-library/jest-dom": "^6.9.1", + "@testing-library/react": "^16.3.2", + "@types/node": "^24.12.3", + "@types/react": "^19.2.14", + "@types/react-dom": "^19.2.3", + "@typescript-eslint/eslint-plugin": "^8.59.3", + "@typescript-eslint/parser": "^8.59.3", + "@vitejs/plugin-react": "^6.0.1", + "eslint": "^10.3.0", + "eslint-config-prettier": "^10.1.8", + "eslint-plugin-prettier": "^5.5.5", + "eslint-plugin-react-hooks": "^7.1.1", + "eslint-plugin-react-refresh": "^0.5.2", + "globals": "^17.6.0", + "jsdom": "^29.1.1", + "license-checker": "^25.0.1", + "prettier": "^3.8.3", + "typescript": "~6.0.2", + "typescript-eslint": "^8.59.2", + "vite": "^8.0.12", + "vitest": "^4.1.6" + } +} diff --git a/appointment-booking/public/config/configuration.json b/appointment-booking/public/config/configuration.json new file mode 100644 index 000000000..37e01d8b3 --- /dev/null +++ b/appointment-booking/public/config/configuration.json @@ -0,0 +1,4 @@ + { + "VUE_APP_ROOT_API": "http://localhost:5000/api/v1", + "requestTimeoutMs": 10000 +} diff --git a/appointment-booking/public/config/runtime-config.json b/appointment-booking/public/config/runtime-config.json new file mode 100644 index 000000000..69a036936 --- /dev/null +++ b/appointment-booking/public/config/runtime-config.json @@ -0,0 +1,4 @@ +{ + "apiBaseUrl": "http://localhost:5000/api/v1", + "requestTimeoutMs": 10000 +} diff --git a/appointment-booking/public/favicon.png b/appointment-booking/public/favicon.png new file mode 100644 index 000000000..4d2ffb7bc Binary files /dev/null and b/appointment-booking/public/favicon.png differ diff --git a/appointment-booking/public/gov3_bc_logo.png b/appointment-booking/public/gov3_bc_logo.png new file mode 100644 index 000000000..08a9f2168 Binary files /dev/null and b/appointment-booking/public/gov3_bc_logo.png differ diff --git a/appointment-booking/public/gov3_bc_logo_mobile.png b/appointment-booking/public/gov3_bc_logo_mobile.png new file mode 100644 index 000000000..262b7e8ea Binary files /dev/null and b/appointment-booking/public/gov3_bc_logo_mobile.png differ diff --git a/appointment-booking/src/App.css b/appointment-booking/src/App.css new file mode 100644 index 000000000..8e9b847e8 --- /dev/null +++ b/appointment-booking/src/App.css @@ -0,0 +1,4 @@ +/* App-specific styles - keep minimal */ +#app { + width: 100%; +} diff --git a/appointment-booking/src/App.test.tsx b/appointment-booking/src/App.test.tsx new file mode 100644 index 000000000..542d61e67 --- /dev/null +++ b/appointment-booking/src/App.test.tsx @@ -0,0 +1,48 @@ +import { render, screen, waitFor } from '@testing-library/react' +import type { ReactNode } from 'react' +import { describe, expect, it, vi, beforeEach } from 'vitest' +import App from './App' + +vi.mock('@/components/common', () => ({ + Layout: ({ children }: { children: ReactNode }) =>
{children}
, + Page: ({ children, title }: { children: ReactNode; title: string }) => ( +
+

{title}

+ {children} +
+ ), +})) + +const loadRuntimeConfigMock = vi.fn() +const getOfficesMock = vi.fn() + +vi.mock('@/services/runtime-config.service', () => ({ + loadRuntimeConfig: () => loadRuntimeConfigMock(), +})) + +vi.mock('@/services/booking-api.service', () => ({ + getOffices: () => getOfficesMock(), +})) + +describe('App', () => { + beforeEach(() => { + vi.clearAllMocks() + }) + + it('shows successful API bootstrap state', async () => { + loadRuntimeConfigMock.mockResolvedValue({ + apiBaseUrl: '/api/v1', + requestTimeoutMs: 10000, + }) + getOfficesMock.mockResolvedValue({ offices: [], errors: {} }) + + render() + + expect(screen.getByRole('heading', { name: 'Appointment Booking' })).toBeInTheDocument() + + await waitFor(() => { + expect(screen.getByText('API base URL: /api/v1')).toBeInTheDocument() + expect(screen.getByText('Booking API connection established.')).toBeInTheDocument() + }) + }) +}) diff --git a/appointment-booking/src/App.tsx b/appointment-booking/src/App.tsx new file mode 100644 index 000000000..29393bc78 --- /dev/null +++ b/appointment-booking/src/App.tsx @@ -0,0 +1,49 @@ +import { useEffect, useState } from 'react' +import { Layout, Page } from '@/components/common' +import { ApiClient, ApiClientError } from '@/services/api-client.service' +import { getOffices } from '@/services/booking-api.service' +import { loadRuntimeConfig } from '@/services/runtime-config.service' +import type { RuntimeConfig } from '@/models/runtime-config' +import './App.css' + +function App() { + const [config, setConfig] = useState(null) + const [configError, setConfigError] = useState(null) + const [apiStatus, setApiStatus] = useState('Loading app settings...') + + useEffect(() => { + async function bootstrap() { + try { + const runtimeConfig = await loadRuntimeConfig() + setConfig(runtimeConfig) + setConfigError(null) + + const apiClient = new ApiClient(runtimeConfig) + await getOffices(apiClient) + setApiStatus('Booking API connection established.') + } catch (error) { + if (error instanceof ApiClientError) { + setApiStatus(`Booking API unavailable: ${error.message}`) + } else { + setConfigError('Failed to initialize application settings.') + setApiStatus('Booking API connection not attempted due to config error.') + } + } + } + + void bootstrap() + }, []) + + return ( + + +

Check below if the API is working

+

{config ? `API base URL: ${config.apiBaseUrl}` : 'API base URL: loading...'}

+

{apiStatus}

+ {configError ?

{configError}

: null} +
+
+ ) +} + +export default App diff --git a/appointment-booking/src/components/common/Layout.tsx b/appointment-booking/src/components/common/Layout.tsx new file mode 100644 index 000000000..f6187dbac --- /dev/null +++ b/appointment-booking/src/components/common/Layout.tsx @@ -0,0 +1,25 @@ +import { Footer, Header } from '@bcgov/design-system-react-components' +import type { ReactNode } from 'react' + +interface LayoutProps { + children: ReactNode +} + +export function Layout({ children }: LayoutProps) { + return ( + <> +
+ Skip to main content + , + ]} + /> +
+ {children} +
+