author | Michal Pryc <Michal.Pryc@Oracle.Com> |
Mon, 09 May 2011 19:45:50 +0200 | |
changeset 2340 | 194a87d123d4 |
parent 1890 | 011afb71c52a |
permissions | -rw-r--r-- |
1516
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1297
diff
changeset
|
1 |
#!/usr/bin/python |
1297
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
2 |
# |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
3 |
# CDDL HEADER START |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
4 |
# |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
5 |
# The contents of this file are subject to the terms of the |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
6 |
# Common Development and Distribution License (the "License"). |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
7 |
# You may not use this file except in compliance with the License. |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
8 |
# |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
9 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
10 |
# or http://www.opensolaris.org/os/licensing. |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
11 |
# See the License for the specific language governing permissions |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
12 |
# and limitations under the License. |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
13 |
# |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
14 |
# When distributing Covered Code, include this CDDL HEADER in each |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
15 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
16 |
# If applicable, add the following below this CDDL HEADER, with the |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
17 |
# fields enclosed by brackets "[]" replaced with your own identifying |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
18 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
19 |
# |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
20 |
# CDDL HEADER END |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
21 |
# |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
22 |
|
2340
194a87d123d4
18072 Automated GUI tests broken
Michal Pryc <Michal.Pryc@Oracle.Com>
parents:
1890
diff
changeset
|
23 |
# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. |
1297
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
24 |
|
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1516
diff
changeset
|
25 |
import testutils |
1297
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
26 |
if __name__ == "__main__": |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
27 |
testutils.setup_environment("../../../proto") |
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1516
diff
changeset
|
28 |
import pkg5unittest |
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1516
diff
changeset
|
29 |
import unittest |
1297
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
30 |
|
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
31 |
try: |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
32 |
import ldtp |
2340
194a87d123d4
18072 Automated GUI tests broken
Michal Pryc <Michal.Pryc@Oracle.Com>
parents:
1890
diff
changeset
|
33 |
import ldtputils |
194a87d123d4
18072 Automated GUI tests broken
Michal Pryc <Michal.Pryc@Oracle.Com>
parents:
1890
diff
changeset
|
34 |
if not "getmin" in dir(ldtp): |
194a87d123d4
18072 Automated GUI tests broken
Michal Pryc <Michal.Pryc@Oracle.Com>
parents:
1890
diff
changeset
|
35 |
raise ImportError |
1297
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
36 |
except ImportError: |
2340
194a87d123d4
18072 Automated GUI tests broken
Michal Pryc <Michal.Pryc@Oracle.Com>
parents:
1890
diff
changeset
|
37 |
raise ImportError, "ldtp 2.X package not installed." |
1297
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
38 |
|
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1516
diff
changeset
|
39 |
class TestPkgGuiHelp(pkg5unittest.SingleDepotTestCase): |
1297
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
40 |
# Only start/stop the depot once (instead of for every test) |
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1516
diff
changeset
|
41 |
persistent_setup = True |
1297
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
42 |
|
1890
011afb71c52a
15037 action parsing can't handle unicode objects which don't decode to ascii
Shawn Walker <shawn.walker@oracle.com>
parents:
1715
diff
changeset
|
43 |
# pygtk requires unicode as the default encoding. |
011afb71c52a
15037 action parsing can't handle unicode objects which don't decode to ascii
Shawn Walker <shawn.walker@oracle.com>
parents:
1715
diff
changeset
|
44 |
default_utf8 = True |
011afb71c52a
15037 action parsing can't handle unicode objects which don't decode to ascii
Shawn Walker <shawn.walker@oracle.com>
parents:
1715
diff
changeset
|
45 |
|
1297
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
46 |
foo10 = """ |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
47 |
open [email protected],5.11-0 |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
48 |
add set name="description" value="Some package1 description" |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
49 |
close """ |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
50 |
|
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
51 |
def setUp(self, debug_features=None): |
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1516
diff
changeset
|
52 |
pkg5unittest.SingleDepotTestCase.setUp(self) |
2340
194a87d123d4
18072 Automated GUI tests broken
Michal Pryc <Michal.Pryc@Oracle.Com>
parents:
1890
diff
changeset
|
53 |
self.pkgsend_bulk(self.rurl, self.foo10) |
194a87d123d4
18072 Automated GUI tests broken
Michal Pryc <Michal.Pryc@Oracle.Com>
parents:
1890
diff
changeset
|
54 |
self.image_create(self.rurl) |
194a87d123d4
18072 Automated GUI tests broken
Michal Pryc <Michal.Pryc@Oracle.Com>
parents:
1890
diff
changeset
|
55 |
self.pm_str = "%s/usr/bin/packagemanager" % pkg5unittest.g_proto_area |
1297
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
56 |
|
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1516
diff
changeset
|
57 |
def tearDown(self): |
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1516
diff
changeset
|
58 |
pkg5unittest.SingleDepotTestCase.tearDown(self) |
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1516
diff
changeset
|
59 |
|
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1516
diff
changeset
|
60 |
def testPmHelp(self): |
2340
194a87d123d4
18072 Automated GUI tests broken
Michal Pryc <Michal.Pryc@Oracle.Com>
parents:
1890
diff
changeset
|
61 |
ldtp.launchapp(self.pm_str,["-R", self.get_img_path()]) |
194a87d123d4
18072 Automated GUI tests broken
Michal Pryc <Michal.Pryc@Oracle.Com>
parents:
1890
diff
changeset
|
62 |
ldtp.waittillguiexist('Package Manager', state = ldtp.state.ENABLED) |
1297
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
63 |
|
2340
194a87d123d4
18072 Automated GUI tests broken
Michal Pryc <Michal.Pryc@Oracle.Com>
parents:
1890
diff
changeset
|
64 |
ldtp.selectmenuitem('Package Manager', 'mnuHelp;mnuContents') |
1297
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
65 |
|
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
66 |
# Verify result |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
67 |
ldtp.waittillguiexist('*Online Help') |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
68 |
self.assertEqual(ldtp.guiexist('*Online Help'), 1) |
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1516
diff
changeset
|
69 |
|
1297
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
70 |
ldtp.selectmenuitem('*Online Help', 'mnuCloseWindow') |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
71 |
|
2340
194a87d123d4
18072 Automated GUI tests broken
Michal Pryc <Michal.Pryc@Oracle.Com>
parents:
1890
diff
changeset
|
72 |
ldtp.selectmenuitem('Package Manager', 'mnuHelp;mnuAbout') |
1297
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
73 |
|
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
74 |
# Verify result |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
75 |
self.assertEqual(ldtp.guiexist('About Package Manager'), 1) |
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1516
diff
changeset
|
76 |
|
1297
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
77 |
ldtp.waittillguiexist('dlgAboutPackageManager') |
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
78 |
ldtp.click('dlgAboutPackageManager', 'btnClose') |
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1516
diff
changeset
|
79 |
|
1297
2924ade539eb
10580 Include automated tests for the Package Manager
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
80 |
# Quit Package Manager |
2340
194a87d123d4
18072 Automated GUI tests broken
Michal Pryc <Michal.Pryc@Oracle.Com>
parents:
1890
diff
changeset
|
81 |
ldtp.selectmenuitem('Package Manager', 'mnuFile;mnuQuit') |
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1516
diff
changeset
|
82 |
|
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1516
diff
changeset
|
83 |
if __name__ == "__main__": |
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1516
diff
changeset
|
84 |
unittest.main() |