1# 2# Verify that the CUPS printer 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 Test1" 14 15 # The operation to use 16 OPERATION cups-add-printer 17 RESOURCE /admin/ 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 $method://$hostname:$port/printers/Test1 24 25 FILE testhp.ppd 26 27 # What statuses are OK? 28 STATUS successful-ok 29 30 # What attributes do we expect? 31 EXPECT attributes-charset 32 EXPECT attributes-natural-language 33} 34{ 35 # The name of the test... 36 NAME "Verify Printer Test1 Added" 37 38 # The operation to use 39 OPERATION get-printer-attributes 40 RESOURCE / 41 42 # The attributes to send 43 GROUP operation 44 ATTR charset attributes-charset utf-8 45 ATTR language attributes-natural-language en 46 ATTR uri printer-uri $method://$hostname:$port/printers/Test1 47 48 # What statuses are OK? 49 STATUS successful-ok 50 51 # What attributes do we expect? 52 EXPECT attributes-charset 53 EXPECT attributes-natural-language 54} 55{ 56 # The name of the test... 57 NAME "Delete Printer Test1" 58 59 # The operation to use 60 OPERATION cups-delete-printer 61 RESOURCE /admin/ 62 63 # The attributes to send 64 GROUP operation 65 ATTR charset attributes-charset utf-8 66 ATTR language attributes-natural-language en 67 ATTR uri printer-uri $method://$hostname:$port/printers/Test1 68 69 # What statuses are OK? 70 STATUS successful-ok 71 72 # What attributes do we expect? 73 EXPECT attributes-charset 74 EXPECT attributes-natural-language 75} 76{ 77 # The name of the test... 78 NAME "Verify Printer Test1 Deleted" 79 80 # The operation to use 81 OPERATION get-printer-attributes 82 RESOURCE / 83 84 # The attributes to send 85 GROUP operation 86 ATTR charset attributes-charset utf-8 87 ATTR language attributes-natural-language en 88 ATTR uri printer-uri $method://$hostname:$port/printers/Test1 89 90 # What statuses are OK? 91 STATUS client-error-not-found 92 93 # What attributes do we expect? 94 EXPECT attributes-charset 95 EXPECT attributes-natural-language 96} 97{ 98 # The name of the test... 99 NAME "Subscribe to Printer Events" 100 101 # The operation to use 102 OPERATION Create-Printer-Subscription 103 RESOURCE / 104 105 # The attributes to send 106 GROUP operation 107 ATTR charset attributes-charset utf-8 108 ATTR language attributes-natural-language en 109 ATTR uri printer-uri $method://$hostname:$port/ 110 ATTR name requesting-user-name $user 111 112 GROUP subscription 113 ATTR uri notify-recipient-uri testnotify:// 114 ATTR keyword notify-events printer-added,printer-modified,printer-deleted 115 116 # What statuses are OK? 117 STATUS successful-ok 118 119 # What attributes do we expect? 120 EXPECT attributes-charset 121 EXPECT attributes-natural-language 122 EXPECT notify-subscription-id 123} 124{ 125 # The name of the test... 126 NAME "Add Printer Test2" 127 128 # The operation to use 129 OPERATION cups-add-printer 130 RESOURCE /admin/ 131 132 # The attributes to send 133 GROUP operation 134 ATTR charset attributes-charset utf-8 135 ATTR language attributes-natural-language en 136 ATTR uri printer-uri $method://$hostname:$port/printers/Test2 137 138 FILE testhp.ppd 139 140 # What statuses are OK? 141 STATUS successful-ok 142 143 # What attributes do we expect? 144 EXPECT attributes-charset 145 EXPECT attributes-natural-language 146} 147{ 148 # The name of the test... 149 NAME "Verify Printer Test2 Added" 150 151 # The operation to use 152 OPERATION get-printer-attributes 153 RESOURCE / 154 155 # The attributes to send 156 GROUP operation 157 ATTR charset attributes-charset utf-8 158 ATTR language attributes-natural-language en 159 ATTR uri printer-uri $method://$hostname:$port/printers/Test2 160 161 # What statuses are OK? 162 STATUS successful-ok 163 164 # What attributes do we expect? 165 EXPECT attributes-charset 166 EXPECT attributes-natural-language 167} 168{ 169 # The name of the test... 170 NAME "Modify Printer Test2" 171 172 # The operation to use 173 OPERATION cups-add-printer 174 RESOURCE /admin/ 175 176 # The attributes to send 177 GROUP operation 178 ATTR charset attributes-charset utf-8 179 ATTR language attributes-natural-language en 180 ATTR uri printer-uri $method://$hostname:$port/printers/Test2 181 182 GROUP printer 183 ATTR uri device-uri file:/tmp/Test2 184 ATTR enum printer-state 3 185 ATTR boolean printer-is-accepting-jobs true 186 187 # What statuses are OK? 188 STATUS successful-ok 189 190 # What attributes do we expect? 191 EXPECT attributes-charset 192 EXPECT attributes-natural-language 193} 194{ 195 # The name of the test... 196 NAME "Re-Add Printer Test1" 197 198 # The operation to use 199 OPERATION cups-add-printer 200 RESOURCE /admin/ 201 202 # The attributes to send 203 GROUP operation 204 ATTR charset attributes-charset utf-8 205 ATTR language attributes-natural-language en 206 ATTR uri printer-uri $method://$hostname:$port/printers/Test1 207 208 GROUP printer 209 ATTR uri device-uri file:/tmp/Test1 210 ATTR enum printer-state 3 211 ATTR boolean printer-is-accepting-jobs true 212 ATTR text printer-info "Test Printer 1" 213 214 FILE testps.ppd 215 216 # What statuses are OK? 217 STATUS successful-ok 218 219 # What attributes do we expect? 220 EXPECT attributes-charset 221 EXPECT attributes-natural-language 222} 223{ 224 # The name of the test... 225 NAME "Verify Printer Test1 Re-Added" 226 227 # The operation to use 228 OPERATION get-printer-attributes 229 RESOURCE / 230 231 # The attributes to send 232 GROUP operation 233 ATTR charset attributes-charset utf-8 234 ATTR language attributes-natural-language en 235 ATTR uri printer-uri $method://$hostname:$port/printers/Test1 236 237 # What statuses are OK? 238 STATUS successful-ok 239 240 # What attributes do we expect? 241 EXPECT attributes-charset 242 EXPECT attributes-natural-language 243} 244{ 245 # The name of the test... 246 NAME "Get Default Printer with no default set" 247 248 # The operation to use 249 OPERATION cups-get-default 250 RESOURCE / 251 252 # The attributes to send 253 GROUP operation 254 ATTR charset attributes-charset utf-8 255 ATTR language attributes-natural-language en 256 257 # What statuses are OK? 258 STATUS client-error-not-found 259 260 # What attributes do we expect? 261 EXPECT attributes-charset 262 EXPECT attributes-natural-language 263} 264{ 265 # The name of the test... 266 NAME "Set Default Printer to Test1" 267 268 # The operation to use 269 OPERATION cups-set-default 270 RESOURCE /admin/ 271 272 # The attributes to send 273 GROUP operation 274 ATTR charset attributes-charset utf-8 275 ATTR language attributes-natural-language en 276 ATTR uri printer-uri $method://$hostname:$port/printers/Test1 277 278 # What statuses are OK? 279 STATUS successful-ok 280 281 # What attributes do we expect? 282 EXPECT attributes-charset 283 EXPECT attributes-natural-language 284} 285{ 286 # The name of the test... 287 NAME "Get Default Printer" 288 289 # The operation to use 290 OPERATION cups-get-default 291 RESOURCE / 292 293 # The attributes to send 294 GROUP operation 295 ATTR charset attributes-charset utf-8 296 ATTR language attributes-natural-language en 297 298 # What statuses are OK? 299 STATUS successful-ok 300 301 # What attributes do we expect? 302 EXPECT attributes-charset 303 EXPECT attributes-natural-language 304 EXPECT printer-name 305 EXPECT printer-uri-supported 306} 307{ 308 # The name of the test... 309 NAME "Get IPP/2.x Attributes for Printer Test1" 310 311 # The operation to use 312 OPERATION get-printer-attributes 313 RESOURCE / 314 315 # The IPP version to use 316 VERSION 2.0 317 318 # The attributes to send 319 GROUP operation 320 ATTR charset attributes-charset utf-8 321 ATTR language attributes-natural-language en 322 ATTR uri printer-uri $method://$hostname:$port/printers/Test1 323 324 # What statuses are OK? 325 STATUS successful-ok 326 327 # What attributes do we expect? 328 EXPECT media-col-default 329} 330