Merge lp:~alecu/unity-scope-click/sequential-install-uninstall into lp:unity-scope-click

Proposed by Alejandro J. Cura
Status: Merged
Approved by: Alejandro J. Cura
Approved revision: 308
Merged at revision: 306
Proposed branch: lp:~alecu/unity-scope-click/sequential-install-uninstall
Merge into: lp:unity-scope-click
Diff against target: 107 lines (+45/-0)
6 files modified
libclickscope/click/package.cpp (+1/-0)
libclickscope/click/package.h (+1/-0)
libclickscope/tests/fake_json.cpp (+1/-0)
libclickscope/tests/test_package.cpp (+11/-0)
scope/clickstore/store-query.cpp (+1/-0)
scope/tests/test_query.cpp (+30/-0)
To merge this branch: bzr merge lp:~alecu/unity-scope-click/sequential-install-uninstall
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
dobey (community) Approve
Review via email: mp+247007@code.launchpad.net

Commit message

Put the store version in the result, to be used if uninstalling just after installing

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libclickscope/click/package.cpp'
2--- libclickscope/click/package.cpp 2014-09-30 23:33:40 +0000
3+++ libclickscope/click/package.cpp 2015-01-20 17:05:11 +0000
4@@ -93,6 +93,7 @@
5 p.content = item[Package::JsonKeys::content].asString();
6 p.publisher = item[Package::JsonKeys::publisher].asString();
7 p.rating = item[Package::JsonKeys::rating].asDouble();
8+ p.version = item[Package::JsonKeys::version].asString();
9 return p;
10 }
11
12
13=== modified file 'libclickscope/click/package.h'
14--- libclickscope/click/package.h 2014-09-30 21:17:53 +0000
15+++ libclickscope/click/package.h 2015-01-20 17:05:11 +0000
16@@ -63,6 +63,7 @@
17 constexpr static const char* content{"content"};
18 constexpr static const char* publisher{"publisher"};
19 constexpr static const char* rating{"ratings_average"};
20+ constexpr static const char* version{"version"};
21
22 // NOTE: The "price" field is deprecated in favor of "prices"
23 constexpr static const char* prices{"prices"};
24
25=== modified file 'libclickscope/tests/fake_json.cpp'
26--- libclickscope/tests/fake_json.cpp 2014-10-07 13:37:51 +0000
27+++ libclickscope/tests/fake_json.cpp 2015-01-20 17:05:11 +0000
28@@ -56,6 +56,7 @@
29 {
30 "name": "org.example.awesomelauncher",
31 "title": "Awesome Launcher",
32+ "version": "0.83b",
33 "description": "This is an awesome launcher.",
34 "price": 1.99,
35 "icon_url": "http://software-center.ubuntu.com/site_media/appmedia/2012/09/SPAZ.png",
36
37=== modified file 'libclickscope/tests/test_package.cpp'
38--- libclickscope/tests/test_package.cpp 2014-09-30 23:33:40 +0000
39+++ libclickscope/tests/test_package.cpp 2015-01-20 17:05:11 +0000
40@@ -95,6 +95,17 @@
41 ASSERT_EQ(3, pl[0].prices.size());
42 }
43
44+TEST_F(PackageTest, testPackageParsesVersion)
45+{
46+ Json::Value root;
47+ Json::Reader().parse(FAKE_JSON_SEARCH_RESULT_ONE, root);
48+ auto const embedded = root[Package::JsonKeys::embedded];
49+ auto const ci_package = embedded[Package::JsonKeys::ci_package];
50+
51+ Packages pl = package_list_from_json_node(ci_package);
52+ ASSERT_EQ("0.83b", pl[0].version);
53+}
54+
55 TEST_F(PackageTest, testPackageDetailsParsesMultiplePrices)
56 {
57 auto details = PackageDetails::from_json(FAKE_JSON_PACKAGE_DETAILS);
58
59=== modified file 'scope/clickstore/store-query.cpp'
60--- scope/clickstore/store-query.cpp 2014-12-04 11:53:36 +0000
61+++ scope/clickstore/store-query.cpp 2015-01-20 17:05:11 +0000
62@@ -305,6 +305,7 @@
63 cur_price = pkg.price;
64 }
65 res["price"] = scopes::Variant(cur_price);
66+ res[click::Query::ResultKeys::VERSION] = pkg.version;
67
68 if (cur_price > 0.00f) {
69 if (!Configuration::get_purchases_enabled()) {
70
71=== modified file 'scope/tests/test_query.cpp'
72--- scope/tests/test_query.cpp 2014-11-17 16:20:57 +0000
73+++ scope/tests/test_query.cpp 2015-01-20 17:05:11 +0000
74@@ -600,3 +600,33 @@
75 ASSERT_EQ(unsetenv(Configuration::CURRENCY_ENVVAR), 0);
76 ASSERT_EQ(unsetenv(Configuration::PURCHASES_ENVVAR), 0);
77 }
78+
79+MATCHER_P(HasVersion, v, "") { return arg[click::Query::ResultKeys::VERSION].get_string() == v; }
80+
81+TEST(QueryTest, testPushPackagePushesVersion)
82+{
83+ auto const fake_version = "0.83b";
84+ click::Packages packages {
85+ {"org.example.app1", "app title1", 0.0, "icon", "uri", fake_version, "scope"},
86+ };
87+ MockIndex mock_index(packages);
88+ scopes::SearchMetadata metadata("en_EN", "phone");
89+ PackageSet no_installed_packages;
90+ click::DepartmentLookup dept_lookup;
91+ click::HighlightList highlights;
92+ MockPayPackage pay_pkg;
93+ const unity::scopes::CannedQuery query("foo.scope", FAKE_QUERY, "");
94+ MockQuery q(query, mock_index, dept_lookup, nullptr, highlights, metadata, pay_pkg);
95+ EXPECT_CALL(mock_index, do_search(FAKE_QUERY, _));
96+
97+ scopes::CategoryRenderer renderer("{}");
98+ auto ptrCat = std::make_shared<FakeCategory>("id", "", "", renderer);
99+ EXPECT_CALL(q, register_category(_, _, _, _, _)).Times(2).WillRepeatedly(Return(ptrCat));
100+
101+ scopes::testing::MockSearchReply mock_reply;
102+ scopes::SearchReplyProxy reply(&mock_reply, [](unity::scopes::SearchReply*){});
103+ EXPECT_CALL(q, push_result(_, HasVersion(fake_version)));
104+ EXPECT_CALL(q, finished(_)).Times(1);
105+ q.wrap_add_available_apps(reply, no_installed_packages, FAKE_CATEGORY_TEMPLATE);
106+}
107+

Subscribers

People subscribed via source and target branches