author | Rich Burridge <rich.burridge@sun.com> |
Mon, 30 Nov 2009 13:01:40 -0800 | |
changeset 1516 | 8c950a3b4171 |
parent 926 | 6ee411c9026a |
child 1715 | 8f305f0a6864 |
permissions | -rw-r--r-- |
1516
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
926
diff
changeset
|
1 |
#!/usr/bin/python |
581 | 2 |
# |
3 |
# CDDL HEADER START |
|
4 |
# |
|
5 |
# The contents of this file are subject to the terms of the |
|
6 |
# Common Development and Distribution License (the "License"). |
|
7 |
# You may not use this file except in compliance with the License. |
|
8 |
# |
|
9 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
|
10 |
# or http://www.opensolaris.org/os/licensing. |
|
11 |
# See the License for the specific language governing permissions |
|
12 |
# and limitations under the License. |
|
13 |
# |
|
14 |
# When distributing Covered Code, include this CDDL HEADER in each |
|
15 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
|
16 |
# If applicable, add the following below this CDDL HEADER, with the |
|
17 |
# fields enclosed by brackets "[]" replaced with your own identifying |
|
18 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
|
19 |
# |
|
20 |
# CDDL HEADER END |
|
21 |
# |
|
22 |
||
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
23 |
# |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
24 |
# Copyright 2009 Sun Microsystems, Inc. All rights reserved. |
581 | 25 |
# Use is subject to license terms. |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
26 |
# |
581 | 27 |
|
28 |
import testutils |
|
29 |
if __name__ == "__main__": |
|
30 |
testutils.setup_environment("../../../proto") |
|
31 |
||
32 |
import unittest |
|
33 |
import os |
|
34 |
import re |
|
35 |
import shutil |
|
36 |
import difflib |
|
37 |
||
38 |
class TestPkgInfoBasics(testutils.SingleDepotTestCase): |
|
39 |
# Only start/stop the depot once (instead of for every test) |
|
40 |
persistent_depot = True |
|
41 |
||
42 |
def test_pkg_properties(self): |
|
792
060a802056a4
4372 property set commands should display error for preferred-authority property
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
709
diff
changeset
|
43 |
"""pkg: set, unset, and display properties""" |
581 | 44 |
|
45 |
durl = self.dc.get_depot_url() |
|
46 |
self.image_create(durl) |
|
47 |
||
48 |
self.pkg("set-property -@", exit=2) |
|
49 |
self.pkg("get-property -@", exit=2) |
|
50 |
self.pkg("property -@", exit=2) |
|
51 |
||
52 |
self.pkg("set-property title sample") |
|
53 |
self.pkg('set-property description "more than one word"') |
|
54 |
self.pkg("property") |
|
611
e2a9af3f81ab
4131 "pkg property" prints only headers
Tom Mueller <Tom.Mueller@sun.com>
parents:
581
diff
changeset
|
55 |
self.pkg("property | grep title") |
e2a9af3f81ab
4131 "pkg property" prints only headers
Tom Mueller <Tom.Mueller@sun.com>
parents:
581
diff
changeset
|
56 |
self.pkg("property | grep description") |
e2a9af3f81ab
4131 "pkg property" prints only headers
Tom Mueller <Tom.Mueller@sun.com>
parents:
581
diff
changeset
|
57 |
self.pkg("property | grep 'sample'") |
e2a9af3f81ab
4131 "pkg property" prints only headers
Tom Mueller <Tom.Mueller@sun.com>
parents:
581
diff
changeset
|
58 |
self.pkg("property | grep 'more than one word'") |
581 | 59 |
self.pkg("unset-property description") |
60 |
self.pkg("property -H") |
|
61 |
self.pkg("property title") |
|
62 |
self.pkg("property -H title") |
|
63 |
self.pkg("property description", exit=1) |
|
64 |
self.pkg("unset-property description", exit=1) |
|
65 |
self.pkg("unset-property", exit=2) |
|
66 |
||
709
cfb249e57576
2393 traceback when attempting to change client settings without permission
Brock Pytlik <bpytlik@sun.com>
parents:
611
diff
changeset
|
67 |
def test_missing_permssions(self): |
cfb249e57576
2393 traceback when attempting to change client settings without permission
Brock Pytlik <bpytlik@sun.com>
parents:
611
diff
changeset
|
68 |
"""Bug 2393""" |
cfb249e57576
2393 traceback when attempting to change client settings without permission
Brock Pytlik <bpytlik@sun.com>
parents:
611
diff
changeset
|
69 |
durl = self.dc.get_depot_url() |
cfb249e57576
2393 traceback when attempting to change client settings without permission
Brock Pytlik <bpytlik@sun.com>
parents:
611
diff
changeset
|
70 |
self.image_create(durl) |
cfb249e57576
2393 traceback when attempting to change client settings without permission
Brock Pytlik <bpytlik@sun.com>
parents:
611
diff
changeset
|
71 |
|
cfb249e57576
2393 traceback when attempting to change client settings without permission
Brock Pytlik <bpytlik@sun.com>
parents:
611
diff
changeset
|
72 |
self.pkg("property") |
834
f8b3396500b3
4883 import failure for non-sunos platforms due to missing pspawn
Tom Mueller <Tom.Mueller@sun.com>
parents:
792
diff
changeset
|
73 |
self.pkg("set-property require-optional True", su_wrap=True, exit=1) |
709
cfb249e57576
2393 traceback when attempting to change client settings without permission
Brock Pytlik <bpytlik@sun.com>
parents:
611
diff
changeset
|
74 |
self.pkg("set-property require-optional True") |
834
f8b3396500b3
4883 import failure for non-sunos platforms due to missing pspawn
Tom Mueller <Tom.Mueller@sun.com>
parents:
792
diff
changeset
|
75 |
self.pkg("unset-property require-optional", su_wrap=True, exit=1) |
709
cfb249e57576
2393 traceback when attempting to change client settings without permission
Brock Pytlik <bpytlik@sun.com>
parents:
611
diff
changeset
|
76 |
self.pkg("unset-property require-optional") |
cfb249e57576
2393 traceback when attempting to change client settings without permission
Brock Pytlik <bpytlik@sun.com>
parents:
611
diff
changeset
|
77 |
|
792
060a802056a4
4372 property set commands should display error for preferred-authority property
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
709
diff
changeset
|
78 |
def test_bug_4372(self): |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
79 |
"""Verify that preferred-publisher cannot be changed using the |
792
060a802056a4
4372 property set commands should display error for preferred-authority property
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
709
diff
changeset
|
80 |
property commands, but can be read.""" |
060a802056a4
4372 property set commands should display error for preferred-authority property
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
709
diff
changeset
|
81 |
durl = self.dc.get_depot_url() |
060a802056a4
4372 property set commands should display error for preferred-authority property
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
709
diff
changeset
|
82 |
self.image_create(durl) |
060a802056a4
4372 property set commands should display error for preferred-authority property
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
709
diff
changeset
|
83 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
84 |
self.pkg("set-property preferred-publisher foo", exit=1) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
85 |
self.pkg("unset-property preferred-publisher", exit=1) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
834
diff
changeset
|
86 |
self.pkg("property preferred-publisher") |
792
060a802056a4
4372 property set commands should display error for preferred-authority property
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
709
diff
changeset
|
87 |
|
581 | 88 |
if __name__ == "__main__": |
89 |
unittest.main() |