xref: /aosp_15_r20/external/libcups/test/4.4-subscription-ops.test (revision 5e7646d21f1134fb0638875d812ef646c12ab91e)
1#
2# Verify that the CUPS subscription 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 Subscription w/Lease"
13
14	# The operation to use
15	OPERATION Create-Printer-Subscription
16	RESOURCE /
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 $scheme://$hostname:$port/printers/Test1
23	ATTR name requesting-user-name $user
24
25        GROUP subscription
26	ATTR uri notify-recipient-uri testnotify://
27	ATTR keyword notify-events printer-state-changed
28	ATTR integer notify-lease-duration 5
29
30	# What statuses are OK?
31	STATUS successful-ok
32
33	# What attributes do we expect?
34	EXPECT attributes-charset
35	EXPECT attributes-natural-language
36	EXPECT notify-subscription-id
37	DISPLAY notify-subscription-id
38}
39{
40	# The name of the test...
41	NAME "Verify Subscription Expiration"
42
43	# Delay test for 7 seconds to allow lease to expire...
44	DELAY 7
45
46	# The operation to use
47	OPERATION Get-Subscription-Attributes
48	RESOURCE /
49
50	# The attributes to send
51	GROUP operation
52	ATTR charset attributes-charset utf-8
53	ATTR language attributes-natural-language en
54	ATTR uri printer-uri $scheme://$hostname:$port/printers/Test1
55	ATTR integer notify-subscription-id $notify-subscription-id
56	ATTR name requesting-user-name $user
57
58	# What statuses are OK?
59	STATUS client-error-not-found
60
61	# What attributes do we expect?
62	EXPECT attributes-charset
63	EXPECT attributes-natural-language
64}
65{
66	# The name of the test...
67	NAME "Add 2 Printer Subscriptions w/Lease"
68
69	# The operation to use
70	OPERATION Create-Printer-Subscription
71	RESOURCE /
72
73	# The attributes to send
74	GROUP operation
75	ATTR charset attributes-charset utf-8
76	ATTR language attributes-natural-language en
77	ATTR uri printer-uri $scheme://$hostname:$port/printers/Test1
78	ATTR name requesting-user-name $user
79
80        GROUP subscription
81	ATTR uri notify-recipient-uri testnotify://
82	ATTR keyword notify-events printer-state-changed
83	ATTR integer notify-lease-duration 5
84
85        GROUP subscription
86	ATTR uri notify-recipient-uri testnotify://
87	ATTR keyword notify-events printer-config-changed
88	ATTR integer notify-lease-duration 5
89
90	# What statuses are OK?
91	STATUS successful-ok
92
93	# What attributes do we expect?
94	EXPECT attributes-charset
95	EXPECT attributes-natural-language
96	EXPECT notify-subscription-id
97	DISPLAY notify-subscription-id
98}
99{
100	# The name of the test...
101	NAME "List Printer Subscriptions"
102
103	# The operation to use
104	OPERATION Get-Subscriptions
105	RESOURCE /
106
107	# The attributes to send
108	GROUP operation
109	ATTR charset attributes-charset utf-8
110	ATTR language attributes-natural-language en
111	ATTR uri printer-uri $scheme://$hostname:$port/printers/Test1
112	ATTR name requesting-user-name $user
113
114	# What statuses are OK?
115	STATUS successful-ok
116
117	# What attributes do we expect?
118	EXPECT attributes-charset
119	EXPECT attributes-natural-language
120	EXPECT notify-subscription-id
121	DISPLAY notify-subscription-id
122	EXPECT notify-printer-uri
123	DISPLAY notify-printer-uri
124	EXPECT notify-events
125	DISPLAY notify-events
126}
127{
128	# The name of the test...
129	NAME "Check MaxSubscriptions limits"
130
131	# The operation to use
132	OPERATION Create-Printer-Subscription
133	RESOURCE /
134
135	# The attributes to send
136	GROUP operation
137	ATTR charset attributes-charset utf-8
138	ATTR language attributes-natural-language en
139	ATTR uri printer-uri $scheme://$hostname:$port/printers/Test1
140	ATTR name requesting-user-name $user
141
142        GROUP subscription
143	ATTR uri notify-recipient-uri testnotify://
144	ATTR keyword notify-events printer-state-changed
145	ATTR integer notify-lease-duration 5
146
147	# What statuses are OK?
148	STATUS client-error-too-many-subscriptions
149
150	# What attributes do we expect?
151	EXPECT attributes-charset
152	EXPECT attributes-natural-language
153}
154