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
=== modified file 'libclickscope/tests/CMakeLists.txt'
--- libclickscope/tests/CMakeLists.txt 2014-06-26 17:52:31 +0000
+++ libclickscope/tests/CMakeLists.txt 2014-07-11 09:18:16 +0000
@@ -20,7 +20,7 @@
20 mock_network_access_manager.h20 mock_network_access_manager.h
21 mock_ubuntuone_credentials.h21 mock_ubuntuone_credentials.h
22 mock_webclient.h22 mock_webclient.h
2323 fake_json.cpp
24 test_bootstrap.cpp24 test_bootstrap.cpp
25 test_configuration.cpp25 test_configuration.cpp
26 test_departments.cpp26 test_departments.cpp
2727
=== added file 'libclickscope/tests/fake_json.cpp'
--- libclickscope/tests/fake_json.cpp 1970-01-01 00:00:00 +0000
+++ libclickscope/tests/fake_json.cpp 2014-07-11 09:18:16 +0000
@@ -0,0 +1,626 @@
1/*
2 * Copyright (C) 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * In addition, as a special exception, the copyright holders give
17 * permission to link the code of portions of this program with the
18 * OpenSSL library under certain conditions as described in each
19 * individual source file, and distribute linked combinations
20 * including the two.
21 * You must obey the GNU General Public License in all respects
22 * for all of the code used other than OpenSSL. If you modify
23 * file(s) with this exception, you may extend this exception to your
24 * version of the file(s), but you are not obligated to do so. If you
25 * do not wish to do so, delete this exception statement from your
26 * version. If you delete this exception statement from all source
27 * files in the program, then also delete it here.
28 */
29
30#include "fake_json.h"
31
32const std::string FAKE_JSON_REVIEWS_RESULT_ONE = R"foo(
33 [
34 {
35 "date_created": "2014-01-28T09:09:47.218Z",
36 "date_deleted": null,
37 "hide": false,
38 "id": 1,
39 "language": "en",
40 "package_name": "com.example.fakepackage",
41 "rating": 4,
42 "review_text": "It is ok.",
43 "reviewer_displayname": "Reviewer",
44 "reviewer_username": "reviewer",
45 "summary": "Review Summary",
46 "usefulness_favorable": 0,
47 "usefulness_total": 0,
48 "version": "0.2"
49 }
50 ]
51)foo";
52
53const std::string FAKE_JSON_SEARCH_RESULT_ONE = R"foo({
54 "_embedded": {
55 "clickindex:package": [
56 {
57 "name": "org.example.awesomelauncher",
58 "title": "Awesome Launcher",
59 "description": "This is an awesome launcher.",
60 "price": 1.99,
61 "icon_url": "http://software-center.ubuntu.com/site_media/appmedia/2012/09/SPAZ.png",
62 "_links": {
63 "self": {
64 "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher"
65 }
66 }
67 }
68 ]
69 }
70 }
71)foo";
72
73const std::string FAKE_JSON_SEARCH_RESULT_MISSING_DATA = R"foo({
74 "_embedded": {
75 "clickindex:package": [
76 {
77 "name": "org.example.awesomelauncher",
78 "title": "Awesome Launcher",
79 "description": "This is an awesome launcher.",
80 "_links": {
81 "self": {
82 "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher"
83 }
84 }
85 }
86 ]
87 }
88 }
89)foo";
90
91const std::string FAKE_JSON_SEARCH_RESULT_MANY = R"foo({
92 "_embedded": {
93 "clickindex:package": [
94 {
95 "name": "org.example.awesomelauncher",
96 "title": "Awesome Launcher",
97 "description": "This is an awesome launcher.",
98 "price": 1.99,
99 "icon_url": "http://software-center.ubuntu.com/site_media/appmedia/2012/09/SPAZ.png",
100 "_links": {
101 "self": {
102 "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher"
103 }
104 }
105 },
106 {
107 "name": "org.example.fantastiqueapp",
108 "title": "Fantastic App",
109 "description": "This is a fantasticc app.",
110 "price": 0.0,
111 "icon_url": "http://assets.ubuntu.com/sites/ubuntu/504/u/img/ubuntu/features/icon-find-more-apps-64x64.png",
112 "_links": {
113 "self": {
114 "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.fantasticapp"
115 }
116 }
117 },
118 {
119 "name": "org.example.awesomewidget",
120 "title": "Awesome Widget",
121 "description": "This is an awesome widget.",
122 "price": 1.99,
123 "icon_url": "http://assets.ubuntu.com/sites/ubuntu/504/u/img/ubuntu/features/icon-photos-and-videos-64x64.png",
124 "_links": {
125 "self": {
126 "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomewidget"
127 }
128 }
129 }
130 ]
131 }
132 }
133)foo";
134
135const std::string FAKE_JSON_SEARCH_RESULT_RECOMMENDS = R"foo({
136 "_embedded": {
137 "clickindex:package": [
138 {
139 "name": "org.example.awesomelauncher",
140 "title": "Awesome Launcher",
141 "description": "This is an awesome launcher.",
142 "price": 1.99,
143 "icon_url": "http://software-center.ubuntu.com/site_media/appmedia/2012/09/SPAZ.png",
144 "_links": {
145 "self": {
146 "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher"
147 }
148 }
149 }
150 ],
151 "clickindex:recommendation": [
152 {
153 "name": "org.example.awesomelauncher2",
154 "title": "Awesome Launcher 2",
155 "description": "This is an another awesome launcher.",
156 "price": 1.99,
157 "icon_url": "http://software-center.ubuntu.com/site_media/appmedia/2012/09/SPAZ.png",
158 "_links": {
159 "self": {
160 "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher2"
161 }
162 }
163 }
164 ]
165 }
166 }
167)foo";
168
169const std::string FAKE_JSON_PACKAGE_DETAILS = R"foo(
170 {
171 "name": "ar.com.beuno.wheather-touch",
172 "icon_url": "http://developer.staging.ubuntu.com/site_media/appmedia/2013/07/weather-icone-6797-64.png",
173 "title": "\u1F4A9 Weather",
174 "description": "\u1F4A9 Weather\nA weather application.",
175 "download_url": "https://public.apps.staging.ubuntu.com/download/ar.com.beuno/wheather-touch/ar.com.beuno.wheather-touch-0.2",
176 "rating": 3.5,
177 "keywords": "these, are, key, words",
178 "terms_of_service": "tos",
179 "license": "Proprietary",
180 "publisher": "Beuno",
181 "screenshot_url": "sshot0",
182 "screenshot_urls": ["sshot1", "sshot2"],
183 "binary_filesize": 177582,
184 "version": "0.2",
185 "framework": "None",
186
187 "website": "",
188 "support_url": "http://beuno.com.ar",
189 "price": 1.99,
190 "license_key_path": "",
191 "click_version": "0.1",
192 "company_name": "",
193 "icon_urls": {
194 "64": "http://developer.staging.ubuntu.com/site_media/appmedia/2013/07/weather-icone-6797-64.png"
195 },
196 "requires_license_key": false,
197 "date_published": "2013-07-16T21:50:34.874000"
198 }
199)foo";
200
201const std::string FAKE_JSON_BOOTSTRAP = R"(
202 {
203 "_embedded": {
204 "clickindex:department": [
205 {
206 "has_children": false,
207 "_links": {
208 "self": {
209 "href": "https://search.apps.staging.ubuntu.com/api/v1/departments/fake-subdepartment"}
210 },
211 "name": "Fake Subdepartment", "slug": "fake-subdepartment"}
212 ],
213 "clickindex:highlight": [
214 {
215 "_embedded": {
216 "clickindex:package": [
217 {
218 "publisher": "Awesome Widget Company",
219 "name": "org.example.awesomelauncher",
220 "title": "Awesome Launcher",
221 "price": 1.99,
222 "_links": {
223 "self": {
224 "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomelauncher"}
225 },
226 "icon": "http://example.org/media/org.example.awesomelauncher/icons/icon16.png"
227 },
228 {
229 "publisher": "Awesome Widget Company",
230 "name": "org.example.awesomewidget",
231 "title": "Awesome Widget", "price": 1.99,
232 "_links": {
233 "self": {
234 "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomewidget"
235 }
236 },
237 "icon": "http://example.org/media/org.example.awesomewidget/icons/icon16.png"}
238 ]
239 },
240 "_links": {
241 "self": {
242 "href": "https://search.apps.staging.ubuntu.com/api/v1/highlights/top-apps"
243 }
244 },
245 "name": "Top Apps", "slug": "top-apps"
246 },
247 {
248 "_embedded": {
249 "clickindex:package": [
250 {
251 "publisher": "Awesome Widget Company",
252 "name": "org.example.awesomelauncher",
253 "title": "Awesome Launcher",
254 "price": 1.99,
255 "_links": {
256 "self": {
257 "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomelauncher"
258 }
259 },
260 "icon": "http://example.org/media/org.example.awesomelauncher/icons/icon16.png"
261 },
262 {
263 "publisher": "Awesome Widget Company",
264 "name": "org.example.awesomewidget",
265 "title": "Awesome Widget",
266 "price": 1.99,
267 "_links": {
268 "self": {
269 "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomewidget"
270 }
271 },
272 "icon": "http://example.org/media/org.example.awesomewidget/icons/icon16.png"
273 }
274 ]
275 },
276 "_links": {
277 "self": {
278 "href": "https://search.apps.staging.ubuntu.com/api/v1/highlights/most-purchased"
279 }
280 },
281 "name": "Most Purchased",
282 "slug": "most-purchased"
283 },
284 {
285 "_embedded": {
286 "clickindex:package": [
287 {
288 "publisher": "Awesome Widget Company",
289 "name": "org.example.awesomelauncher",
290 "title": "Awesome Launcher",
291 "price": 1.99,
292 "_links": {
293 "self": {
294 "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomelauncher"
295 }
296 },
297 "icon": "http://example.org/media/org.example.awesomelauncher/icons/icon16.png"
298 },
299 {
300 "publisher": "Awesome Widget Company",
301 "name": "org.example.awesomewidget",
302 "title": "Awesome Widget",
303 "price": 1.99,
304 "_links": {
305 "self": {
306 "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomewidget"
307 }
308 },
309 "icon": "http://example.org/media/org.example.awesomewidget/icons/icon16.png"
310 }
311 ]
312 },
313 "_links": {
314 "self": {
315 "href": "https://search.apps.staging.ubuntu.com/api/v1/highlights/new-releases"
316 }
317 },
318 "name": "New Releases",
319 "slug": "new-releases"
320 }
321 ]
322 }, "has_children": true,
323 "_links": {
324 "curies": [
325 {
326 "href": "https://search.apps.staging.ubuntu.com/docs/v1/relations.html{#rel}",
327 "name": "clickindex", "templated": true
328 }
329 ],
330 "self": {
331 "href": "https://search.apps.staging.ubuntu.com/api/v1/departments/fake-department-with-subdepartments"
332 },
333 "collection": {
334 "href": "https://search.apps.staging.ubuntu.com/api/v1/departments"
335 }
336 },
337 "name": "Fake Department With Subdepartments",
338 "slug": "fake-department-with-subdepartments"
339 })";
340
341const std::string FAKE_JSON_BROKEN_BOOTSTRAP = R"(
342 {
343 "_embedded": {
344 "clickindex:department": [
345 {
346 "name": "Broken department"
347 }
348 ],
349 "clickindex:highlight": [
350 {
351 "_embedded": {
352 "clickindex:package": [
353 {
354 "publisher": "Awesome Widget Company",
355 "name": "org.example.awesomelauncher",
356 "title": "Awesome Launcher",
357 "price": 1.99,
358 "_links": {
359 "self": {
360 "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomelauncher"}
361 },
362 "icon": "http://example.org/media/org.example.awesomelauncher/icons/icon16.png"
363 }
364 ]
365 },
366 "_links": {
367 "self": {
368 "href": "https://search.apps.staging.ubuntu.com/api/v1/highlights/top-apps"
369 }
370 },
371 "name": "Top Apps",
372 "slug": "top-apps"
373 },
374 {
375 "_embedded": {
376 "clickindex:package": [
377 {
378 "publisher": "Awesome Widget Company",
379 "name": "org.example.awesomelauncher",
380 "title": "Awesome Launcher",
381 "price": 1.99,
382 "_links": {
383 "self": {
384 "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomelauncher"
385 }
386 },
387 "icon": "http://example.org/media/org.example.awesomelauncher/icons/icon16.png"
388 }
389 ]
390 },
391 "____name": "Broken highlight"
392 }
393 ]
394 }
395 })";
396
397const std::string FAKE_JSON_DEPARTMENTS_ONLY = R"(
398 {
399 "_links": {
400 "self": {
401 "href": "https://search.apps.ubuntu.com/api/v1/departments"
402 },
403 "curies": [
404 {
405 "name": "clickindex",
406 "href": "https://search.apps.ubuntu.com/docs/v1/relations.html{#rel}",
407 "templated": true
408 }
409 ]
410 },
411 "_embedded": {
412 "clickindex:department": [
413 {
414 "name": "Games",
415 "_links": {
416 "self": {
417 "href": "https://search.apps.ubuntu.com/api/v1/departments/Games"
418 }
419 },
420 "_embedded": {
421 "clickindex:department": [
422 {
423 "name": "Board Games",
424 "_links": {
425 "self": {
426 "href": "https://search.apps.ubuntu.com/api/v1/departments/Games/Board+Games"
427 }
428 }
429 }
430 ]
431 }
432 },
433 {
434 "name": "Graphics",
435 "_links": {
436 "self": {
437 "href": "https://search.apps.ubuntu.com/api/v1/departments/Graphics"
438 }
439 },
440 "_embedded": {
441 "clickindex:department": [
442 {
443 "name": "Drawing",
444 "_links": {
445 "self": {
446 "href": "https://search.apps.ubuntu.com/api/v1/departments/Graphics/Drawing"
447 }
448 }
449 }
450 ]
451 }
452 },
453 {
454 "name": "Internet",
455 "_links": {
456 "self": {
457 "href": "https://search.apps.ubuntu.com/api/v1/departments/Internet"
458 }
459 },
460 "_embedded": {
461 "clickindex:department": [
462 {
463 "name": "Chat",
464 "_links": {
465 "self": {
466 "href": "https://search.apps.ubuntu.com/api/v1/departments/Internet/Chat"
467 }
468 }
469 },
470 {
471 "name": "Mail",
472 "_links": {
473 "self": {
474 "href": "https://search.apps.ubuntu.com/api/v1/departments/Internet/Mail"
475 }
476 }
477 },
478 {
479 "name": "Web Browsers",
480 "_links": {
481 "self": {
482 "href": "https://search.apps.ubuntu.com/api/v1/departments/Internet/Web+Browsers"
483 }
484 }
485 }
486 ]
487 }
488 }
489 ]
490 }
491})";
492
493const std::string FAKE_JSON_BROKEN_DEPARTMENTS = R"(
494 {
495 "_links": {
496 "self": {
497 "href": "https://search.apps.ubuntu.com/api/v1/departments"
498 },
499 "curies": [
500 {
501 "name": "clickindex",
502 "href": "https://search.apps.ubuntu.com/docs/v1/relations.html{#rel}",
503 "templated": true
504 }
505 ]
506 },
507 "_embedded": {
508 "clickindex:department": [
509 {
510 "name": "Games",
511 "_links": {
512 "self": {
513 "href": "https://search.apps.ubuntu.com/api/v1/departments/Games"
514 }
515 },
516 "_embedded": {
517 "clickindex:department": [
518 {
519 "name": "Broken department"
520 }
521 ]
522 }
523 }
524 ]
525 }
526 })";
527
528const std::string FAKE_JSON_MANIFEST_REMOVABLE = R"foo(
529 {
530 "_removable": 1,
531 "name": "com.example.fake",
532 "version": "0.1",
533 "hooks": {
534 "fake-app": {
535 "desktop": "fake-app.desktop"
536 }
537 }
538 }
539)foo";
540
541const std::string FAKE_JSON_MANIFEST_NONREMOVABLE = R"foo(
542 {
543 "_removable": 0,
544 "name": "com.example.fake",
545 "version": "0.1",
546 "hooks": {
547 "fake-app": {
548 "desktop": "fake-app.desktop"
549 }
550 }
551 }
552)foo";
553
554const std::string FAKE_JSON_MANIFEST_ONE_APP = R"foo(
555 {
556 "_removable": 1,
557 "name": "com.example.fake-app",
558 "version": "0.1",
559 "hooks": {
560 "fake-app": {
561 "apparmor": "fake-app.json",
562 "desktop": "fake-app.desktop"
563 }
564 }
565 }
566)foo";
567
568const std::string FAKE_JSON_MANIFEST_ONE_SCOPE = R"foo(
569 {
570 "_removable": 1,
571 "name": "com.example.fake-scope",
572 "version": "0.1",
573 "hooks": {
574 "fake-scope": {
575 "apparmor": "scope-security.json",
576 "scope": "fake-scope"
577 }
578 }
579 }
580)foo";
581
582const std::string FAKE_JSON_MANIFEST_ONE_APP_ONE_SCOPE = R"foo(
583 {
584 "_removable": 1,
585 "name": "com.example.fake-1app-1scope",
586 "version": "0.1",
587 "hooks": {
588 "fake-app": {
589 "apparmor": "fake-app.json",
590 "desktop": "fake-app.desktop"
591 },
592 "fake-scope": {
593 "apparmor": "scope-security.json",
594 "scope": "fake-scope"
595 }
596 }
597 }
598)foo";
599
600const std::string FAKE_JSON_MANIFEST_TWO_APPS_TWO_SCOPES = R"foo(
601 {
602 "_removable": 1,
603 "name": "com.example.fake-2apps-2scopes",
604 "version": "0.1",
605 "hooks": {
606 "fake-app1": {
607 "apparmor": "fake-app1.json",
608 "desktop": "fake-app1.desktop"
609 },
610 "fake-app2": {
611 "apparmor": "fake-app2.json",
612 "desktop": "fake-app2.desktop"
613 },
614 "fake-scope1": {
615 "apparmor": "scope-security1.json",
616 "scope": "fake-scope1"
617 },
618 "fake-scope2": {
619 "apparmor": "scope-security1.json",
620 "scope": "fake-scope2"
621 }
622 }
623 }
624)foo";
625
626
0627
=== modified file 'libclickscope/tests/fake_json.h'
--- libclickscope/tests/fake_json.h 2014-06-26 17:52:31 +0000
+++ libclickscope/tests/fake_json.h 2014-07-11 09:18:16 +0000
@@ -32,599 +32,21 @@
3232
33#include <string>33#include <string>
3434
3535extern const std::string FAKE_JSON_REVIEWS_RESULT_ONE;
36const std::string FAKE_JSON_REVIEWS_RESULT_ONE = R"foo(36extern const std::string FAKE_JSON_SEARCH_RESULT_ONE;
37 [37extern const std::string FAKE_JSON_SEARCH_RESULT_MISSING_DATA;
38 {38extern const std::string FAKE_JSON_SEARCH_RESULT_MANY;
39 "date_created": "2014-01-28T09:09:47.218Z",39extern const std::string FAKE_JSON_SEARCH_RESULT_RECOMMENDS;
40 "date_deleted": null,40extern const std::string FAKE_JSON_PACKAGE_DETAILS;
41 "hide": false,41extern const std::string FAKE_JSON_BOOTSTRAP;
42 "id": 1,42extern const std::string FAKE_JSON_BROKEN_BOOTSTRAP;
43 "language": "en",43extern const std::string FAKE_JSON_DEPARTMENTS_ONLY;
44 "package_name": "com.example.fakepackage",44extern const std::string FAKE_JSON_BROKEN_DEPARTMENTS;
45 "rating": 4,45extern const std::string FAKE_JSON_MANIFEST_REMOVABLE;
46 "review_text": "It is ok.",46extern const std::string FAKE_JSON_MANIFEST_NONREMOVABLE;
47 "reviewer_displayname": "Reviewer",47extern const std::string FAKE_JSON_MANIFEST_ONE_APP;
48 "reviewer_username": "reviewer",48extern const std::string FAKE_JSON_MANIFEST_ONE_SCOPE;
49 "summary": "Review Summary",49extern const std::string FAKE_JSON_MANIFEST_ONE_APP_ONE_SCOPE;
50 "usefulness_favorable": 0,50extern const std::string FAKE_JSON_MANIFEST_TWO_APPS_TWO_SCOPES;
51 "usefulness_total": 0,
52 "version": "0.2"
53 }
54 ]
55)foo";
56
57const std::string FAKE_JSON_SEARCH_RESULT_ONE = R"foo({
58 "_embedded": {
59 "clickindex:package": [
60 {
61 "name": "org.example.awesomelauncher",
62 "title": "Awesome Launcher",
63 "description": "This is an awesome launcher.",
64 "price": 1.99,
65 "icon_url": "http://software-center.ubuntu.com/site_media/appmedia/2012/09/SPAZ.png",
66 "_links": {
67 "self": {
68 "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher"
69 }
70 }
71 }
72 ]
73 }
74 }
75)foo";
76
77const std::string FAKE_JSON_SEARCH_RESULT_MISSING_DATA = R"foo({
78 "_embedded": {
79 "clickindex:package": [
80 {
81 "name": "org.example.awesomelauncher",
82 "title": "Awesome Launcher",
83 "description": "This is an awesome launcher.",
84 "_links": {
85 "self": {
86 "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher"
87 }
88 }
89 }
90 ]
91 }
92 }
93)foo";
94
95const std::string FAKE_JSON_SEARCH_RESULT_MANY = R"foo({
96 "_embedded": {
97 "clickindex:package": [
98 {
99 "name": "org.example.awesomelauncher",
100 "title": "Awesome Launcher",
101 "description": "This is an awesome launcher.",
102 "price": 1.99,
103 "icon_url": "http://software-center.ubuntu.com/site_media/appmedia/2012/09/SPAZ.png",
104 "_links": {
105 "self": {
106 "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher"
107 }
108 }
109 },
110 {
111 "name": "org.example.fantastiqueapp",
112 "title": "Fantastic App",
113 "description": "This is a fantasticc app.",
114 "price": 0.0,
115 "icon_url": "http://assets.ubuntu.com/sites/ubuntu/504/u/img/ubuntu/features/icon-find-more-apps-64x64.png",
116 "_links": {
117 "self": {
118 "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.fantasticapp"
119 }
120 }
121 },
122 {
123 "name": "org.example.awesomewidget",
124 "title": "Awesome Widget",
125 "description": "This is an awesome widget.",
126 "price": 1.99,
127 "icon_url": "http://assets.ubuntu.com/sites/ubuntu/504/u/img/ubuntu/features/icon-photos-and-videos-64x64.png",
128 "_links": {
129 "self": {
130 "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomewidget"
131 }
132 }
133 }
134 ]
135 }
136 }
137)foo";
138
139const std::string FAKE_JSON_SEARCH_RESULT_RECOMMENDS = R"foo({
140 "_embedded": {
141 "clickindex:package": [
142 {
143 "name": "org.example.awesomelauncher",
144 "title": "Awesome Launcher",
145 "description": "This is an awesome launcher.",
146 "price": 1.99,
147 "icon_url": "http://software-center.ubuntu.com/site_media/appmedia/2012/09/SPAZ.png",
148 "_links": {
149 "self": {
150 "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher"
151 }
152 }
153 }
154 ],
155 "clickindex:recommendation": [
156 {
157 "name": "org.example.awesomelauncher2",
158 "title": "Awesome Launcher 2",
159 "description": "This is an another awesome launcher.",
160 "price": 1.99,
161 "icon_url": "http://software-center.ubuntu.com/site_media/appmedia/2012/09/SPAZ.png",
162 "_links": {
163 "self": {
164 "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher2"
165 }
166 }
167 }
168 ]
169 }
170 }
171)foo";
172
173const std::string FAKE_JSON_PACKAGE_DETAILS = R"foo(
174 {
175 "name": "ar.com.beuno.wheather-touch",
176 "icon_url": "http://developer.staging.ubuntu.com/site_media/appmedia/2013/07/weather-icone-6797-64.png",
177 "title": "\u1F4A9 Weather",
178 "description": "\u1F4A9 Weather\nA weather application.",
179 "download_url": "https://public.apps.staging.ubuntu.com/download/ar.com.beuno/wheather-touch/ar.com.beuno.wheather-touch-0.2",
180 "rating": 3.5,
181 "keywords": "these, are, key, words",
182 "terms_of_service": "tos",
183 "license": "Proprietary",
184 "publisher": "Beuno",
185 "screenshot_url": "sshot0",
186 "screenshot_urls": ["sshot1", "sshot2"],
187 "binary_filesize": 177582,
188 "version": "0.2",
189 "framework": "None",
190
191 "website": "",
192 "support_url": "http://beuno.com.ar",
193 "price": 1.99,
194 "license_key_path": "",
195 "click_version": "0.1",
196 "company_name": "",
197 "icon_urls": {
198 "64": "http://developer.staging.ubuntu.com/site_media/appmedia/2013/07/weather-icone-6797-64.png"
199 },
200 "requires_license_key": false,
201 "date_published": "2013-07-16T21:50:34.874000"
202 }
203)foo";
204
205const std::string FAKE_JSON_BOOTSTRAP = R"(
206 {
207 "_embedded": {
208 "clickindex:department": [
209 {
210 "has_children": false,
211 "_links": {
212 "self": {
213 "href": "https://search.apps.staging.ubuntu.com/api/v1/departments/fake-subdepartment"}
214 },
215 "name": "Fake Subdepartment", "slug": "fake-subdepartment"}
216 ],
217 "clickindex:highlight": [
218 {
219 "_embedded": {
220 "clickindex:package": [
221 {
222 "publisher": "Awesome Widget Company",
223 "name": "org.example.awesomelauncher",
224 "title": "Awesome Launcher",
225 "price": 1.99,
226 "_links": {
227 "self": {
228 "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomelauncher"}
229 },
230 "icon": "http://example.org/media/org.example.awesomelauncher/icons/icon16.png"
231 },
232 {
233 "publisher": "Awesome Widget Company",
234 "name": "org.example.awesomewidget",
235 "title": "Awesome Widget", "price": 1.99,
236 "_links": {
237 "self": {
238 "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomewidget"
239 }
240 },
241 "icon": "http://example.org/media/org.example.awesomewidget/icons/icon16.png"}
242 ]
243 },
244 "_links": {
245 "self": {
246 "href": "https://search.apps.staging.ubuntu.com/api/v1/highlights/top-apps"
247 }
248 },
249 "name": "Top Apps", "slug": "top-apps"
250 },
251 {
252 "_embedded": {
253 "clickindex:package": [
254 {
255 "publisher": "Awesome Widget Company",
256 "name": "org.example.awesomelauncher",
257 "title": "Awesome Launcher",
258 "price": 1.99,
259 "_links": {
260 "self": {
261 "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomelauncher"
262 }
263 },
264 "icon": "http://example.org/media/org.example.awesomelauncher/icons/icon16.png"
265 },
266 {
267 "publisher": "Awesome Widget Company",
268 "name": "org.example.awesomewidget",
269 "title": "Awesome Widget",
270 "price": 1.99,
271 "_links": {
272 "self": {
273 "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomewidget"
274 }
275 },
276 "icon": "http://example.org/media/org.example.awesomewidget/icons/icon16.png"
277 }
278 ]
279 },
280 "_links": {
281 "self": {
282 "href": "https://search.apps.staging.ubuntu.com/api/v1/highlights/most-purchased"
283 }
284 },
285 "name": "Most Purchased",
286 "slug": "most-purchased"
287 },
288 {
289 "_embedded": {
290 "clickindex:package": [
291 {
292 "publisher": "Awesome Widget Company",
293 "name": "org.example.awesomelauncher",
294 "title": "Awesome Launcher",
295 "price": 1.99,
296 "_links": {
297 "self": {
298 "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomelauncher"
299 }
300 },
301 "icon": "http://example.org/media/org.example.awesomelauncher/icons/icon16.png"
302 },
303 {
304 "publisher": "Awesome Widget Company",
305 "name": "org.example.awesomewidget",
306 "title": "Awesome Widget",
307 "price": 1.99,
308 "_links": {
309 "self": {
310 "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomewidget"
311 }
312 },
313 "icon": "http://example.org/media/org.example.awesomewidget/icons/icon16.png"
314 }
315 ]
316 },
317 "_links": {
318 "self": {
319 "href": "https://search.apps.staging.ubuntu.com/api/v1/highlights/new-releases"
320 }
321 },
322 "name": "New Releases",
323 "slug": "new-releases"
324 }
325 ]
326 }, "has_children": true,
327 "_links": {
328 "curies": [
329 {
330 "href": "https://search.apps.staging.ubuntu.com/docs/v1/relations.html{#rel}",
331 "name": "clickindex", "templated": true
332 }
333 ],
334 "self": {
335 "href": "https://search.apps.staging.ubuntu.com/api/v1/departments/fake-department-with-subdepartments"
336 },
337 "collection": {
338 "href": "https://search.apps.staging.ubuntu.com/api/v1/departments"
339 }
340 },
341 "name": "Fake Department With Subdepartments",
342 "slug": "fake-department-with-subdepartments"
343 })";
344
345const std::string FAKE_JSON_BROKEN_BOOTSTRAP = R"(
346 {
347 "_embedded": {
348 "clickindex:department": [
349 {
350 "name": "Broken department"
351 }
352 ],
353 "clickindex:highlight": [
354 {
355 "_embedded": {
356 "clickindex:package": [
357 {
358 "publisher": "Awesome Widget Company",
359 "name": "org.example.awesomelauncher",
360 "title": "Awesome Launcher",
361 "price": 1.99,
362 "_links": {
363 "self": {
364 "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomelauncher"}
365 },
366 "icon": "http://example.org/media/org.example.awesomelauncher/icons/icon16.png"
367 }
368 ]
369 },
370 "_links": {
371 "self": {
372 "href": "https://search.apps.staging.ubuntu.com/api/v1/highlights/top-apps"
373 }
374 },
375 "name": "Top Apps",
376 "slug": "top-apps"
377 },
378 {
379 "_embedded": {
380 "clickindex:package": [
381 {
382 "publisher": "Awesome Widget Company",
383 "name": "org.example.awesomelauncher",
384 "title": "Awesome Launcher",
385 "price": 1.99,
386 "_links": {
387 "self": {
388 "href": "https://search.apps.staging.ubuntu.com/api/v1/package/org.example.awesomelauncher"
389 }
390 },
391 "icon": "http://example.org/media/org.example.awesomelauncher/icons/icon16.png"
392 }
393 ]
394 },
395 "____name": "Broken highlight"
396 }
397 ]
398 }
399 })";
400
401const std::string FAKE_JSON_DEPARTMENTS_ONLY = R"(
402 {
403 "_links": {
404 "self": {
405 "href": "https://search.apps.ubuntu.com/api/v1/departments"
406 },
407 "curies": [
408 {
409 "name": "clickindex",
410 "href": "https://search.apps.ubuntu.com/docs/v1/relations.html{#rel}",
411 "templated": true
412 }
413 ]
414 },
415 "_embedded": {
416 "clickindex:department": [
417 {
418 "name": "Games",
419 "_links": {
420 "self": {
421 "href": "https://search.apps.ubuntu.com/api/v1/departments/Games"
422 }
423 },
424 "_embedded": {
425 "clickindex:department": [
426 {
427 "name": "Board Games",
428 "_links": {
429 "self": {
430 "href": "https://search.apps.ubuntu.com/api/v1/departments/Games/Board+Games"
431 }
432 }
433 }
434 ]
435 }
436 },
437 {
438 "name": "Graphics",
439 "_links": {
440 "self": {
441 "href": "https://search.apps.ubuntu.com/api/v1/departments/Graphics"
442 }
443 },
444 "_embedded": {
445 "clickindex:department": [
446 {
447 "name": "Drawing",
448 "_links": {
449 "self": {
450 "href": "https://search.apps.ubuntu.com/api/v1/departments/Graphics/Drawing"
451 }
452 }
453 }
454 ]
455 }
456 },
457 {
458 "name": "Internet",
459 "_links": {
460 "self": {
461 "href": "https://search.apps.ubuntu.com/api/v1/departments/Internet"
462 }
463 },
464 "_embedded": {
465 "clickindex:department": [
466 {
467 "name": "Chat",
468 "_links": {
469 "self": {
470 "href": "https://search.apps.ubuntu.com/api/v1/departments/Internet/Chat"
471 }
472 }
473 },
474 {
475 "name": "Mail",
476 "_links": {
477 "self": {
478 "href": "https://search.apps.ubuntu.com/api/v1/departments/Internet/Mail"
479 }
480 }
481 },
482 {
483 "name": "Web Browsers",
484 "_links": {
485 "self": {
486 "href": "https://search.apps.ubuntu.com/api/v1/departments/Internet/Web+Browsers"
487 }
488 }
489 }
490 ]
491 }
492 }
493 ]
494 }
495})";
496
497const std::string FAKE_JSON_BROKEN_DEPARTMENTS = R"(
498 {
499 "_links": {
500 "self": {
501 "href": "https://search.apps.ubuntu.com/api/v1/departments"
502 },
503 "curies": [
504 {
505 "name": "clickindex",
506 "href": "https://search.apps.ubuntu.com/docs/v1/relations.html{#rel}",
507 "templated": true
508 }
509 ]
510 },
511 "_embedded": {
512 "clickindex:department": [
513 {
514 "name": "Games",
515 "_links": {
516 "self": {
517 "href": "https://search.apps.ubuntu.com/api/v1/departments/Games"
518 }
519 },
520 "_embedded": {
521 "clickindex:department": [
522 {
523 "name": "Broken department"
524 }
525 ]
526 }
527 }
528 ]
529 }
530 })";
531
532const std::string FAKE_JSON_MANIFEST_REMOVABLE = R"foo(
533 {
534 "_removable": 1,
535 "name": "com.example.fake",
536 "version": "0.1",
537 "hooks": {
538 "fake-app": {
539 "desktop": "fake-app.desktop"
540 }
541 }
542 }
543)foo";
544
545const std::string FAKE_JSON_MANIFEST_NONREMOVABLE = R"foo(
546 {
547 "_removable": 0,
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
558const std::string FAKE_JSON_MANIFEST_ONE_APP = R"foo(
559 {
560 "_removable": 1,
561 "name": "com.example.fake-app",
562 "version": "0.1",
563 "hooks": {
564 "fake-app": {
565 "apparmor": "fake-app.json",
566 "desktop": "fake-app.desktop"
567 }
568 }
569 }
570)foo";
571
572const std::string FAKE_JSON_MANIFEST_ONE_SCOPE = R"foo(
573 {
574 "_removable": 1,
575 "name": "com.example.fake-scope",
576 "version": "0.1",
577 "hooks": {
578 "fake-scope": {
579 "apparmor": "scope-security.json",
580 "scope": "fake-scope"
581 }
582 }
583 }
584)foo";
585
586const std::string FAKE_JSON_MANIFEST_ONE_APP_ONE_SCOPE = R"foo(
587 {
588 "_removable": 1,
589 "name": "com.example.fake-1app-1scope",
590 "version": "0.1",
591 "hooks": {
592 "fake-app": {
593 "apparmor": "fake-app.json",
594 "desktop": "fake-app.desktop"
595 },
596 "fake-scope": {
597 "apparmor": "scope-security.json",
598 "scope": "fake-scope"
599 }
600 }
601 }
602)foo";
603
604const std::string FAKE_JSON_MANIFEST_TWO_APPS_TWO_SCOPES = R"foo(
605 {
606 "_removable": 1,
607 "name": "com.example.fake-2apps-2scopes",
608 "version": "0.1",
609 "hooks": {
610 "fake-app1": {
611 "apparmor": "fake-app1.json",
612 "desktop": "fake-app1.desktop"
613 },
614 "fake-app2": {
615 "apparmor": "fake-app2.json",
616 "desktop": "fake-app2.desktop"
617 },
618 "fake-scope1": {
619 "apparmor": "scope-security1.json",
620 "scope": "fake-scope1"
621 },
622 "fake-scope2": {
623 "apparmor": "scope-security1.json",
624 "scope": "fake-scope2"
625 }
626 }
627 }
628)foo";
62951
630#endif // FAKE_JSON_H52#endif // FAKE_JSON_H

Subscribers

People subscribed via source and target branches

to all changes: