author | Shawn Walker <srw@sun.com> |
Wed, 02 Dec 2009 22:07:06 -0600 | |
changeset 1538 | 78ac66abc186 |
parent 1537 | 00a5b4d54eb8 |
child 1603 | 84bd53597209 |
permissions | -rw-r--r-- |
1516
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1505
diff
changeset
|
1 |
#!/usr/bin/python |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
2 |
# |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
3 |
# CDDL HEADER START |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
4 |
# |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
5 |
# The contents of this file are subject to the terms of the |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
6 |
# Common Development and Distribution License (the "License"). |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
7 |
# You may not use this file except in compliance with the License. |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
8 |
# |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
9 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
10 |
# or http://www.opensolaris.org/os/licensing. |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
11 |
# See the License for the specific language governing permissions |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
12 |
# and limitations under the License. |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
13 |
# |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
14 |
# When distributing Covered Code, include this CDDL HEADER in each |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
15 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
16 |
# If applicable, add the following below this CDDL HEADER, with the |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
17 |
# fields enclosed by brackets "[]" replaced with your own identifying |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
18 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
19 |
# |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
20 |
# CDDL HEADER END |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
21 |
# |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
22 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
23 |
# |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
24 |
# Copyright 2009 Sun Microsystems, Inc. All rights reserved. |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
25 |
# Use is subject to license terms. |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
26 |
# |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
27 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
28 |
import testutils |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
29 |
if __name__ == "__main__": |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
30 |
testutils.setup_environment("../../../proto") |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
31 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
32 |
import cStringIO |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
33 |
import os |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
34 |
import pkg.client.api as api |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
35 |
import pkg.client.api_errors as api_errors |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
36 |
import pkg.client.progress as progress |
1252
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
37 |
import pkg.fmri as fmri |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
38 |
import sys |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
39 |
import tempfile |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
40 |
import time |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
41 |
import unittest |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
42 |
|
1538
78ac66abc186
12130 install/update operations should always refresh publisher metadata (when allowed)
Shawn Walker <srw@sun.com>
parents:
1537
diff
changeset
|
43 |
API_VERSION = 26 |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
44 |
PKG_CLIENT_NAME = "pkg" |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
45 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
46 |
class TestPkgApi(testutils.SingleDepotTestCase): |
1449
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
47 |
# restart the depot for every test |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
48 |
persistent_depot = False |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
49 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
50 |
foo10 = """ |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
51 |
open [email protected],5.11-0 |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
52 |
close """ |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
53 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
54 |
foo12 = """ |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
55 |
open [email protected],5.11-0 |
935
83e6020403cb
7262 tests/cli/t_api.py should use test prefix for temporary files
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
926
diff
changeset
|
56 |
add file $test_prefix/libc.so.1 mode=0555 owner=root group=bin path=/lib/libc.so.1 |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
57 |
close """ |
996
31d152a5212b
7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
941
diff
changeset
|
58 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
59 |
bar10 = """ |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
60 |
open [email protected],5.11-0 |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
61 |
close """ |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
62 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
63 |
p5i_bobcat = """{ |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
64 |
"packages": [ |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
65 |
"pkg:/[email protected],5.11-0", |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
66 |
"baz" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
67 |
], |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
68 |
"publishers": [ |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
69 |
{ |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
70 |
"alias": "cat", |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
71 |
"name": "bobcat", |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
72 |
"packages": [ |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
73 |
"pkg:/[email protected],5.11-0" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
74 |
], |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
75 |
"repositories": [ |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
76 |
{ |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
77 |
"collection_type": "core", |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
78 |
"description": "xkcd.net/325", |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
79 |
"legal_uris": [ |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
80 |
"http://xkcd.com/license.html" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
81 |
], |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
82 |
"mirrors": [], |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
83 |
"name": "source", |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
84 |
"origins": [ |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
85 |
"http://localhost:12001/" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
86 |
], |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
87 |
"refresh_seconds": 43200, |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
88 |
"registration_uri": "", |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
89 |
"related_uris": [] |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
90 |
} |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
91 |
] |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
92 |
} |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
93 |
], |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
94 |
"version": 1 |
1257
d911e4542c41
9025 pkg.client.api needs to use p5i module
Shawn Walker <srw@sun.com>
parents:
1255
diff
changeset
|
95 |
} |
d911e4542c41
9025 pkg.client.api needs to use p5i module
Shawn Walker <srw@sun.com>
parents:
1255
diff
changeset
|
96 |
""" |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
97 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
98 |
|
935
83e6020403cb
7262 tests/cli/t_api.py should use test prefix for temporary files
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
926
diff
changeset
|
99 |
misc_files = [ "libc.so.1" ] |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
100 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
101 |
def setUp(self): |
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1369
diff
changeset
|
102 |
testutils.SingleDepotTestCase.setUp(self, publisher="bobcat") |
935
83e6020403cb
7262 tests/cli/t_api.py should use test prefix for temporary files
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
926
diff
changeset
|
103 |
|
83e6020403cb
7262 tests/cli/t_api.py should use test prefix for temporary files
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
926
diff
changeset
|
104 |
self.foo12 = self.foo12.replace("$test_prefix", |
83e6020403cb
7262 tests/cli/t_api.py should use test prefix for temporary files
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
926
diff
changeset
|
105 |
self.get_test_prefix()) |
83e6020403cb
7262 tests/cli/t_api.py should use test prefix for temporary files
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
926
diff
changeset
|
106 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
107 |
for p in self.misc_files: |
935
83e6020403cb
7262 tests/cli/t_api.py should use test prefix for temporary files
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
926
diff
changeset
|
108 |
fpath = os.path.join(self.get_test_prefix(), p) |
83e6020403cb
7262 tests/cli/t_api.py should use test prefix for temporary files
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
926
diff
changeset
|
109 |
f = open(fpath, "wb") |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
110 |
# write the name of the file into the file, so that |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
111 |
# all files have differing contents |
935
83e6020403cb
7262 tests/cli/t_api.py should use test prefix for temporary files
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
926
diff
changeset
|
112 |
f.write(fpath) |
83e6020403cb
7262 tests/cli/t_api.py should use test prefix for temporary files
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
926
diff
changeset
|
113 |
f.close() |
83e6020403cb
7262 tests/cli/t_api.py should use test prefix for temporary files
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
926
diff
changeset
|
114 |
self.debug("wrote %s" % fpath) |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
115 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
116 |
def tearDown(self): |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
117 |
for p in self.misc_files: |
935
83e6020403cb
7262 tests/cli/t_api.py should use test prefix for temporary files
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
926
diff
changeset
|
118 |
os.remove(os.path.join(self.get_test_prefix(), p)) |
1369
e86145680c34
11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents:
1352
diff
changeset
|
119 |
testutils.SingleDepotTestCase.tearDown(self) |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
120 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
121 |
def __try_bad_installs(self, api_obj): |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
122 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
123 |
self.assertRaises(api_errors.PlanExistsException, |
1505
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1461
diff
changeset
|
124 |
api_obj.plan_install,["foo"]) |
996
31d152a5212b
7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
941
diff
changeset
|
125 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
126 |
self.assertRaises(api_errors.PlanExistsException, |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
127 |
api_obj.plan_uninstall,["foo"], False) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
128 |
self.assertRaises(api_errors.PlanExistsException, |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
129 |
api_obj.plan_update_all, sys.argv[0]) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
130 |
try: |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
131 |
api_obj.plan_update_all(sys.argv[0]) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
132 |
except api_errors.PlanExistsException: |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
133 |
pass |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
134 |
else: |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
135 |
assert 0 |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
136 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
137 |
def __try_bad_combinations_and_complete(self, api_obj): |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
138 |
self.__try_bad_installs(api_obj) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
139 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
140 |
self.assertRaises(api_errors.PrematureExecutionException, |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
141 |
api_obj.execute_plan) |
996
31d152a5212b
7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
941
diff
changeset
|
142 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
143 |
api_obj.prepare() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
144 |
self.__try_bad_installs(api_obj) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
145 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
146 |
self.assertRaises(api_errors.AlreadyPreparedException, |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
147 |
api_obj.prepare) |
996
31d152a5212b
7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
941
diff
changeset
|
148 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
149 |
api_obj.execute_plan() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
150 |
self.__try_bad_installs(api_obj) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
151 |
self.assertRaises(api_errors.AlreadyPreparedException, |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
152 |
api_obj.prepare) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
153 |
self.assertRaises(api_errors.AlreadyExecutedException, |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
154 |
api_obj.execute_plan) |
996
31d152a5212b
7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
941
diff
changeset
|
155 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
156 |
def test_bad_orderings(self): |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
157 |
durl = self.dc.get_depot_url() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
158 |
self.pkgsend_bulk(durl, self.foo10) |
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1369
diff
changeset
|
159 |
self.image_create(durl, prefix="bobcat") |
996
31d152a5212b
7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
941
diff
changeset
|
160 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
161 |
progresstracker = progress.NullProgressTracker() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
162 |
api_obj = api.ImageInterface(self.get_img_path(), API_VERSION, |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
163 |
progresstracker, lambda x: False, PKG_CLIENT_NAME) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
164 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
165 |
self.assert_(api_obj.describe() is None) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
166 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
167 |
self.assertRaises(api_errors.PlanMissingException, |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
168 |
api_obj.prepare) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
169 |
|
1505
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1461
diff
changeset
|
170 |
api_obj.plan_install(["foo"]) |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
171 |
self.__try_bad_combinations_and_complete(api_obj) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
172 |
api_obj.reset() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
173 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
174 |
self.assertRaises(api_errors.PlanMissingException, |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
175 |
api_obj.prepare) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
176 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
177 |
self.assert_(api_obj.describe() is None) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
178 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
179 |
self.pkgsend_bulk(durl, self.foo12) |
996
31d152a5212b
7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
941
diff
changeset
|
180 |
api_obj.refresh(immediate=True) |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
181 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
182 |
api_obj.plan_update_all(sys.argv[0]) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
183 |
self.__try_bad_combinations_and_complete(api_obj) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
184 |
api_obj.reset() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
185 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
186 |
self.assertRaises(api_errors.PlanMissingException, |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
187 |
api_obj.prepare) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
188 |
self.assert_(api_obj.describe() is None) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
189 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
190 |
api_obj.plan_uninstall(["foo"], False) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
191 |
self.__try_bad_combinations_and_complete(api_obj) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
192 |
api_obj.reset() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
193 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
194 |
self.assertRaises(api_errors.PlanMissingException, |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
195 |
api_obj.prepare) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
196 |
self.assert_(api_obj.describe() is None) |
996
31d152a5212b
7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
941
diff
changeset
|
197 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
198 |
def test_reset(self): |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
199 |
""" Send empty package [email protected], install and uninstall """ |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
200 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
201 |
durl = self.dc.get_depot_url() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
202 |
self.pkgsend_bulk(durl, self.foo10) |
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1369
diff
changeset
|
203 |
self.image_create(durl, prefix="bobcat") |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
204 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
205 |
progresstracker = progress.NullProgressTracker() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
206 |
api_obj = api.ImageInterface(self.get_img_path(), API_VERSION, |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
207 |
progresstracker, lambda x: False, PKG_CLIENT_NAME) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
208 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
209 |
recursive_removal = False |
996
31d152a5212b
7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
941
diff
changeset
|
210 |
|
1505
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1461
diff
changeset
|
211 |
api_obj.plan_install(["foo"]) |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
212 |
self.assert_(api_obj.describe() is not None) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
213 |
api_obj.reset() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
214 |
self.assert_(api_obj.describe() is None) |
1505
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1461
diff
changeset
|
215 |
api_obj.plan_install(["foo"]) |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
216 |
self.assert_(api_obj.describe() is not None) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
217 |
api_obj.prepare() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
218 |
api_obj.reset() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
219 |
self.assert_(api_obj.describe() is None) |
1505
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1461
diff
changeset
|
220 |
api_obj.plan_install(["foo"]) |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
221 |
self.assert_(api_obj.describe() is not None) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
222 |
api_obj.prepare() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
223 |
api_obj.execute_plan() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
224 |
api_obj.reset() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
225 |
self.assert_(api_obj.describe() is None) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
226 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
227 |
self.pkg("list") |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
228 |
self.pkg("verify") |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
229 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
230 |
self.pkgsend_bulk(durl, self.foo12) |
996
31d152a5212b
7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
941
diff
changeset
|
231 |
api_obj.refresh(immediate=True) |
31d152a5212b
7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
941
diff
changeset
|
232 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
233 |
api_obj.plan_update_all(sys.argv[0]) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
234 |
self.assert_(api_obj.describe() is not None) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
235 |
api_obj.reset() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
236 |
self.assert_(api_obj.describe() is None) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
237 |
api_obj.plan_update_all(sys.argv[0]) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
238 |
self.assert_(api_obj.describe() is not None) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
239 |
api_obj.prepare() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
240 |
api_obj.reset() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
241 |
self.assert_(api_obj.describe() is None) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
242 |
api_obj.plan_update_all(sys.argv[0]) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
243 |
self.assert_(api_obj.describe() is not None) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
244 |
api_obj.prepare() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
245 |
api_obj.execute_plan() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
246 |
api_obj.reset() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
247 |
self.assert_(api_obj.describe() is None) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
248 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
249 |
self.pkg("list") |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
250 |
self.pkg("verify") |
996
31d152a5212b
7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
941
diff
changeset
|
251 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
252 |
api_obj.plan_uninstall(["foo"], recursive_removal) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
253 |
self.assert_(api_obj.describe() is not None) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
254 |
api_obj.reset() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
255 |
self.assert_(api_obj.describe() is None) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
256 |
api_obj.plan_uninstall(["foo"], recursive_removal) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
257 |
self.assert_(api_obj.describe() is not None) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
258 |
api_obj.prepare() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
259 |
api_obj.reset() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
260 |
self.assert_(api_obj.describe() is None) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
261 |
api_obj.plan_uninstall(["foo"], recursive_removal) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
262 |
self.assert_(api_obj.describe() is not None) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
263 |
api_obj.prepare() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
264 |
api_obj.execute_plan() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
265 |
api_obj.reset() |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
266 |
self.assert_(api_obj.describe() is None) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
267 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
268 |
self.pkg("verify") |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
269 |
|
1449
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
270 |
def test_refresh_transition(self): |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
271 |
"""Verify that refresh works for a v0 catalog source and that |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
272 |
if the client transitions from v0 to v1 or back that the correct |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
273 |
state information is recorded in the image catalog.""" |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
274 |
|
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
275 |
# First create the image and get v1 catalog. |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
276 |
durl = self.dc.get_depot_url() |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
277 |
self.pkgsend_bulk(durl, self.foo10) |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
278 |
self.image_create(durl, prefix="bobcat") |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
279 |
|
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
280 |
progresstracker = progress.NullProgressTracker() |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
281 |
api_obj = api.ImageInterface(self.get_img_path(), API_VERSION, |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
282 |
progresstracker, lambda x: False, PKG_CLIENT_NAME) |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
283 |
img = api_obj.img |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
284 |
cat = img.get_catalog(img.IMG_CATALOG_KNOWN) |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
285 |
entry = [e for f, e in cat.entries()][0] |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
286 |
states = entry["metadata"]["states"] |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
287 |
self.assert_(img.PKG_STATE_V1 in states) |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
288 |
self.assert_(img.PKG_STATE_V0 not in states) |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
289 |
|
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
290 |
# Next, disable v1 catalog for the depot and force a client |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
291 |
# refresh. Only v0 state should be present. |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
292 |
self.dc.set_disable_ops(["catalog/1"]) |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
293 |
self.dc.stop() |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
294 |
self.dc.start() |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
295 |
api_obj.refresh(immediate=True) |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
296 |
|
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
297 |
cat = img.get_catalog(img.IMG_CATALOG_KNOWN) |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
298 |
entry = [e for f, e in cat.entries()][0] |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
299 |
states = entry["metadata"]["states"] |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
300 |
self.assert_(img.PKG_STATE_V1 not in states) |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
301 |
self.assert_(img.PKG_STATE_V0 in states) |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
302 |
|
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
303 |
# Finally, transition back to v1 catalog. This requires |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
304 |
# creating a new api object since transport will think that |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
305 |
# v1 catalogs are still unsupported. |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
306 |
self.dc.unset_disable_ops() |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
307 |
self.dc.stop() |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
308 |
self.dc.start() |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
309 |
|
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
310 |
progresstracker = progress.NullProgressTracker() |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
311 |
api_obj = api.ImageInterface(self.get_img_path(), API_VERSION, |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
312 |
progresstracker, lambda x: False, PKG_CLIENT_NAME) |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
313 |
api_obj.refresh(immediate=True) |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
314 |
img = api_obj.img |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
315 |
|
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
316 |
cat = img.get_catalog(img.IMG_CATALOG_KNOWN) |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
317 |
entry = [e for f, e in cat.entries()][0] |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
318 |
states = entry["metadata"]["states"] |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
319 |
self.assert_(img.PKG_STATE_V1 in states) |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
320 |
self.assert_(img.PKG_STATE_V0 not in states) |
a721d9b0aad2
12273 client catalog can mis-merge state information / lazy-load can fail
Shawn Walker <srw@sun.com>
parents:
1431
diff
changeset
|
321 |
|
1255
13914487fd06
8854 access to ImageInterface img root desired
Shawn Walker <srw@sun.com>
parents:
1252
diff
changeset
|
322 |
def test_properties(self): |
13914487fd06
8854 access to ImageInterface img root desired
Shawn Walker <srw@sun.com>
parents:
1252
diff
changeset
|
323 |
"""Verify that properties of the ImageInterface api object are |
13914487fd06
8854 access to ImageInterface img root desired
Shawn Walker <srw@sun.com>
parents:
1252
diff
changeset
|
324 |
accessible and return expected values.""" |
13914487fd06
8854 access to ImageInterface img root desired
Shawn Walker <srw@sun.com>
parents:
1252
diff
changeset
|
325 |
|
13914487fd06
8854 access to ImageInterface img root desired
Shawn Walker <srw@sun.com>
parents:
1252
diff
changeset
|
326 |
durl = self.dc.get_depot_url() |
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1369
diff
changeset
|
327 |
self.image_create(durl, prefix="bobcat") |
1255
13914487fd06
8854 access to ImageInterface img root desired
Shawn Walker <srw@sun.com>
parents:
1252
diff
changeset
|
328 |
|
13914487fd06
8854 access to ImageInterface img root desired
Shawn Walker <srw@sun.com>
parents:
1252
diff
changeset
|
329 |
progresstracker = progress.NullProgressTracker() |
13914487fd06
8854 access to ImageInterface img root desired
Shawn Walker <srw@sun.com>
parents:
1252
diff
changeset
|
330 |
api_obj = api.ImageInterface(self.get_img_path(), API_VERSION, |
13914487fd06
8854 access to ImageInterface img root desired
Shawn Walker <srw@sun.com>
parents:
1252
diff
changeset
|
331 |
progresstracker, lambda x: False, PKG_CLIENT_NAME) |
13914487fd06
8854 access to ImageInterface img root desired
Shawn Walker <srw@sun.com>
parents:
1252
diff
changeset
|
332 |
|
13914487fd06
8854 access to ImageInterface img root desired
Shawn Walker <srw@sun.com>
parents:
1252
diff
changeset
|
333 |
self.assertEqual(api_obj.root, self.img_path) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
334 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
335 |
def test_publisher_apis(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
336 |
"""Verify that the publisher api methods work as expected. |
996
31d152a5212b
7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
941
diff
changeset
|
337 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
338 |
Note that not all methods are tested here as this would be |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
339 |
redundant since other tests for the client will use those |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
340 |
methods indirectly.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
341 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
342 |
durl = self.dc.get_depot_url() |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
343 |
plist = self.pkgsend_bulk(durl, self.foo10 + self.bar10) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
344 |
self.image_create(durl, prefix="bobcat") |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
345 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
346 |
progresstracker = progress.NullProgressTracker() |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
347 |
api_obj = api.ImageInterface(self.get_img_path(), API_VERSION, |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
348 |
progresstracker, lambda x: False, PKG_CLIENT_NAME) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
349 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
350 |
# Verify that existence tests succeed. |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
351 |
self.assertTrue(api_obj.has_publisher("bobcat")) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
352 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
353 |
# Verify preferred publisher prefix is returned correctly. |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
354 |
self.assertEqual(api_obj.get_preferred_publisher(), "bobcat") |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
355 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
356 |
# Verify that get_publisher returned the correct publisher object. |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
357 |
pub = api_obj.get_publisher(prefix="bobcat") |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
358 |
self.assertEqual(pub.prefix, "bobcat") |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
359 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
360 |
# Verify that not specifying matching criteria for get_publisher |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
361 |
# raises a UnknownPublisher exception. |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
362 |
self.assertRaises(api_errors.UnknownPublisher, |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
363 |
api_obj.get_publisher, "zuul") |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
364 |
self.assertRaises(api_errors.UnknownPublisher, |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
365 |
api_obj.get_publisher) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
366 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
367 |
# Verify that publisher objects returned from get_publishers |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
368 |
# match those returned by get_publisher. |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
369 |
pubs = api_obj.get_publishers() |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
370 |
self.assertEqual(pub.prefix, pubs[0].prefix) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
371 |
self.assertEqual(id(pub), id(pubs[0])) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
372 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
373 |
# Verify that duplicate actually creates duplicates. |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
374 |
cpub = api_obj.get_publisher(prefix="bobcat", duplicate=True) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
375 |
self.assertNotEqual(id(pub), id(cpub)) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
376 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
377 |
# Now modify publisher information and update. |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
378 |
cpub.alias = "cat" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
379 |
repo = cpub.selected_repository |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
380 |
repo.name = "source" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
381 |
repo.description = "xkcd.net/325" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
382 |
repo.legal_uris = ["http://xkcd.com/license.html"] |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
383 |
repo.refresh_seconds = 43200 |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
384 |
repo.registered = False |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
385 |
api_obj.update_publisher(cpub) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
386 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
387 |
# Verify that the update happened. |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
388 |
pub = api_obj.get_publisher(prefix="bobcat") |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
389 |
self.assertEqual(pub.alias, "cat") |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
390 |
repo = pub.selected_repository |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
391 |
self.assertEqual(repo.name, "source") |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
392 |
self.assertEqual(repo.description, "xkcd.net/325") |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
393 |
self.assertEqual(repo.legal_uris[0], |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
394 |
"http://xkcd.com/license.html") |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
395 |
self.assertEqual(repo.refresh_seconds, 43200) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
396 |
self.assertEqual(repo.registered, False) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
397 |
|
1252
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
398 |
# Verify that duplicates match their original. |
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
399 |
cpub = api_obj.get_publisher(alias=pub.alias, duplicate=True) |
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
400 |
for p in ("alias", "prefix", "meta_root"): |
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
401 |
self.assertEqual(getattr(pub, p), getattr(cpub, p)) |
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
402 |
|
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
403 |
for p in ("collection_type", "description", "legal_uris", |
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
404 |
"mirrors", "name", "origins", "refresh_seconds", |
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
405 |
"registered", "registration_uri", "related_uris", |
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
406 |
"sort_policy"): |
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
407 |
srepo = pub.selected_repository |
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
408 |
crepo = cpub.selected_repository |
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
409 |
self.assertEqual(getattr(srepo, p), getattr(crepo, p)) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
410 |
cpub = None |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
411 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
412 |
cpubs = api_obj.get_publishers(duplicate=True) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
413 |
self.assertNotEqual(id(pub), id(cpubs[0])) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
414 |
cpubs = None |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
415 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
416 |
# Verify that publisher_last_update_time returns a value. |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
417 |
self.assertTrue( |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
418 |
api_obj.get_publisher_last_update_time("bobcat")) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
419 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
420 |
# Verify that p5i export and parse works as expected. |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
421 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
422 |
# Ensure that PackageInfo, PkgFmri, and strings are all |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
423 |
# supported properly. |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
424 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
425 |
# Strip timestamp information so that comparison with |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
426 |
# pre-generated test data will succeed. |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
427 |
ffoo = fmri.PkgFmri(plist[0]) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
428 |
sfoo = str(ffoo).replace(":%s" % ffoo.version.timestr, "") |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
429 |
ffoo = fmri.PkgFmri(sfoo) |
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1369
diff
changeset
|
430 |
sfoo = ffoo.get_fmri(anarchy=True) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
431 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
432 |
fbar = fmri.PkgFmri(plist[1]) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
433 |
sbar = str(fbar).replace(":%s" % fbar.version.timestr, "") |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
434 |
fbar = fmri.PkgFmri(sbar) |
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1369
diff
changeset
|
435 |
sbar = fbar.get_fmri(anarchy=True) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
436 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
437 |
# Build a simple list of packages. |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
438 |
pnames = { |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
439 |
"bobcat": (api.PackageInfo(ffoo),), |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
440 |
"": [fbar, "baz"], |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
441 |
} |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
442 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
443 |
# Dump the p5i data. |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
444 |
fobj = cStringIO.StringIO() |
1117
667aecade0ab
7862 install links using p5i for search results desired
Shawn Walker <srw@sun.com>
parents:
1087
diff
changeset
|
445 |
api_obj.write_p5i(fobj, pkg_names=pnames, pubs=[pub]) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
446 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
447 |
# Verify that output matches expected output. |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
448 |
fobj.seek(0) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
449 |
output = fobj.read() |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
450 |
self.assertEqual(output, self.p5i_bobcat) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
451 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
452 |
def validate_results(results): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
453 |
# First result should be 'bobcat' publisher and its |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
454 |
# pkg_names. |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
455 |
pub, pkg_names = results[0] |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
456 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
457 |
self.assertEqual(pub.prefix, "bobcat") |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
458 |
self.assertEqual(pub.alias, "cat") |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
459 |
repo = pub.selected_repository |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
460 |
self.assertEqual(repo.name, "source") |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
461 |
self.assertEqual(repo.description, "xkcd.net/325") |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
462 |
self.assertEqual(repo.legal_uris[0], |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
463 |
"http://xkcd.com/license.html") |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
464 |
self.assertEqual(repo.refresh_seconds, 43200) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
465 |
self.assertEqual(pkg_names, [sfoo]) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
466 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
467 |
# Last result should be no publisher and a list of |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
468 |
# pkg_names. |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
469 |
pub, pkg_names = results[1] |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
470 |
self.assertEqual(pub, None) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
471 |
self.assertEqual(pkg_names, [sbar, "baz"]) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
472 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
473 |
# Verify that parse returns the expected object and information |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
474 |
# when provided a fileobj. |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
475 |
fobj.seek(0) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
476 |
validate_results(api_obj.parse_p5i(fileobj=fobj)) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
477 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
478 |
# Verify that an add of the parsed object works (the name has to |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
479 |
# be changed to prevent a duplicate error here). |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
480 |
fobj.seek(0) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
481 |
results = api_obj.parse_p5i(fileobj=fobj) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
482 |
pub, pkg_names = results[0] |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
483 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
484 |
pub.prefix = "p5icat" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
485 |
pub.alias = "copycat" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
486 |
api_obj.add_publisher(pub, refresh_allowed=False) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
487 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
488 |
# Now verify that we can retrieve the added publisher. |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
489 |
api_obj.get_publisher(prefix=pub.prefix) |
1252
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
490 |
cpub = api_obj.get_publisher(alias=pub.alias, duplicate=True) |
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
491 |
|
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
492 |
# Now update the publisher and set it to disabled, to verify |
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
493 |
# that api functions still work as expected. |
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
494 |
cpub.disabled = True |
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
495 |
api_obj.update_publisher(cpub) |
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
496 |
|
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
497 |
cpub = api_obj.get_publisher(alias=cpub.alias, duplicate=True) |
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
498 |
self.assertTrue(cpub.disabled) |
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
499 |
|
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
500 |
self.assertTrue(api_obj.has_publisher(prefix=cpub.prefix)) |
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
501 |
|
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
502 |
# Now attempt to update the disabled publisher. |
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
503 |
cpub = api_obj.get_publisher(alias=cpub.alias, duplicate=True) |
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
504 |
cpub.alias = "copycopycat" |
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
505 |
api_obj.update_publisher(cpub) |
3b1b69011fcf
8709 ImageInterface.has_publisher has incorrect docstring
Shawn Walker <srw@sun.com>
parents:
1141
diff
changeset
|
506 |
cpub = None |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
507 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
508 |
# Verify that parse returns the expected object and information |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
509 |
# when provided a file path. |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
510 |
fobj.seek(0) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
511 |
(fd1, path1) = tempfile.mkstemp(dir=self.get_test_prefix()) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
512 |
os.write(fd1, fobj.read()) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
513 |
validate_results(api_obj.parse_p5i(location=path1)) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
514 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
515 |
# Verify that parse returns the expected object and information |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
516 |
# when provided a file URI. |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
517 |
validate_results(api_obj.parse_p5i(location="file://" + path1)) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
518 |
fobj.close() |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
519 |
fobj = None |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
520 |
|
935
83e6020403cb
7262 tests/cli/t_api.py should use test prefix for temporary files
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
926
diff
changeset
|
521 |
# Verify that appropriate exceptions are raised for p5i |
83e6020403cb
7262 tests/cli/t_api.py should use test prefix for temporary files
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
926
diff
changeset
|
522 |
# information that can't be retrieved (doesn't exist). |
83e6020403cb
7262 tests/cli/t_api.py should use test prefix for temporary files
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
926
diff
changeset
|
523 |
nefpath = os.path.join(self.get_test_prefix(), "non-existent") |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
524 |
self.assertRaises(api_errors.RetrievalError, |
935
83e6020403cb
7262 tests/cli/t_api.py should use test prefix for temporary files
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
926
diff
changeset
|
525 |
api_obj.parse_p5i, location="file://%s" % nefpath) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
526 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
527 |
self.assertRaises(api_errors.RetrievalError, |
935
83e6020403cb
7262 tests/cli/t_api.py should use test prefix for temporary files
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
926
diff
changeset
|
528 |
api_obj.parse_p5i, location=nefpath) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
529 |
|
935
83e6020403cb
7262 tests/cli/t_api.py should use test prefix for temporary files
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
926
diff
changeset
|
530 |
# Verify that appropriate exceptions are raised for invalid |
83e6020403cb
7262 tests/cli/t_api.py should use test prefix for temporary files
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
926
diff
changeset
|
531 |
# p5i information. |
83e6020403cb
7262 tests/cli/t_api.py should use test prefix for temporary files
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
926
diff
changeset
|
532 |
lcpath = os.path.join(self.get_test_prefix(), "libc.so.1") |
83e6020403cb
7262 tests/cli/t_api.py should use test prefix for temporary files
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
926
diff
changeset
|
533 |
self.assertRaises(api_errors.InvalidP5IFile, api_obj.parse_p5i, |
83e6020403cb
7262 tests/cli/t_api.py should use test prefix for temporary files
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
926
diff
changeset
|
534 |
location="file://%s" % lcpath) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
917
diff
changeset
|
535 |
|
935
83e6020403cb
7262 tests/cli/t_api.py should use test prefix for temporary files
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
926
diff
changeset
|
536 |
self.assertRaises(api_errors.InvalidP5IFile, api_obj.parse_p5i, |
83e6020403cb
7262 tests/cli/t_api.py should use test prefix for temporary files
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
926
diff
changeset
|
537 |
location=lcpath) |