Merge lp:~dobey/unity-scope-click/more-coverage into lp:unity-scope-click

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: 369
Merged at revision: 368
Proposed branch: lp:~dobey/unity-scope-click/more-coverage
Merge into: lp:unity-scope-click
Prerequisite: lp:~dobey/unity-scope-click/fix-rating-widget
Diff against target: 219 lines (+151/-12)
2 files modified
scope/tests/test_apps_scope.cpp (+53/-8)
scope/tests/test_store_scope.cpp (+98/-4)
To merge this branch: bzr merge lp:~dobey/unity-scope-click/more-coverage
Reviewer Review Type Date Requested Status
Kyle Fazzari (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+268275@code.launchpad.net

Commit message

Add more test coverage of conditionals.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
369. By dobey

Disable the confirm uninstall test as it fails in jenkins.
Remove the new override code for qt wrapping.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Kyle Fazzari (kyrofa) wrote :

I have a bad feeling about adding more disabled tests without the necessary refactoring to make them pass, but this looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scope/tests/test_apps_scope.cpp'
2--- scope/tests/test_apps_scope.cpp 2015-08-18 01:45:28 +0000
3+++ scope/tests/test_apps_scope.cpp 2015-08-18 01:45:28 +0000
4@@ -27,14 +27,15 @@
5 * files in the program, then also delete it here.
6 */
7
8+#include <clickapps/apps-scope.h>
9+#include <click/preview.h>
10+#include <clickapps/apps-query.h>
11+
12 #include <gtest/gtest.h>
13 #include <gmock/gmock.h>
14
15 #include <unity/scopes/testing/Result.h>
16
17-#include <click/preview.h>
18-#include <clickapps/apps-scope.h>
19-
20 using namespace ::testing;
21
22 class AppsScopeTest : public Test {
23@@ -52,16 +53,60 @@
24 }
25 };
26
27-TEST_F(AppsScopeTest, testStoreScopeRatingNew)
28-{
29- auto activation = scope.perform_action(result, metadata, "rating", click::Preview::Actions::RATED);
30+TEST_F(AppsScopeTest, DISABLED_testConfirmUninstall)
31+{
32+ result.set_title("foo");
33+ result[click::apps::Query::ResultKeys::NAME] = "foo.name";
34+ result[click::apps::Query::ResultKeys::VERSION] = "0.1";
35+ auto activation = scope.perform_action(result, metadata, "widget",
36+ click::Preview::Actions::CONFIRM_UNINSTALL);
37+ auto response = activation->activate();
38+}
39+
40+TEST_F(AppsScopeTest, testCancelPurchaseInstalled)
41+{
42+ auto activation = scope.perform_action(result, metadata, "button",
43+ click::Preview::Actions::CANCEL_PURCHASE_INSTALLED);
44+ auto response = activation->activate();
45+ EXPECT_TRUE(response.scope_data().get_dict()[click::Preview::Actions::CANCEL_PURCHASE_INSTALLED].get_bool());
46+}
47+
48+TEST_F(AppsScopeTest, testCancelPurchaseUninstalled)
49+{
50+ auto activation = scope.perform_action(result, metadata, "button",
51+ click::Preview::Actions::CANCEL_PURCHASE_UNINSTALLED);
52+ auto response = activation->activate();
53+ EXPECT_TRUE(response.scope_data().get_dict()[click::Preview::Actions::CANCEL_PURCHASE_UNINSTALLED].get_bool());
54+}
55+
56+TEST_F(AppsScopeTest, testShowInstalled)
57+{
58+ auto activation = scope.perform_action(result, metadata, "button",
59+ click::Preview::Actions::SHOW_INSTALLED);
60+ auto response = activation->activate();
61+ EXPECT_TRUE(response.scope_data().get_dict()[click::Preview::Actions::SHOW_INSTALLED].get_bool());
62+}
63+
64+TEST_F(AppsScopeTest, testShowUninstalled)
65+{
66+ auto activation = scope.perform_action(result, metadata, "button",
67+ click::Preview::Actions::SHOW_UNINSTALLED);
68+ auto response = activation->activate();
69+ EXPECT_TRUE(response.scope_data().get_dict()[click::Preview::Actions::SHOW_UNINSTALLED].get_bool());
70+}
71+
72+TEST_F(AppsScopeTest, testRatingNew)
73+{
74+ auto activation = scope.perform_action(result, metadata, "rating",
75+ click::Preview::Actions::RATED);
76 auto response = activation->activate();
77 EXPECT_EQ("rating", response.scope_data().get_dict()["widget_id"].get_string());
78 }
79
80-TEST_F(AppsScopeTest, testStoreScopeRatingEdit)
81+TEST_F(AppsScopeTest, testRatingEdit)
82 {
83- auto activation = scope.perform_action(result, metadata, "93345", click::Preview::Actions::RATED);
84+ auto activation = scope.perform_action(result, metadata, "93345",
85+ click::Preview::Actions::RATED);
86 auto response = activation->activate();
87 EXPECT_EQ("93345", response.scope_data().get_dict()["widget_id"].get_string());
88 }
89
90=== modified file 'scope/tests/test_store_scope.cpp'
91--- scope/tests/test_store_scope.cpp 2015-08-18 01:45:28 +0000
92+++ scope/tests/test_store_scope.cpp 2015-08-18 01:45:28 +0000
93@@ -57,28 +57,122 @@
94
95 TEST_F(StoreScopeTest, testPurchaseCompletedPassesHash)
96 {
97- auto activation = scope.perform_action(result, metadata, "widget_id", "purchaseCompleted");
98+ auto activation = scope.perform_action(result, metadata, "widget_id",
99+ "purchaseCompleted");
100 auto response = activation->activate();
101 EXPECT_EQ(FAKE_SHA512, response.scope_data().get_dict()["download_sha512"].get_string());
102+ EXPECT_TRUE(response.scope_data().get_dict()["purchased"].get_bool());
103+}
104+
105+TEST_F(StoreScopeTest, testPurchaseError)
106+{
107+ auto activation = scope.perform_action(result, metadata, "widget_id",
108+ "purchaseError");
109+ auto response = activation->activate();
110+ EXPECT_TRUE(response.scope_data().get_dict()[click::Preview::Actions::DOWNLOAD_FAILED].get_bool());
111 }
112
113 TEST_F(StoreScopeTest, testInstallClickPassesHash)
114 {
115- auto activation = scope.perform_action(result, metadata, "widget_id", click::Preview::Actions::INSTALL_CLICK);
116+ auto activation = scope.perform_action(result, metadata, "widget_id",
117+ click::Preview::Actions::INSTALL_CLICK);
118 auto response = activation->activate();
119 EXPECT_EQ(FAKE_SHA512, response.scope_data().get_dict()["download_sha512"].get_string());
120 }
121
122+TEST_F(StoreScopeTest, testDownloadFailed)
123+{
124+ auto activation = scope.perform_action(result, metadata, "widget_id",
125+ click::Preview::Actions::DOWNLOAD_FAILED);
126+ auto response = activation->activate();
127+ EXPECT_TRUE(response.scope_data().get_dict()[click::Preview::Actions::DOWNLOAD_FAILED].get_bool());
128+}
129+
130+TEST_F(StoreScopeTest, testDownloadCompleted)
131+{
132+ auto activation = scope.perform_action(result, metadata, "widget_id",
133+ click::Preview::Actions::DOWNLOAD_COMPLETED);
134+ auto response = activation->activate();
135+ EXPECT_TRUE(response.scope_data().get_dict()[click::Preview::Actions::DOWNLOAD_COMPLETED].get_bool());
136+ EXPECT_TRUE(response.scope_data().get_dict()["installed"].get_bool());
137+}
138+
139+TEST_F(StoreScopeTest, testCancelPurchaseInstalled)
140+{
141+ auto activation = scope.perform_action(result, metadata, "widget_id",
142+ click::Preview::Actions::CANCEL_PURCHASE_INSTALLED);
143+ auto response = activation->activate();
144+ EXPECT_TRUE(response.scope_data().get_dict()[click::Preview::Actions::CANCEL_PURCHASE_INSTALLED].get_bool());
145+}
146+
147+TEST_F(StoreScopeTest, testCancelPurchaseUninstalled)
148+{
149+ auto activation = scope.perform_action(result, metadata, "widget_id",
150+ click::Preview::Actions::CANCEL_PURCHASE_UNINSTALLED);
151+ auto response = activation->activate();
152+ EXPECT_TRUE(response.scope_data().get_dict()[click::Preview::Actions::CANCEL_PURCHASE_UNINSTALLED].get_bool());
153+}
154+
155+TEST_F(StoreScopeTest, testUninstallClick)
156+{
157+ auto activation = scope.perform_action(result, metadata, "widget_id",
158+ click::Preview::Actions::UNINSTALL_CLICK);
159+ auto response = activation->activate();
160+ EXPECT_TRUE(response.scope_data().get_dict()[click::Preview::Actions::UNINSTALL_CLICK].get_bool());
161+}
162+
163+TEST_F(StoreScopeTest, testShowUninstalled)
164+{
165+ auto activation = scope.perform_action(result, metadata, "widget_id",
166+ click::Preview::Actions::SHOW_UNINSTALLED);
167+ auto response = activation->activate();
168+ EXPECT_TRUE(response.scope_data().get_dict()[click::Preview::Actions::SHOW_UNINSTALLED].get_bool());
169+}
170+
171+TEST_F(StoreScopeTest, testShowInstalled)
172+{
173+ auto activation = scope.perform_action(result, metadata, "widget_id",
174+ click::Preview::Actions::SHOW_INSTALLED);
175+ auto response = activation->activate();
176+ EXPECT_TRUE(response.scope_data().get_dict()[click::Preview::Actions::SHOW_INSTALLED].get_bool());
177+}
178+
179+TEST_F(StoreScopeTest, testConfirmUninstall)
180+{
181+ auto activation = scope.perform_action(result, metadata, "widget_id",
182+ click::Preview::Actions::CONFIRM_UNINSTALL);
183+ auto response = activation->activate();
184+ EXPECT_TRUE(response.scope_data().get_dict()[click::Preview::Actions::CONFIRM_UNINSTALL].get_bool());
185+}
186+
187+TEST_F(StoreScopeTest, testConfirmCancelPurchaseUninstalled)
188+{
189+ auto activation = scope.perform_action(result, metadata, "widget_id",
190+ click::Preview::Actions::CONFIRM_CANCEL_PURCHASE_UNINSTALLED);
191+ auto response = activation->activate();
192+ EXPECT_TRUE(response.scope_data().get_dict()[click::Preview::Actions::CONFIRM_CANCEL_PURCHASE_UNINSTALLED].get_bool());
193+}
194+
195+TEST_F(StoreScopeTest, testConfirmCancelPurcahseInstalled)
196+{
197+ auto activation = scope.perform_action(result, metadata, "widget_id",
198+ click::Preview::Actions::CONFIRM_CANCEL_PURCHASE_INSTALLED);
199+ auto response = activation->activate();
200+ EXPECT_TRUE(response.scope_data().get_dict()[click::Preview::Actions::CONFIRM_CANCEL_PURCHASE_INSTALLED].get_bool());
201+}
202+
203 TEST_F(StoreScopeTest, testStoreScopeRatingNew)
204 {
205- auto activation = scope.perform_action(result, metadata, "rating", click::Preview::Actions::RATED);
206+ auto activation = scope.perform_action(result, metadata, "rating",
207+ click::Preview::Actions::RATED);
208 auto response = activation->activate();
209 EXPECT_EQ("rating", response.scope_data().get_dict()["widget_id"].get_string());
210 }
211
212 TEST_F(StoreScopeTest, testStoreScopeRatingEdit)
213 {
214- auto activation = scope.perform_action(result, metadata, "93345", click::Preview::Actions::RATED);
215+ auto activation = scope.perform_action(result, metadata, "93345",
216+ click::Preview::Actions::RATED);
217 auto response = activation->activate();
218 EXPECT_EQ("93345", response.scope_data().get_dict()["widget_id"].get_string());
219 }

Subscribers

People subscribed via source and target branches

to all changes: