Merge lp:~stolowski/unity-scope-click/fake-json-cpp into lp:unity-scope-click/devel

Proposed by Paweł Stołowski
Status: Merged
Approved by: Alejandro J. Cura
Approved revision: 322
Merged at revision: 322
Proposed branch: lp:~stolowski/unity-scope-click/fake-json-cpp
Merge into: lp:unity-scope-click/devel
Diff against target: 1263 lines (+643/-595)
3 files modified
libclickscope/tests/CMakeLists.txt (+1/-1)
libclickscope/tests/fake_json.cpp (+626/-0)
libclickscope/tests/fake_json.h (+16/-594)
To merge this branch: bzr merge lp:~stolowski/unity-scope-click/fake-json-cpp
Reviewer Review Type Date Requested Status
Alejandro J. Cura (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+226423@code.launchpad.net

Commit message

Moved fake json strings into a cpp file.

Description of the change

Moved fake json strings into a cpp file. This speeds compilation a little bit when modifying any of these strings and recompiling (without that change, any update to fake_json.h triggered recompilation of a number of test files that included it).

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
Alejandro J. Cura (alecu) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libclickscope/tests/CMakeLists.txt'
2--- libclickscope/tests/CMakeLists.txt 2014-06-26 17:52:31 +0000
3+++ libclickscope/tests/CMakeLists.txt 2014-07-11 09:18:16 +0000
4@@ -20,7 +20,7 @@
5 mock_network_access_manager.h
6 mock_ubuntuone_credentials.h
7 mock_webclient.h
8-
9+ fake_json.cpp
10 test_bootstrap.cpp
11 test_configuration.cpp
12 test_departments.cpp
13
14=== added file 'libclickscope/tests/fake_json.cpp'
15--- libclickscope/tests/fake_json.cpp 1970-01-01 00:00:00 +0000
16+++ libclickscope/tests/fake_json.cpp 2014-07-11 09:18:16 +0000
17@@ -0,0 +1,626 @@
18+/*
19+ * Copyright (C) 2014 Canonical Ltd.
20+ *
21+ * This program is free software: you can redistribute it and/or modify it
22+ * under the terms of the GNU General Public License version 3, as published
23+ * by the Free Software Foundation.
24+ *
25+ * This program is distributed in the hope that it will be useful, but
26+ * WITHOUT ANY WARRANTY; without even the implied warranties of
27+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
28+ * PURPOSE. See the GNU General Public License for more details.
29+ *
30+ * You should have received a copy of the GNU General Public License along
31+ * with this program. If not, see <http://www.gnu.org/licenses/>.
32+ *
33+ * In addition, as a special exception, the copyright holders give
34+ * permission to link the code of portions of this program with the
35+ * OpenSSL library under certain conditions as described in each
36+ * individual source file, and distribute linked combinations
37+ * including the two.
38+ * You must obey the GNU General Public License in all respects
39+ * for all of the code used other than OpenSSL. If you modify
40+ * file(s) with this exception, you may extend this exception to your
41+ * version of the file(s), but you are not obligated to do so. If you
42+ * do not wish to do so, delete this exception statement from your
43+ * version. If you delete this exception statement from all source
44+ * files in the program, then also delete it here.
45+ */
46+
47+#include "fake_json.h"
48+
49+const std::string FAKE_JSON_REVIEWS_RESULT_ONE = R"foo(
50+ [
51+ {
52+ "date_created": "2014-01-28T09:09:47.218Z",
53+ "date_deleted": null,
54+ "hide": false,
55+ "id": 1,
56+ "language": "en",
57+ "package_name": "com.example.fakepackage",
58+ "rating": 4,
59+ "review_text": "It is ok.",
60+ "reviewer_displayname": "Reviewer",
61+ "reviewer_username": "reviewer",
62+ "summary": "Review Summary",
63+ "usefulness_favorable": 0,
64+ "usefulness_total": 0,
65+ "version": "0.2"
66+ }
67+ ]
68+)foo";
69+
70+const std::string FAKE_JSON_SEARCH_RESULT_ONE = R"foo({
71+ "_embedded": {
72+ "clickindex:package": [
73+ {
74+ "name": "org.example.awesomelauncher",
75+ "title": "Awesome Launcher",
76+ "description": "This is an awesome launcher.",
77+ "price": 1.99,
78+ "icon_url": "http://software-center.ubuntu.com/site_media/appmedia/2012/09/SPAZ.png",
79+ "_links": {
80+ "self": {
81+ "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher"
82+ }
83+ }
84+ }
85+ ]
86+ }
87+ }
88+)foo";
89+
90+const std::string FAKE_JSON_SEARCH_RESULT_MISSING_DATA = R"foo({
91+ "_embedded": {
92+ "clickindex:package": [
93+ {
94+ "name": "org.example.awesomelauncher",
95+ "title": "Awesome Launcher",
96+ "description": "This is an awesome launcher.",
97+ "_links": {
98+ "self": {
99+ "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher"
100+ }
101+ }
102+ }
103+ ]
104+ }
105+ }
106+)foo";
107+
108+const std::string FAKE_JSON_SEARCH_RESULT_MANY = R"foo({
109+ "_embedded": {
110+ "clickindex:package": [
111+ {
112+ "name": "org.example.awesomelauncher",
113+ "title": "Awesome Launcher",
114+ "description": "This is an awesome launcher.",
115+ "price": 1.99,
116+ "icon_url": "http://software-center.ubuntu.com/site_media/appmedia/2012/09/SPAZ.png",
117+ "_links": {
118+ "self": {
119+ "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher"
120+ }
121+ }
122+ },
123+ {
124+ "name": "org.example.fantastiqueapp",
125+ "title": "Fantastic App",
126+ "description": "This is a fantasticc app.",
127+ "price": 0.0,
128+ "icon_url": "http://assets.ubuntu.com/sites/ubuntu/504/u/img/ubuntu/features/icon-find-more-apps-64x64.png",
129+ "_links": {
130+ "self": {
131+ "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.fantasticapp"
132+ }
133+ }
134+ },
135+ {
136+ "name": "org.example.awesomewidget",
137+ "title": "Awesome Widget",
138+ "description": "This is an awesome widget.",
139+ "price": 1.99,
140+ "icon_url": "http://assets.ubuntu.com/sites/ubuntu/504/u/img/ubuntu/features/icon-photos-and-videos-64x64.png",
141+ "_links": {
142+ "self": {
143+ "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomewidget"
144+ }
145+ }
146+ }
147+ ]
148+ }
149+ }
150+)foo";
151+
152+const std::string FAKE_JSON_SEARCH_RESULT_RECOMMENDS = R"foo({
153+ "_embedded": {
154+ "clickindex:package": [
155+ {
156+ "name": "org.example.awesomelauncher",
157+ "title": "Awesome Launcher",
158+ "description": "This is an awesome launcher.",
159+ "price": 1.99,
160+ "icon_url": "http://software-center.ubuntu.com/site_media/appmedia/2012/09/SPAZ.png",
161+ "_links": {
162+ "self": {
163+ "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher"
164+ }
165+ }
166+ }
167+ ],
168+ "clickindex:recommendation": [
169+ {
170+ "name": "org.example.awesomelauncher2",
171+ "title": "Awesome Launcher 2",
172+ "description": "This is an another awesome launcher.",
173+ "price": 1.99,
174+ "icon_url": "http://software-center.ubuntu.com/site_media/appmedia/2012/09/SPAZ.png",
175+ "_links": {
176+ "self": {
177+ "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher2"
178+ }
179+ }
180+ }
181+ ]
182+ }
183+ }
184+)foo";
185+
186+const std::string FAKE_JSON_PACKAGE_DETAILS = R"foo(
187+ {
188+ "name": "ar.com.beuno.wheather-touch",
189+ "icon_url": "http://developer.staging.ubuntu.com/site_media/appmedia/2013/07/weather-icone-6797-64.png",
190+ "title": "\u1F4A9 Weather",
191+ "description": "\u1F4A9 Weather\nA weather application.",
192+ "download_url": "https://public.apps.staging.ubuntu.com/download/ar.com.beuno/wheather-touch/ar.com.beuno.wheather-touch-0.2",
193+ "rating": 3.5,
194+ "keywords": "these, are, key, words",
195+ "terms_of_service": "tos",
196+ "license": "Proprietary",
197+ "publisher": "Beuno",
198+ "screenshot_url": "sshot0",
199+ "screenshot_urls": ["sshot1", "sshot2"],
200+ "binary_filesize": 177582,
201+ "version": "0.2",
202+ "framework": "None",
203+
204+ "website": "",
205+ "support_url": "http://beuno.com.ar",
206+ "price": 1.99,
207+ "license_key_path": "",
208+ "click_version": "0.1",
209+ "company_name": "",
210+ "icon_urls": {
211+ "64": "http://developer.staging.ubuntu.com/site_media/appmedia/2013/07/weather-icone-6797-64.png"
212+ },
213+ "requires_license_key": false,
214+ "date_published": "2013-07-16T21:50:34.874000"
215+ }
216+)foo";
217+
218+const std::string FAKE_JSON_BOOTSTRAP = R"(
219+ {
220+ "_embedded": {
221+ "clickindex:department": [
222+ {
223+ "has_children": false,
224+ "_links": {
225+ "self": {
226+ "href": "https://search.apps.staging.ubuntu.com/api/v1/departments/fake-subdepartment"}
227+ },
228+ "name": "Fake Subdepartment", "slug": "fake-subdepartment"}
229+ ],
230+ "clickindex:highlight": [
231+ {
232+ "_embedded": {
233+ "clickindex:package": [
234+ {
235+ "publisher": "Awesome Widget Company",
236+ "name": "org.example.awesomelauncher",
237+ "title": "Awesome Launcher",
238+ "price": 1.99,
239+ "_links": {
240+ "self": {
241+ "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomelauncher"}
242+ },
243+ "icon": "http://example.org/media/org.example.awesomelauncher/icons/icon16.png"
244+ },
245+ {
246+ "publisher": "Awesome Widget Company",
247+ "name": "org.example.awesomewidget",
248+ "title": "Awesome Widget", "price": 1.99,
249+ "_links": {
250+ "self": {
251+ "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomewidget"
252+ }
253+ },
254+ "icon": "http://example.org/media/org.example.awesomewidget/icons/icon16.png"}
255+ ]
256+ },
257+ "_links": {
258+ "self": {
259+ "href": "https://search.apps.staging.ubuntu.com/api/v1/highlights/top-apps"
260+ }
261+ },
262+ "name": "Top Apps", "slug": "top-apps"
263+ },
264+ {
265+ "_embedded": {
266+ "clickindex:package": [
267+ {
268+ "publisher": "Awesome Widget Company",
269+ "name": "org.example.awesomelauncher",
270+ "title": "Awesome Launcher",
271+ "price": 1.99,
272+ "_links": {
273+ "self": {
274+ "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomelauncher"
275+ }
276+ },
277+ "icon": "http://example.org/media/org.example.awesomelauncher/icons/icon16.png"
278+ },
279+ {
280+ "publisher": "Awesome Widget Company",
281+ "name": "org.example.awesomewidget",
282+ "title": "Awesome Widget",
283+ "price": 1.99,
284+ "_links": {
285+ "self": {
286+ "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomewidget"
287+ }
288+ },
289+ "icon": "http://example.org/media/org.example.awesomewidget/icons/icon16.png"
290+ }
291+ ]
292+ },
293+ "_links": {
294+ "self": {
295+ "href": "https://search.apps.staging.ubuntu.com/api/v1/highlights/most-purchased"
296+ }
297+ },
298+ "name": "Most Purchased",
299+ "slug": "most-purchased"
300+ },
301+ {
302+ "_embedded": {
303+ "clickindex:package": [
304+ {
305+ "publisher": "Awesome Widget Company",
306+ "name": "org.example.awesomelauncher",
307+ "title": "Awesome Launcher",
308+ "price": 1.99,
309+ "_links": {
310+ "self": {
311+ "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomelauncher"
312+ }
313+ },
314+ "icon": "http://example.org/media/org.example.awesomelauncher/icons/icon16.png"
315+ },
316+ {
317+ "publisher": "Awesome Widget Company",
318+ "name": "org.example.awesomewidget",
319+ "title": "Awesome Widget",
320+ "price": 1.99,
321+ "_links": {
322+ "self": {
323+ "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomewidget"
324+ }
325+ },
326+ "icon": "http://example.org/media/org.example.awesomewidget/icons/icon16.png"
327+ }
328+ ]
329+ },
330+ "_links": {
331+ "self": {
332+ "href": "https://search.apps.staging.ubuntu.com/api/v1/highlights/new-releases"
333+ }
334+ },
335+ "name": "New Releases",
336+ "slug": "new-releases"
337+ }
338+ ]
339+ }, "has_children": true,
340+ "_links": {
341+ "curies": [
342+ {
343+ "href": "https://search.apps.staging.ubuntu.com/docs/v1/relations.html{#rel}",
344+ "name": "clickindex", "templated": true
345+ }
346+ ],
347+ "self": {
348+ "href": "https://search.apps.staging.ubuntu.com/api/v1/departments/fake-department-with-subdepartments"
349+ },
350+ "collection": {
351+ "href": "https://search.apps.staging.ubuntu.com/api/v1/departments"
352+ }
353+ },
354+ "name": "Fake Department With Subdepartments",
355+ "slug": "fake-department-with-subdepartments"
356+ })";
357+
358+const std::string FAKE_JSON_BROKEN_BOOTSTRAP = R"(
359+ {
360+ "_embedded": {
361+ "clickindex:department": [
362+ {
363+ "name": "Broken department"
364+ }
365+ ],
366+ "clickindex:highlight": [
367+ {
368+ "_embedded": {
369+ "clickindex:package": [
370+ {
371+ "publisher": "Awesome Widget Company",
372+ "name": "org.example.awesomelauncher",
373+ "title": "Awesome Launcher",
374+ "price": 1.99,
375+ "_links": {
376+ "self": {
377+ "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomelauncher"}
378+ },
379+ "icon": "http://example.org/media/org.example.awesomelauncher/icons/icon16.png"
380+ }
381+ ]
382+ },
383+ "_links": {
384+ "self": {
385+ "href": "https://search.apps.staging.ubuntu.com/api/v1/highlights/top-apps"
386+ }
387+ },
388+ "name": "Top Apps",
389+ "slug": "top-apps"
390+ },
391+ {
392+ "_embedded": {
393+ "clickindex:package": [
394+ {
395+ "publisher": "Awesome Widget Company",
396+ "name": "org.example.awesomelauncher",
397+ "title": "Awesome Launcher",
398+ "price": 1.99,
399+ "_links": {
400+ "self": {
401+ "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomelauncher"
402+ }
403+ },
404+ "icon": "http://example.org/media/org.example.awesomelauncher/icons/icon16.png"
405+ }
406+ ]
407+ },
408+ "____name": "Broken highlight"
409+ }
410+ ]
411+ }
412+ })";
413+
414+const std::string FAKE_JSON_DEPARTMENTS_ONLY = R"(
415+ {
416+ "_links": {
417+ "self": {
418+ "href": "https://search.apps.ubuntu.com/api/v1/departments"
419+ },
420+ "curies": [
421+ {
422+ "name": "clickindex",
423+ "href": "https://search.apps.ubuntu.com/docs/v1/relations.html{#rel}",
424+ "templated": true
425+ }
426+ ]
427+ },
428+ "_embedded": {
429+ "clickindex:department": [
430+ {
431+ "name": "Games",
432+ "_links": {
433+ "self": {
434+ "href": "https://search.apps.ubuntu.com/api/v1/departments/Games"
435+ }
436+ },
437+ "_embedded": {
438+ "clickindex:department": [
439+ {
440+ "name": "Board Games",
441+ "_links": {
442+ "self": {
443+ "href": "https://search.apps.ubuntu.com/api/v1/departments/Games/Board+Games"
444+ }
445+ }
446+ }
447+ ]
448+ }
449+ },
450+ {
451+ "name": "Graphics",
452+ "_links": {
453+ "self": {
454+ "href": "https://search.apps.ubuntu.com/api/v1/departments/Graphics"
455+ }
456+ },
457+ "_embedded": {
458+ "clickindex:department": [
459+ {
460+ "name": "Drawing",
461+ "_links": {
462+ "self": {
463+ "href": "https://search.apps.ubuntu.com/api/v1/departments/Graphics/Drawing"
464+ }
465+ }
466+ }
467+ ]
468+ }
469+ },
470+ {
471+ "name": "Internet",
472+ "_links": {
473+ "self": {
474+ "href": "https://search.apps.ubuntu.com/api/v1/departments/Internet"
475+ }
476+ },
477+ "_embedded": {
478+ "clickindex:department": [
479+ {
480+ "name": "Chat",
481+ "_links": {
482+ "self": {
483+ "href": "https://search.apps.ubuntu.com/api/v1/departments/Internet/Chat"
484+ }
485+ }
486+ },
487+ {
488+ "name": "Mail",
489+ "_links": {
490+ "self": {
491+ "href": "https://search.apps.ubuntu.com/api/v1/departments/Internet/Mail"
492+ }
493+ }
494+ },
495+ {
496+ "name": "Web Browsers",
497+ "_links": {
498+ "self": {
499+ "href": "https://search.apps.ubuntu.com/api/v1/departments/Internet/Web+Browsers"
500+ }
501+ }
502+ }
503+ ]
504+ }
505+ }
506+ ]
507+ }
508+})";
509+
510+const std::string FAKE_JSON_BROKEN_DEPARTMENTS = R"(
511+ {
512+ "_links": {
513+ "self": {
514+ "href": "https://search.apps.ubuntu.com/api/v1/departments"
515+ },
516+ "curies": [
517+ {
518+ "name": "clickindex",
519+ "href": "https://search.apps.ubuntu.com/docs/v1/relations.html{#rel}",
520+ "templated": true
521+ }
522+ ]
523+ },
524+ "_embedded": {
525+ "clickindex:department": [
526+ {
527+ "name": "Games",
528+ "_links": {
529+ "self": {
530+ "href": "https://search.apps.ubuntu.com/api/v1/departments/Games"
531+ }
532+ },
533+ "_embedded": {
534+ "clickindex:department": [
535+ {
536+ "name": "Broken department"
537+ }
538+ ]
539+ }
540+ }
541+ ]
542+ }
543+ })";
544+
545+const std::string FAKE_JSON_MANIFEST_REMOVABLE = R"foo(
546+ {
547+ "_removable": 1,
548+ "name": "com.example.fake",
549+ "version": "0.1",
550+ "hooks": {
551+ "fake-app": {
552+ "desktop": "fake-app.desktop"
553+ }
554+ }
555+ }
556+)foo";
557+
558+const std::string FAKE_JSON_MANIFEST_NONREMOVABLE = R"foo(
559+ {
560+ "_removable": 0,
561+ "name": "com.example.fake",
562+ "version": "0.1",
563+ "hooks": {
564+ "fake-app": {
565+ "desktop": "fake-app.desktop"
566+ }
567+ }
568+ }
569+)foo";
570+
571+const std::string FAKE_JSON_MANIFEST_ONE_APP = R"foo(
572+ {
573+ "_removable": 1,
574+ "name": "com.example.fake-app",
575+ "version": "0.1",
576+ "hooks": {
577+ "fake-app": {
578+ "apparmor": "fake-app.json",
579+ "desktop": "fake-app.desktop"
580+ }
581+ }
582+ }
583+)foo";
584+
585+const std::string FAKE_JSON_MANIFEST_ONE_SCOPE = R"foo(
586+ {
587+ "_removable": 1,
588+ "name": "com.example.fake-scope",
589+ "version": "0.1",
590+ "hooks": {
591+ "fake-scope": {
592+ "apparmor": "scope-security.json",
593+ "scope": "fake-scope"
594+ }
595+ }
596+ }
597+)foo";
598+
599+const std::string FAKE_JSON_MANIFEST_ONE_APP_ONE_SCOPE = R"foo(
600+ {
601+ "_removable": 1,
602+ "name": "com.example.fake-1app-1scope",
603+ "version": "0.1",
604+ "hooks": {
605+ "fake-app": {
606+ "apparmor": "fake-app.json",
607+ "desktop": "fake-app.desktop"
608+ },
609+ "fake-scope": {
610+ "apparmor": "scope-security.json",
611+ "scope": "fake-scope"
612+ }
613+ }
614+ }
615+)foo";
616+
617+const std::string FAKE_JSON_MANIFEST_TWO_APPS_TWO_SCOPES = R"foo(
618+ {
619+ "_removable": 1,
620+ "name": "com.example.fake-2apps-2scopes",
621+ "version": "0.1",
622+ "hooks": {
623+ "fake-app1": {
624+ "apparmor": "fake-app1.json",
625+ "desktop": "fake-app1.desktop"
626+ },
627+ "fake-app2": {
628+ "apparmor": "fake-app2.json",
629+ "desktop": "fake-app2.desktop"
630+ },
631+ "fake-scope1": {
632+ "apparmor": "scope-security1.json",
633+ "scope": "fake-scope1"
634+ },
635+ "fake-scope2": {
636+ "apparmor": "scope-security1.json",
637+ "scope": "fake-scope2"
638+ }
639+ }
640+ }
641+)foo";
642+
643+
644
645=== modified file 'libclickscope/tests/fake_json.h'
646--- libclickscope/tests/fake_json.h 2014-06-26 17:52:31 +0000
647+++ libclickscope/tests/fake_json.h 2014-07-11 09:18:16 +0000
648@@ -32,599 +32,21 @@
649
650 #include <string>
651
652-
653-const std::string FAKE_JSON_REVIEWS_RESULT_ONE = R"foo(
654- [
655- {
656- "date_created": "2014-01-28T09:09:47.218Z",
657- "date_deleted": null,
658- "hide": false,
659- "id": 1,
660- "language": "en",
661- "package_name": "com.example.fakepackage",
662- "rating": 4,
663- "review_text": "It is ok.",
664- "reviewer_displayname": "Reviewer",
665- "reviewer_username": "reviewer",
666- "summary": "Review Summary",
667- "usefulness_favorable": 0,
668- "usefulness_total": 0,
669- "version": "0.2"
670- }
671- ]
672-)foo";
673-
674-const std::string FAKE_JSON_SEARCH_RESULT_ONE = R"foo({
675- "_embedded": {
676- "clickindex:package": [
677- {
678- "name": "org.example.awesomelauncher",
679- "title": "Awesome Launcher",
680- "description": "This is an awesome launcher.",
681- "price": 1.99,
682- "icon_url": "http://software-center.ubuntu.com/site_media/appmedia/2012/09/SPAZ.png",
683- "_links": {
684- "self": {
685- "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher"
686- }
687- }
688- }
689- ]
690- }
691- }
692-)foo";
693-
694-const std::string FAKE_JSON_SEARCH_RESULT_MISSING_DATA = R"foo({
695- "_embedded": {
696- "clickindex:package": [
697- {
698- "name": "org.example.awesomelauncher",
699- "title": "Awesome Launcher",
700- "description": "This is an awesome launcher.",
701- "_links": {
702- "self": {
703- "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher"
704- }
705- }
706- }
707- ]
708- }
709- }
710-)foo";
711-
712-const std::string FAKE_JSON_SEARCH_RESULT_MANY = R"foo({
713- "_embedded": {
714- "clickindex:package": [
715- {
716- "name": "org.example.awesomelauncher",
717- "title": "Awesome Launcher",
718- "description": "This is an awesome launcher.",
719- "price": 1.99,
720- "icon_url": "http://software-center.ubuntu.com/site_media/appmedia/2012/09/SPAZ.png",
721- "_links": {
722- "self": {
723- "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher"
724- }
725- }
726- },
727- {
728- "name": "org.example.fantastiqueapp",
729- "title": "Fantastic App",
730- "description": "This is a fantasticc app.",
731- "price": 0.0,
732- "icon_url": "http://assets.ubuntu.com/sites/ubuntu/504/u/img/ubuntu/features/icon-find-more-apps-64x64.png",
733- "_links": {
734- "self": {
735- "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.fantasticapp"
736- }
737- }
738- },
739- {
740- "name": "org.example.awesomewidget",
741- "title": "Awesome Widget",
742- "description": "This is an awesome widget.",
743- "price": 1.99,
744- "icon_url": "http://assets.ubuntu.com/sites/ubuntu/504/u/img/ubuntu/features/icon-photos-and-videos-64x64.png",
745- "_links": {
746- "self": {
747- "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomewidget"
748- }
749- }
750- }
751- ]
752- }
753- }
754-)foo";
755-
756-const std::string FAKE_JSON_SEARCH_RESULT_RECOMMENDS = R"foo({
757- "_embedded": {
758- "clickindex:package": [
759- {
760- "name": "org.example.awesomelauncher",
761- "title": "Awesome Launcher",
762- "description": "This is an awesome launcher.",
763- "price": 1.99,
764- "icon_url": "http://software-center.ubuntu.com/site_media/appmedia/2012/09/SPAZ.png",
765- "_links": {
766- "self": {
767- "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher"
768- }
769- }
770- }
771- ],
772- "clickindex:recommendation": [
773- {
774- "name": "org.example.awesomelauncher2",
775- "title": "Awesome Launcher 2",
776- "description": "This is an another awesome launcher.",
777- "price": 1.99,
778- "icon_url": "http://software-center.ubuntu.com/site_media/appmedia/2012/09/SPAZ.png",
779- "_links": {
780- "self": {
781- "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher2"
782- }
783- }
784- }
785- ]
786- }
787- }
788-)foo";
789-
790-const std::string FAKE_JSON_PACKAGE_DETAILS = R"foo(
791- {
792- "name": "ar.com.beuno.wheather-touch",
793- "icon_url": "http://developer.staging.ubuntu.com/site_media/appmedia/2013/07/weather-icone-6797-64.png",
794- "title": "\u1F4A9 Weather",
795- "description": "\u1F4A9 Weather\nA weather application.",
796- "download_url": "https://public.apps.staging.ubuntu.com/download/ar.com.beuno/wheather-touch/ar.com.beuno.wheather-touch-0.2",
797- "rating": 3.5,
798- "keywords": "these, are, key, words",
799- "terms_of_service": "tos",
800- "license": "Proprietary",
801- "publisher": "Beuno",
802- "screenshot_url": "sshot0",
803- "screenshot_urls": ["sshot1", "sshot2"],
804- "binary_filesize": 177582,
805- "version": "0.2",
806- "framework": "None",
807-
808- "website": "",
809- "support_url": "http://beuno.com.ar",
810- "price": 1.99,
811- "license_key_path": "",
812- "click_version": "0.1",
813- "company_name": "",
814- "icon_urls": {
815- "64": "http://developer.staging.ubuntu.com/site_media/appmedia/2013/07/weather-icone-6797-64.png"
816- },
817- "requires_license_key": false,
818- "date_published": "2013-07-16T21:50:34.874000"
819- }
820-)foo";
821-
822-const std::string FAKE_JSON_BOOTSTRAP = R"(
823- {
824- "_embedded": {
825- "clickindex:department": [
826- {
827- "has_children": false,
828- "_links": {
829- "self": {
830- "href": "https://search.apps.staging.ubuntu.com/api/v1/departments/fake-subdepartment"}
831- },
832- "name": "Fake Subdepartment", "slug": "fake-subdepartment"}
833- ],
834- "clickindex:highlight": [
835- {
836- "_embedded": {
837- "clickindex:package": [
838- {
839- "publisher": "Awesome Widget Company",
840- "name": "org.example.awesomelauncher",
841- "title": "Awesome Launcher",
842- "price": 1.99,
843- "_links": {
844- "self": {
845- "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomelauncher"}
846- },
847- "icon": "http://example.org/media/org.example.awesomelauncher/icons/icon16.png"
848- },
849- {
850- "publisher": "Awesome Widget Company",
851- "name": "org.example.awesomewidget",
852- "title": "Awesome Widget", "price": 1.99,
853- "_links": {
854- "self": {
855- "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomewidget"
856- }
857- },
858- "icon": "http://example.org/media/org.example.awesomewidget/icons/icon16.png"}
859- ]
860- },
861- "_links": {
862- "self": {
863- "href": "https://search.apps.staging.ubuntu.com/api/v1/highlights/top-apps"
864- }
865- },
866- "name": "Top Apps", "slug": "top-apps"
867- },
868- {
869- "_embedded": {
870- "clickindex:package": [
871- {
872- "publisher": "Awesome Widget Company",
873- "name": "org.example.awesomelauncher",
874- "title": "Awesome Launcher",
875- "price": 1.99,
876- "_links": {
877- "self": {
878- "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomelauncher"
879- }
880- },
881- "icon": "http://example.org/media/org.example.awesomelauncher/icons/icon16.png"
882- },
883- {
884- "publisher": "Awesome Widget Company",
885- "name": "org.example.awesomewidget",
886- "title": "Awesome Widget",
887- "price": 1.99,
888- "_links": {
889- "self": {
890- "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomewidget"
891- }
892- },
893- "icon": "http://example.org/media/org.example.awesomewidget/icons/icon16.png"
894- }
895- ]
896- },
897- "_links": {
898- "self": {
899- "href": "https://search.apps.staging.ubuntu.com/api/v1/highlights/most-purchased"
900- }
901- },
902- "name": "Most Purchased",
903- "slug": "most-purchased"
904- },
905- {
906- "_embedded": {
907- "clickindex:package": [
908- {
909- "publisher": "Awesome Widget Company",
910- "name": "org.example.awesomelauncher",
911- "title": "Awesome Launcher",
912- "price": 1.99,
913- "_links": {
914- "self": {
915- "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomelauncher"
916- }
917- },
918- "icon": "http://example.org/media/org.example.awesomelauncher/icons/icon16.png"
919- },
920- {
921- "publisher": "Awesome Widget Company",
922- "name": "org.example.awesomewidget",
923- "title": "Awesome Widget",
924- "price": 1.99,
925- "_links": {
926- "self": {
927- "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomewidget"
928- }
929- },
930- "icon": "http://example.org/media/org.example.awesomewidget/icons/icon16.png"
931- }
932- ]
933- },
934- "_links": {
935- "self": {
936- "href": "https://search.apps.staging.ubuntu.com/api/v1/highlights/new-releases"
937- }
938- },
939- "name": "New Releases",
940- "slug": "new-releases"
941- }
942- ]
943- }, "has_children": true,
944- "_links": {
945- "curies": [
946- {
947- "href": "https://search.apps.staging.ubuntu.com/docs/v1/relations.html{#rel}",
948- "name": "clickindex", "templated": true
949- }
950- ],
951- "self": {
952- "href": "https://search.apps.staging.ubuntu.com/api/v1/departments/fake-department-with-subdepartments"
953- },
954- "collection": {
955- "href": "https://search.apps.staging.ubuntu.com/api/v1/departments"
956- }
957- },
958- "name": "Fake Department With Subdepartments",
959- "slug": "fake-department-with-subdepartments"
960- })";
961-
962-const std::string FAKE_JSON_BROKEN_BOOTSTRAP = R"(
963- {
964- "_embedded": {
965- "clickindex:department": [
966- {
967- "name": "Broken department"
968- }
969- ],
970- "clickindex:highlight": [
971- {
972- "_embedded": {
973- "clickindex:package": [
974- {
975- "publisher": "Awesome Widget Company",
976- "name": "org.example.awesomelauncher",
977- "title": "Awesome Launcher",
978- "price": 1.99,
979- "_links": {
980- "self": {
981- "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomelauncher"}
982- },
983- "icon": "http://example.org/media/org.example.awesomelauncher/icons/icon16.png"
984- }
985- ]
986- },
987- "_links": {
988- "self": {
989- "href": "https://search.apps.staging.ubuntu.com/api/v1/highlights/top-apps"
990- }
991- },
992- "name": "Top Apps",
993- "slug": "top-apps"
994- },
995- {
996- "_embedded": {
997- "clickindex:package": [
998- {
999- "publisher": "Awesome Widget Company",
1000- "name": "org.example.awesomelauncher",
1001- "title": "Awesome Launcher",
1002- "price": 1.99,
1003- "_links": {
1004- "self": {
1005- "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomelauncher"
1006- }
1007- },
1008- "icon": "http://example.org/media/org.example.awesomelauncher/icons/icon16.png"
1009- }
1010- ]
1011- },
1012- "____name": "Broken highlight"
1013- }
1014- ]
1015- }
1016- })";
1017-
1018-const std::string FAKE_JSON_DEPARTMENTS_ONLY = R"(
1019- {
1020- "_links": {
1021- "self": {
1022- "href": "https://search.apps.ubuntu.com/api/v1/departments"
1023- },
1024- "curies": [
1025- {
1026- "name": "clickindex",
1027- "href": "https://search.apps.ubuntu.com/docs/v1/relations.html{#rel}",
1028- "templated": true
1029- }
1030- ]
1031- },
1032- "_embedded": {
1033- "clickindex:department": [
1034- {
1035- "name": "Games",
1036- "_links": {
1037- "self": {
1038- "href": "https://search.apps.ubuntu.com/api/v1/departments/Games"
1039- }
1040- },
1041- "_embedded": {
1042- "clickindex:department": [
1043- {
1044- "name": "Board Games",
1045- "_links": {
1046- "self": {
1047- "href": "https://search.apps.ubuntu.com/api/v1/departments/Games/Board+Games"
1048- }
1049- }
1050- }
1051- ]
1052- }
1053- },
1054- {
1055- "name": "Graphics",
1056- "_links": {
1057- "self": {
1058- "href": "https://search.apps.ubuntu.com/api/v1/departments/Graphics"
1059- }
1060- },
1061- "_embedded": {
1062- "clickindex:department": [
1063- {
1064- "name": "Drawing",
1065- "_links": {
1066- "self": {
1067- "href": "https://search.apps.ubuntu.com/api/v1/departments/Graphics/Drawing"
1068- }
1069- }
1070- }
1071- ]
1072- }
1073- },
1074- {
1075- "name": "Internet",
1076- "_links": {
1077- "self": {
1078- "href": "https://search.apps.ubuntu.com/api/v1/departments/Internet"
1079- }
1080- },
1081- "_embedded": {
1082- "clickindex:department": [
1083- {
1084- "name": "Chat",
1085- "_links": {
1086- "self": {
1087- "href": "https://search.apps.ubuntu.com/api/v1/departments/Internet/Chat"
1088- }
1089- }
1090- },
1091- {
1092- "name": "Mail",
1093- "_links": {
1094- "self": {
1095- "href": "https://search.apps.ubuntu.com/api/v1/departments/Internet/Mail"
1096- }
1097- }
1098- },
1099- {
1100- "name": "Web Browsers",
1101- "_links": {
1102- "self": {
1103- "href": "https://search.apps.ubuntu.com/api/v1/departments/Internet/Web+Browsers"
1104- }
1105- }
1106- }
1107- ]
1108- }
1109- }
1110- ]
1111- }
1112-})";
1113-
1114-const std::string FAKE_JSON_BROKEN_DEPARTMENTS = R"(
1115- {
1116- "_links": {
1117- "self": {
1118- "href": "https://search.apps.ubuntu.com/api/v1/departments"
1119- },
1120- "curies": [
1121- {
1122- "name": "clickindex",
1123- "href": "https://search.apps.ubuntu.com/docs/v1/relations.html{#rel}",
1124- "templated": true
1125- }
1126- ]
1127- },
1128- "_embedded": {
1129- "clickindex:department": [
1130- {
1131- "name": "Games",
1132- "_links": {
1133- "self": {
1134- "href": "https://search.apps.ubuntu.com/api/v1/departments/Games"
1135- }
1136- },
1137- "_embedded": {
1138- "clickindex:department": [
1139- {
1140- "name": "Broken department"
1141- }
1142- ]
1143- }
1144- }
1145- ]
1146- }
1147- })";
1148-
1149-const std::string FAKE_JSON_MANIFEST_REMOVABLE = R"foo(
1150- {
1151- "_removable": 1,
1152- "name": "com.example.fake",
1153- "version": "0.1",
1154- "hooks": {
1155- "fake-app": {
1156- "desktop": "fake-app.desktop"
1157- }
1158- }
1159- }
1160-)foo";
1161-
1162-const std::string FAKE_JSON_MANIFEST_NONREMOVABLE = R"foo(
1163- {
1164- "_removable": 0,
1165- "name": "com.example.fake",
1166- "version": "0.1",
1167- "hooks": {
1168- "fake-app": {
1169- "desktop": "fake-app.desktop"
1170- }
1171- }
1172- }
1173-)foo";
1174-
1175-const std::string FAKE_JSON_MANIFEST_ONE_APP = R"foo(
1176- {
1177- "_removable": 1,
1178- "name": "com.example.fake-app",
1179- "version": "0.1",
1180- "hooks": {
1181- "fake-app": {
1182- "apparmor": "fake-app.json",
1183- "desktop": "fake-app.desktop"
1184- }
1185- }
1186- }
1187-)foo";
1188-
1189-const std::string FAKE_JSON_MANIFEST_ONE_SCOPE = R"foo(
1190- {
1191- "_removable": 1,
1192- "name": "com.example.fake-scope",
1193- "version": "0.1",
1194- "hooks": {
1195- "fake-scope": {
1196- "apparmor": "scope-security.json",
1197- "scope": "fake-scope"
1198- }
1199- }
1200- }
1201-)foo";
1202-
1203-const std::string FAKE_JSON_MANIFEST_ONE_APP_ONE_SCOPE = R"foo(
1204- {
1205- "_removable": 1,
1206- "name": "com.example.fake-1app-1scope",
1207- "version": "0.1",
1208- "hooks": {
1209- "fake-app": {
1210- "apparmor": "fake-app.json",
1211- "desktop": "fake-app.desktop"
1212- },
1213- "fake-scope": {
1214- "apparmor": "scope-security.json",
1215- "scope": "fake-scope"
1216- }
1217- }
1218- }
1219-)foo";
1220-
1221-const std::string FAKE_JSON_MANIFEST_TWO_APPS_TWO_SCOPES = R"foo(
1222- {
1223- "_removable": 1,
1224- "name": "com.example.fake-2apps-2scopes",
1225- "version": "0.1",
1226- "hooks": {
1227- "fake-app1": {
1228- "apparmor": "fake-app1.json",
1229- "desktop": "fake-app1.desktop"
1230- },
1231- "fake-app2": {
1232- "apparmor": "fake-app2.json",
1233- "desktop": "fake-app2.desktop"
1234- },
1235- "fake-scope1": {
1236- "apparmor": "scope-security1.json",
1237- "scope": "fake-scope1"
1238- },
1239- "fake-scope2": {
1240- "apparmor": "scope-security1.json",
1241- "scope": "fake-scope2"
1242- }
1243- }
1244- }
1245-)foo";
1246+extern const std::string FAKE_JSON_REVIEWS_RESULT_ONE;
1247+extern const std::string FAKE_JSON_SEARCH_RESULT_ONE;
1248+extern const std::string FAKE_JSON_SEARCH_RESULT_MISSING_DATA;
1249+extern const std::string FAKE_JSON_SEARCH_RESULT_MANY;
1250+extern const std::string FAKE_JSON_SEARCH_RESULT_RECOMMENDS;
1251+extern const std::string FAKE_JSON_PACKAGE_DETAILS;
1252+extern const std::string FAKE_JSON_BOOTSTRAP;
1253+extern const std::string FAKE_JSON_BROKEN_BOOTSTRAP;
1254+extern const std::string FAKE_JSON_DEPARTMENTS_ONLY;
1255+extern const std::string FAKE_JSON_BROKEN_DEPARTMENTS;
1256+extern const std::string FAKE_JSON_MANIFEST_REMOVABLE;
1257+extern const std::string FAKE_JSON_MANIFEST_NONREMOVABLE;
1258+extern const std::string FAKE_JSON_MANIFEST_ONE_APP;
1259+extern const std::string FAKE_JSON_MANIFEST_ONE_SCOPE;
1260+extern const std::string FAKE_JSON_MANIFEST_ONE_APP_ONE_SCOPE;
1261+extern const std::string FAKE_JSON_MANIFEST_TWO_APPS_TWO_SCOPES;
1262
1263 #endif // FAKE_JSON_H

Subscribers

People subscribed via source and target branches

to all changes: