Merge lp:~kyrofa/unity-scope-snappy/integration-tests_previews into lp:~unity-api-team/unity-scope-snappy/trunk

Proposed by Kyle Fazzari
Status: Merged
Approved by: Charles Kerr
Approved revision: 28
Merged at revision: 30
Proposed branch: lp:~kyrofa/unity-scope-snappy/integration-tests_previews
Merge into: lp:~unity-api-team/unity-scope-snappy/trunk
Prerequisite: lp:~kyrofa/unity-scope-snappy/improve_debs
Diff against target: 179 lines (+164/-0)
3 files modified
debian/source/format (+1/-0)
test/store/package_management_tasks.py (+96/-0)
test/store/test_previews.py (+67/-0)
To merge this branch: bzr merge lp:~kyrofa/unity-scope-snappy/integration-tests_previews
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
PS Jenkins bot continuous-integration Pending
Xavi Garcia Pending
Review via email: mp+265164@code.launchpad.net

This proposal supersedes a proposal from 2015-06-26.

Commit message

Add integration tests for package previews.

Description of the change

Add integration tests for package previews.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) wrote : Posted in a previous version of this proposal

Pretty straightforward; LGTM

review: Approve
28. By Kyle Fazzari

Merge prerequisite changes from lp:~kyrofa/unity-scope-snappy/improve_debs

Revision history for this message
Charles Kerr (charlesk) wrote :

Yup

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'debian/source'
2=== added file 'debian/source/format'
3--- debian/source/format 1970-01-01 00:00:00 +0000
4+++ debian/source/format 2015-07-17 18:23:50 +0000
5@@ -0,0 +1,1 @@
6+3.0 (quilt)
7
8=== added file 'test/store/package_management_tasks.py'
9--- test/store/package_management_tasks.py 1970-01-01 00:00:00 +0000
10+++ test/store/package_management_tasks.py 2015-07-17 18:23:50 +0000
11@@ -0,0 +1,96 @@
12+#!/usr/bin/env python3
13+
14+from scope_harness import (ScopeHarness,
15+ PreviewColumnMatcher,
16+ PreviewMatcher,
17+ PreviewWidgetMatcher)
18+
19+def verifyInstalledPreview(test, preview, title, subtitle, mascot,
20+ description, version, size):
21+ """Verify the preview for an installed package."""
22+
23+ test.assertMatchResult(PreviewColumnMatcher()
24+ .column(PreviewMatcher()
25+ .widget(PreviewWidgetMatcher("header")
26+ .type("header")
27+ .data({
28+ "title": title,
29+ "subtitle": subtitle,
30+ "mascot": mascot,
31+ "attributes": [
32+ {"value": "✓ Installed"}
33+ ]
34+ }))
35+ .widget(PreviewWidgetMatcher("actions")
36+ .type("actions")
37+ .data({
38+ "actions": [
39+ {
40+ "id": "open",
41+ "label": "Open"
42+ },
43+ {
44+ "id": "uninstall",
45+ "label": "Uninstall"
46+ }
47+ ]
48+ }))
49+ .widget(PreviewWidgetMatcher("summary")
50+ .type("text")
51+ .data({
52+ "title": "Info",
53+ "text": description
54+ }))
55+ .widget(PreviewWidgetMatcher("updates_table")
56+ .type("table")
57+ .data({
58+ "title": "Updates",
59+ "values": [
60+ ["Version number", version],
61+ ["Size", size]
62+ ]
63+ })))
64+ .match(preview.widgets))
65+
66+def verifyStorePreview(test, preview, title, subtitle, mascot,
67+ description, version, size):
68+ """Verify the preview for an in-store package (i.e. not installed)."""
69+
70+ test.assertMatchResult(PreviewColumnMatcher()
71+ .column(PreviewMatcher()
72+ .widget(PreviewWidgetMatcher("header")
73+ .type("header")
74+ .data({
75+ "title": title,
76+ "subtitle": subtitle,
77+ "mascot": mascot,
78+ "attributes": [
79+ {"value": "FREE"}
80+ ]
81+ }))
82+ .widget(PreviewWidgetMatcher("actions")
83+ .type("actions")
84+ .data({
85+ "actions": [
86+ {
87+ "id": "install",
88+ "label": "Install",
89+ }
90+ ]
91+ }))
92+ .widget(PreviewWidgetMatcher("summary")
93+ .type("text")
94+ .data({
95+ "title": "Info",
96+ "text": description
97+ }))
98+ .widget(PreviewWidgetMatcher("updates_table")
99+ .type("table")
100+ .data({
101+ "title": "Updates",
102+ "values": [
103+ ["Version number", version],
104+ ["Size", size]
105+ ]
106+ })))
107+ .match(preview.widgets))
108
109=== added file 'test/store/test_previews.py'
110--- test/store/test_previews.py 1970-01-01 00:00:00 +0000
111+++ test/store/test_previews.py 2015-07-17 18:23:50 +0000
112@@ -0,0 +1,67 @@
113+#!/usr/bin/env python3
114+
115+import os
116+import sys
117+import unittest
118+import fixtures
119+
120+from scope_harness.testing import ScopeHarnessTestCase
121+from scope_harness import (ScopeHarness,
122+ Parameters,
123+ DepartmentMatcher,
124+ ChildDepartmentMatcher,
125+ PreviewView,
126+ PreviewMatcher,
127+ PreviewColumnMatcher,
128+ PreviewWidgetMatcher)
129+
130+# Local imports
131+from test.fakes import FakeWebdmServer
132+from test.test_fixtures import ServerFixture
133+import test.store.package_management_tasks as tasks
134+
135+class TestPreviews(ScopeHarnessTestCase, fixtures.TestWithFixtures):
136+ """Test the different package previews available in the store scope.
137+ """
138+
139+ def setUp(self):
140+ """Setup the test fixtures and run the store scope using the harness.
141+ """
142+
143+ server = ServerFixture(FakeWebdmServer)
144+ self.useFixture(server)
145+
146+ os.environ["WEBDM_URL"] = server.url
147+
148+ self.harness = ScopeHarness.new_from_scope_list(Parameters([
149+ "{}/../../store/snappy-store.ini".format(os.path.dirname(os.path.realpath(__file__)))
150+ ]))
151+ self.view = self.harness.results_view
152+ self.view.active_scope = "snappy-store"
153+ self.view.search_query = ""
154+
155+ def testStorePreviewLayout(self):
156+ """Test the preview of a package that is not installed.
157+ """
158+
159+ self.view.browse_department("")
160+
161+ preview = self.view.category("store_packages").result("snappy:package2.canonical").tap()
162+ self.assertIsInstance(preview, PreviewView)
163+
164+ tasks.verifyStorePreview(self, preview, "package2", "Canonical",
165+ "http://icon2", "description2", "0.2",
166+ "124 kB")
167+
168+ def testInstalledPreviewLayout(self):
169+ """Test the preview of a package that is installed.
170+ """
171+
172+ self.view.browse_department("")
173+
174+ preview = self.view.category("store_packages").result("snappy:package1.canonical").tap()
175+ self.assertIsInstance(preview, PreviewView)
176+
177+ tasks.verifyInstalledPreview(self, preview, "package1", "Canonical",
178+ "http://icon1", "description1", "0.1",
179+ "124 kB")

Subscribers

People subscribed via source and target branches