529
529
ASSERT_EQ(unsetenv(Configuration::PURCHASES_ENVVAR), 0);
532
MATCHER_P(HasAttributes, b, "") { return !arg["attributes"].is_null() == b; }
534
TEST(QueryTest, testPushPackagePushesAttributes)
536
click::Packages packages {
537
{"org.example.app1", "app title1", 0.0, "icon", "uri"},
539
MockIndex mock_index(packages);
540
scopes::SearchMetadata metadata("en_EN", "phone");
541
PackageSet no_installed_packages;
542
click::DepartmentLookup dept_lookup;
543
click::HighlightList highlights;
544
MockPayPackage pay_pkg;
545
const unity::scopes::CannedQuery query("foo.scope", FAKE_QUERY, "");
546
MockQuery q(query, mock_index, dept_lookup, nullptr, highlights, metadata, pay_pkg);
547
EXPECT_CALL(mock_index, do_search(FAKE_QUERY, _));
549
scopes::CategoryRenderer renderer("{}");
550
auto ptrCat = std::make_shared<FakeCategory>("id", "", "", renderer);
551
EXPECT_CALL(q, register_category(_, _, _, _, _)).Times(2).WillRepeatedly(Return(ptrCat));
553
scopes::testing::MockSearchReply mock_reply;
554
scopes::SearchReplyProxy reply(&mock_reply, [](unity::scopes::SearchReply*){});
555
EXPECT_CALL(q, push_result(_, HasAttributes(true)));
556
q.wrap_add_available_apps(reply, no_installed_packages, FAKE_CATEGORY_TEMPLATE);