# sub-do-create-job.test - subroutine to do and check Create-Job
# Version 0.1
# Last revised by Xerox Corporation on 99-03-9 23:00 PST.

# Copyright (c) 1998, 1999 by Xerox Corporation. All rights reserved.
# User is granted the right to modify this file for use with
# the IPP Server Test Tool, as described in the file
# LICENSE-IppTest.txt.

# Input parameters (defined symbols):
#   expectedJobState  OPTIONAL  [defaults to pending-held]
#   thisJobName       OPTIONAL  [defaults to $whoami global]
#
# Output parameters (defined symbols):
#   first-job-id      GLOBAL.
#   first-job-uri     GLOBAL.


IfNDef expectedJobState
    Define Symbol expectedJobState pending-held
EndIf

IfNDef thisJobName
    Define Symbol thisJobName $whoami
EndIf


#
# First check whether this printer can accept a create
# Non-spooling printers will have to wait if not idle.
#

Include sub-check-non-spooling.test


@
@ Create-Job
@

Create-Job                                                       \
    target:                               $target,               \
    attributes: (                                                \
        Operation: (                                             \
            attributes-charset:           utf-8,                 \
            attributes-natural-language:  en-us,                 \
            printer-uri:                  $target,               \
            requesting-user-name:         'IPP Bake-off User 1', \
            job-name:                     $thisJobName           \
        )                                                        \
    )

Expect Response                                                  \
    status-code: successful-ok,                                  \
    attributes: (                                                \
        Operation: (                                             \
            attributes-charset:           utf-8,                 \
            attributes-natural-language:  *,                     \
            ...                                                  \
        ),                                                       \
        Job: (                                                   \
            first-job-uri = job-uri:      *,                     \
            first-job-id = job-id:        *,                     \
            job-state:                    $expectedJobState,     \
            ...                                                  \
        )                                                        \
    )



# Undefine input parameters before returning, lest they become stale:
Define Symbol expectedJobState
Define Symbol thisJobName