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