1# 2# Verify that the CUPS subscription operations work. 3# 4# Copyright © 2020-2024 by OpenPrinting. 5# Copyright © 2007-2019 by Apple Inc. 6# Copyright © 2001-2006 by Easy Software Products. All rights reserved. 7# 8# Licensed under Apache License v2.0. See the file "LICENSE" for more 9# information. 10# 11{ 12 # The name of the test... 13 NAME "Add Printer Subscription w/Lease" 14 15 # The operation to use 16 OPERATION Create-Printer-Subscription 17 RESOURCE / 18 19 # The attributes to send 20 GROUP operation 21 ATTR charset attributes-charset utf-8 22 ATTR language attributes-natural-language en 23 ATTR uri printer-uri $scheme://$hostname:$port/printers/Test1 24 ATTR name requesting-user-name $user 25 26 GROUP subscription 27 ATTR uri notify-recipient-uri testnotify:// 28 ATTR keyword notify-events printer-state-changed 29 ATTR integer notify-lease-duration 5 30 31 # What statuses are OK? 32 STATUS successful-ok 33 34 # What attributes do we expect? 35 EXPECT attributes-charset 36 EXPECT attributes-natural-language 37 EXPECT notify-subscription-id 38 DISPLAY notify-subscription-id 39} 40{ 41 # The name of the test... 42 NAME "Verify Subscription Expiration" 43 44 # Delay test for 7 seconds to allow lease to expire... 45 DELAY 7 46 47 # The operation to use 48 OPERATION Get-Subscription-Attributes 49 RESOURCE / 50 51 # The attributes to send 52 GROUP operation 53 ATTR charset attributes-charset utf-8 54 ATTR language attributes-natural-language en 55 ATTR uri printer-uri $scheme://$hostname:$port/printers/Test1 56 ATTR integer notify-subscription-id $notify-subscription-id 57 ATTR name requesting-user-name $user 58 59 # What statuses are OK? 60 STATUS client-error-not-found 61 62 # What attributes do we expect? 63 EXPECT attributes-charset 64 EXPECT attributes-natural-language 65} 66{ 67 # The name of the test... 68 NAME "Add 2 Printer Subscriptions w/Lease" 69 70 # The operation to use 71 OPERATION Create-Printer-Subscription 72 RESOURCE / 73 74 # The attributes to send 75 GROUP operation 76 ATTR charset attributes-charset utf-8 77 ATTR language attributes-natural-language en 78 ATTR uri printer-uri $scheme://$hostname:$port/printers/Test1 79 ATTR name requesting-user-name $user 80 81 GROUP subscription 82 ATTR uri notify-recipient-uri testnotify:// 83 ATTR keyword notify-events printer-state-changed 84 ATTR integer notify-lease-duration 5 85 86 GROUP subscription 87 ATTR uri notify-recipient-uri testnotify:// 88 ATTR keyword notify-events printer-config-changed 89 ATTR integer notify-lease-duration 5 90 91 # What statuses are OK? 92 STATUS successful-ok 93 94 # What attributes do we expect? 95 EXPECT attributes-charset 96 EXPECT attributes-natural-language 97 EXPECT notify-subscription-id 98 DISPLAY notify-subscription-id 99} 100{ 101 # The name of the test... 102 NAME "List Printer Subscriptions" 103 104 # The operation to use 105 OPERATION Get-Subscriptions 106 RESOURCE / 107 108 # The attributes to send 109 GROUP operation 110 ATTR charset attributes-charset utf-8 111 ATTR language attributes-natural-language en 112 ATTR uri printer-uri $scheme://$hostname:$port/printers/Test1 113 ATTR name requesting-user-name $user 114 115 # What statuses are OK? 116 STATUS successful-ok 117 118 # What attributes do we expect? 119 EXPECT attributes-charset 120 EXPECT attributes-natural-language 121 EXPECT notify-subscription-id 122 DISPLAY notify-subscription-id 123 EXPECT notify-printer-uri 124 DISPLAY notify-printer-uri 125 EXPECT notify-events 126 DISPLAY notify-events 127} 128{ 129 # The name of the test... 130 NAME "Check MaxSubscriptions limits" 131 132 # The operation to use 133 OPERATION Create-Printer-Subscription 134 RESOURCE / 135 136 # The attributes to send 137 GROUP operation 138 ATTR charset attributes-charset utf-8 139 ATTR language attributes-natural-language en 140 ATTR uri printer-uri $scheme://$hostname:$port/printers/Test1 141 ATTR name requesting-user-name $user 142 143 GROUP subscription 144 ATTR uri notify-recipient-uri testnotify:// 145 ATTR keyword notify-events printer-state-changed 146 ATTR integer notify-lease-duration 5 147 148 # What statuses are OK? 149 STATUS client-error-too-many-subscriptions 150 151 # What attributes do we expect? 152 EXPECT attributes-charset 153 EXPECT attributes-natural-language 154} 155