Merge lp:~charlesk/keeper/upate-status-properties-pt-1 into lp:keeper
- upate-status-properties-pt-1
- Merge into trunk
Proposed by
Charles Kerr
Status: | Merged |
---|---|
Merge reported by: | Charles Kerr |
Merged at revision: | not available |
Proposed branch: | lp:~charlesk/keeper/upate-status-properties-pt-1 |
Merge into: | lp:keeper |
Diff against target: |
373 lines (+71/-77) 7 files modified
src/qdbus-stubs/com.canonical.keeper.User.xml (+13/-15) src/service/backup-choices.cpp (+8/-18) tests/com_canonical_keeper.py (+42/-29) tests/dbusmock/keeper-template-test.cpp (+0/-3) tests/unit/metadata-providers/user-dirs-test.cpp (+1/-3) tests/unit/tar/keeper-tar-create-test.cpp (+0/-1) tests/utils/keeper-dbusmock-fixture.h (+7/-8) |
To merge this branch: | bzr merge lp:~charlesk/keeper/upate-status-properties-pt-1 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Xavi Garcia (community) | Approve | ||
Unity API Team | Pending | ||
Review via email:
|
Commit message
Update what properties are provided by the com.canonical.
Description of the change
Update what properties are provided by the com.canonical.
The low-hanging fruit from https:/
We don't have anything implementing the state property maps in the service itself, so the card can't be completed yet. But now I can at least test the dbusmock template for an error state when the helper errors out :)
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/qdbus-stubs/com.canonical.keeper.User.xml' | |||
2 | --- src/qdbus-stubs/com.canonical.keeper.User.xml 2016-07-07 21:42:19 +0000 | |||
3 | +++ src/qdbus-stubs/com.canonical.keeper.User.xml 2016-07-28 19:50:41 +0000 | |||
4 | @@ -14,8 +14,7 @@ | |||
5 | 14 | as a map from opaque backup keys to key/value pairs | 14 | as a map from opaque backup keys to key/value pairs |
6 | 15 | of the choice’s properties, | 15 | of the choice’s properties, |
7 | 16 | including a ‘display-name’ string, | 16 | including a ‘display-name’ string, |
10 | 17 | ‘type’ string (‘application’, ‘system-data’, or ‘folder’) | 17 | ‘type’ string (‘application’, ‘system-data’, or ‘folder’).</doc:para> |
9 | 18 | and, when possible, an ‘icon’ symbolic icon string.</doc:para> | ||
11 | 19 | <doc:para>The choices should be presented to the user, | 18 | <doc:para>The choices should be presented to the user, |
12 | 20 | and the keys of those selected should be passed | 19 | and the keys of those selected should be passed |
13 | 21 | to StartBackup().</doc:para> | 20 | to StartBackup().</doc:para> |
14 | @@ -71,19 +70,18 @@ | |||
15 | 71 | <doc:description> | 70 | <doc:description> |
16 | 72 | <doc:para>Provides state information so the user interface can show | 71 | <doc:para>Provides state information so the user interface can show |
17 | 73 | the progress of backup or restore tasks.</doc:para> | 72 | the progress of backup or restore tasks.</doc:para> |
31 | 74 | <doc:para>State is a map of opaque backup keys to property maps, | 73 | <doc:para>State is a map of opaque backup keys to property maps. |
32 | 75 | which will contain a 'display-name' string and 'action' int32 | 74 | The property maps include: |
33 | 76 | whose possible values are queued(0), saving(1), | 75 | * 'action' (string): tells what the task is doing right now. |
34 | 77 | restoring(2), complete(3), stopped(4)</doc:para> | 76 | Possible values are 'queued', 'saving', 'restoring', |
35 | 78 | <doc:para>Some property maps may also have an 'item' string | 77 | 'cancelled', 'failed', and 'complete' |
36 | 79 | and a 'percent-done' double [0..1.0]. | 78 | * 'display-name' (string): human-readable task name, e.g. "Pictures" |
37 | 80 | For example if these are set to (1, “Photos”, 0.36), | 79 | * 'percent-done' (double): how much of this task is complete |
38 | 81 | the user interface could show “Backing up Photos (36%)”. | 80 | * 'speed' (int32): bytes per second |
39 | 82 | Clients should gracefully handle missing properties; | 81 | </doc:para> |
40 | 83 | eg a missing percent-done could instead show | 82 | <doc:para>If a task's 'action' state is 'failed' the property map also includes: |
41 | 84 | “Backing up Photos”.</doc:para> | 83 | * 'error' (string): a human-readable error message |
42 | 85 | <doc:para>A failed task's property map may also contain an 'error' | 84 | </doc:para> |
30 | 86 | string if set by the backup helpers.</doc:para> | ||
43 | 87 | </doc:description> | 85 | </doc:description> |
44 | 88 | </doc:doc> | 86 | </doc:doc> |
45 | 89 | </property> | 87 | </property> |
46 | 90 | 88 | ||
47 | === modified file 'src/service/backup-choices.cpp' | |||
48 | --- src/service/backup-choices.cpp 2016-07-07 14:04:38 +0000 | |||
49 | +++ src/service/backup-choices.cpp 2016-07-28 19:50:41 +0000 | |||
50 | @@ -59,12 +59,10 @@ | |||
51 | 59 | // | 59 | // |
52 | 60 | 60 | ||
53 | 61 | const auto type_key = QStringLiteral("type"); | 61 | const auto type_key = QStringLiteral("type"); |
54 | 62 | const auto icon_key = QStringLiteral("icon"); | ||
55 | 63 | const auto system_data_str = QStringLiteral("system-data"); | 62 | const auto system_data_str = QStringLiteral("system-data"); |
56 | 64 | { | 63 | { |
57 | 65 | Metadata m(generate_new_uuid(), "System Data"); // FIXME: how to i18n in a Qt DBus service? | 64 | Metadata m(generate_new_uuid(), "System Data"); // FIXME: how to i18n in a Qt DBus service? |
58 | 66 | m.set_property(type_key, system_data_str); | 65 | m.set_property(type_key, system_data_str); |
59 | 67 | m.set_property(icon_key, QStringLiteral("folder-system")); | ||
60 | 68 | ret.push_back(m); | 66 | ret.push_back(m); |
61 | 69 | } | 67 | } |
62 | 70 | 68 | ||
63 | @@ -129,10 +127,6 @@ | |||
64 | 129 | if (version != QJsonValue::Undefined) | 127 | if (version != QJsonValue::Undefined) |
65 | 130 | m.set_property(version_key, version.toString()); | 128 | m.set_property(version_key, version.toString()); |
66 | 131 | 129 | ||
67 | 132 | const auto icon = o[icon_key]; | ||
68 | 133 | if (icon != QJsonValue::Undefined) | ||
69 | 134 | m.set_property(icon_key, icon.toString()); | ||
70 | 135 | |||
71 | 136 | ret.push_back(m); | 130 | ret.push_back(m); |
72 | 137 | } | 131 | } |
73 | 138 | } | 132 | } |
74 | @@ -142,22 +136,19 @@ | |||
75 | 142 | // XDG User Directories | 136 | // XDG User Directories |
76 | 143 | // | 137 | // |
77 | 144 | 138 | ||
86 | 145 | const struct { | 139 | const std::array<QStandardPaths::StandardLocation,4> standard_locations = { |
87 | 146 | QStandardPaths::StandardLocation location; | 140 | QStandardPaths::DocumentsLocation, |
88 | 147 | QString icon; | 141 | QStandardPaths::MoviesLocation, |
89 | 148 | } standard_locations[] = { | 142 | QStandardPaths::PicturesLocation, |
90 | 149 | { QStandardPaths::DocumentsLocation, QStringLiteral("folder-documents") }, | 143 | QStandardPaths::MusicLocation |
83 | 150 | { QStandardPaths::MoviesLocation, QStringLiteral("folder-movies") }, | ||
84 | 151 | { QStandardPaths::PicturesLocation, QStringLiteral("folder-pictures") }, | ||
85 | 152 | { QStandardPaths::MusicLocation, QStringLiteral("folder-music") } | ||
91 | 153 | }; | 144 | }; |
92 | 154 | 145 | ||
93 | 155 | const auto path_key = QStringLiteral("path"); | 146 | const auto path_key = QStringLiteral("path"); |
94 | 156 | const auto user_folder_str = QStringLiteral("folder"); | 147 | const auto user_folder_str = QStringLiteral("folder"); |
96 | 157 | for (const auto& sl : standard_locations) | 148 | for (const auto& location : standard_locations) |
97 | 158 | { | 149 | { |
100 | 159 | const auto name = QStandardPaths::displayName(sl.location); | 150 | const auto name = QStandardPaths::displayName(location); |
101 | 160 | const auto locations = QStandardPaths::standardLocations(sl.location); | 151 | const auto locations = QStandardPaths::standardLocations(location); |
102 | 161 | if (locations.empty()) | 152 | if (locations.empty()) |
103 | 162 | { | 153 | { |
104 | 163 | qWarning() << "unable to find path for" << name; | 154 | qWarning() << "unable to find path for" << name; |
105 | @@ -168,7 +159,6 @@ | |||
106 | 168 | Metadata m(keystr, name); | 159 | Metadata m(keystr, name); |
107 | 169 | m.set_property(path_key, locations.front()); | 160 | m.set_property(path_key, locations.front()); |
108 | 170 | m.set_property(type_key, user_folder_str); | 161 | m.set_property(type_key, user_folder_str); |
109 | 171 | m.set_property(icon_key, sl.icon); | ||
110 | 172 | ret.push_back(m); | 162 | ret.push_back(m); |
111 | 173 | } | 163 | } |
112 | 174 | } | 164 | } |
113 | 175 | 165 | ||
114 | === modified file 'tests/com_canonical_keeper.py' | |||
115 | --- tests/com_canonical_keeper.py 2016-07-21 04:21:47 +0000 | |||
116 | +++ tests/com_canonical_keeper.py 2016-07-28 19:50:41 +0000 | |||
117 | @@ -5,6 +5,7 @@ | |||
118 | 5 | import socket | 5 | import socket |
119 | 6 | import subprocess | 6 | import subprocess |
120 | 7 | import sys | 7 | import sys |
121 | 8 | import time | ||
122 | 8 | from dbusmock import OBJECT_MANAGER_IFACE, mockobject | 9 | from dbusmock import OBJECT_MANAGER_IFACE, mockobject |
123 | 9 | from gi.repository import GLib | 10 | from gi.repository import GLib |
124 | 10 | 11 | ||
125 | @@ -36,17 +37,19 @@ | |||
126 | 36 | MAIN_OBJ = SERVICE_PATH | 37 | MAIN_OBJ = SERVICE_PATH |
127 | 37 | SYSTEM_BUS = False | 38 | SYSTEM_BUS = False |
128 | 38 | 39 | ||
134 | 39 | ACTION_QUEUED = 0 | 40 | ACTION_QUEUED = 'queued' |
135 | 40 | ACTION_SAVING = 1 | 41 | ACTION_SAVING = 'saving' |
136 | 41 | ACTION_RESTORING = 2 | 42 | ACTION_RESTORING = 'restoring' |
137 | 42 | ACTION_COMPLETE = 3 | 43 | ACTION_CANCELLED = 'cancelled' |
138 | 43 | ACTION_STOPPED = 4 | 44 | ACTION_FAILED = 'failed' |
139 | 45 | ACTION_COMPLETE = 'complete' | ||
140 | 44 | 46 | ||
141 | 47 | KEY_ACTION = 'action' | ||
142 | 45 | KEY_CTIME = 'ctime' | 48 | KEY_CTIME = 'ctime' |
143 | 46 | KEY_BLOB = 'blob-data' | 49 | KEY_BLOB = 'blob-data' |
144 | 47 | KEY_HELPER = 'helper-exec' | 50 | KEY_HELPER = 'helper-exec' |
145 | 48 | KEY_ICON = 'icon' | ||
146 | 49 | KEY_NAME = 'display-name' | 51 | KEY_NAME = 'display-name' |
147 | 52 | KEY_SPEED = 'speed' | ||
148 | 50 | KEY_SIZE = 'size' | 53 | KEY_SIZE = 'size' |
149 | 51 | KEY_SUBTYPE = 'subtype' | 54 | KEY_SUBTYPE = 'subtype' |
150 | 52 | KEY_TYPE = 'type' | 55 | KEY_TYPE = 'type' |
151 | @@ -179,21 +182,9 @@ | |||
152 | 179 | def user_build_state(user): | 182 | def user_build_state(user): |
153 | 180 | """Returns a generated state dictionary. | 183 | """Returns a generated state dictionary. |
154 | 181 | 184 | ||
170 | 182 | State is a map of opaque backup keys to property maps, | 185 | State is a map of opaque backup keys to property maps. |
171 | 183 | which will contain a 'display-name' string and 'action' int | 186 | See the documentation for com.canonical.keeper.User's |
172 | 184 | whose possible values are queued(0), saving(1), | 187 | State() method for more information. |
158 | 185 | restoring(2), complete(3), and stopped(4). | ||
159 | 186 | |||
160 | 187 | Some property maps may also have an 'item' string | ||
161 | 188 | and a 'percent-done' double [0..1.0]. | ||
162 | 189 | For example if these are set to (1, "Photos", 0.36), | ||
163 | 190 | the user interface could show "Backing up Photos (36%)". | ||
164 | 191 | Clients should gracefully handle missing properties; | ||
165 | 192 | eg a missing percent-done could instead show | ||
166 | 193 | "Backing up Photos". | ||
167 | 194 | |||
168 | 195 | A failed task's property map may also contain an 'error' | ||
169 | 196 | string if set by the backup helpers. | ||
173 | 197 | """ | 188 | """ |
174 | 198 | 189 | ||
175 | 199 | tasks_states = {} | 190 | tasks_states = {} |
176 | @@ -208,9 +199,9 @@ | |||
177 | 208 | action = ACTION_RESTORING | 199 | action = ACTION_RESTORING |
178 | 209 | elif uuid in user.remaining_tasks: | 200 | elif uuid in user.remaining_tasks: |
179 | 210 | action = ACTION_QUEUED | 201 | action = ACTION_QUEUED |
181 | 211 | else: # FIXME: 'ACTION_STOPPED' not handled yet | 202 | else: # fixme: handle ACTION_CANCELLED, ACTION_FAILED |
182 | 212 | action = ACTION_COMPLETE | 203 | action = ACTION_COMPLETE |
184 | 213 | task_state['action'] = dbus.Int32(action) | 204 | task_state[KEY_ACTION] = dbus.String(action) |
185 | 214 | 205 | ||
186 | 215 | # get the task's display-name | 206 | # get the task's display-name |
187 | 216 | choice = user.backup_choices.get(uuid, None) | 207 | choice = user.backup_choices.get(uuid, None) |
188 | @@ -221,7 +212,22 @@ | |||
189 | 221 | display_name = choice.get(KEY_NAME, None) | 212 | display_name = choice.get(KEY_NAME, None) |
190 | 222 | task_state[KEY_NAME] = dbus.String(display_name) | 213 | task_state[KEY_NAME] = dbus.String(display_name) |
191 | 223 | 214 | ||
192 | 215 | # speed | ||
193 | 216 | helper = mockobject.objects[HELPER_PATH] | ||
194 | 217 | if (uuid == user.current_task) and helper.work: | ||
195 | 218 | n_secs = 2 | ||
196 | 219 | n_bytes = 0 | ||
197 | 220 | too_old = time.time() - n_secs | ||
198 | 221 | for key in helper.work.bytes_per_second: | ||
199 | 222 | if key > too_old: | ||
200 | 223 | n_bytes += helper.work.bytes_per_second[key] | ||
201 | 224 | bytes_per_second = n_bytes / n_secs | ||
202 | 225 | else: | ||
203 | 226 | bytes_per_second = 0 | ||
204 | 227 | task_state[KEY_SPEED] = dbus.Int32(bytes_per_second) | ||
205 | 228 | |||
206 | 224 | # FIXME: use a real percentage here | 229 | # FIXME: use a real percentage here |
207 | 230 | # FIXME: handle ACTION_CANCELLED, ACTION_FAILED | ||
208 | 225 | if action == ACTION_COMPLETE: | 231 | if action == ACTION_COMPLETE: |
209 | 226 | percent_done = dbus.Double(1.0) | 232 | percent_done = dbus.Double(1.0) |
210 | 227 | elif action == ACTION_SAVING or action == ACTION_RESTORING: | 233 | elif action == ACTION_SAVING or action == ACTION_RESTORING: |
211 | @@ -256,6 +262,7 @@ | |||
212 | 256 | n_left = None | 262 | n_left = None |
213 | 257 | sock = None | 263 | sock = None |
214 | 258 | uuid = None | 264 | uuid = None |
215 | 265 | bytes_per_second = None | ||
216 | 259 | 266 | ||
217 | 260 | 267 | ||
218 | 261 | def helper_periodic_func(helper): | 268 | def helper_periodic_func(helper): |
219 | @@ -265,10 +272,15 @@ | |||
220 | 265 | 272 | ||
221 | 266 | # try to read a bit | 273 | # try to read a bit |
222 | 267 | chunk = helper.work.sock.recv(4096*2) | 274 | chunk = helper.work.sock.recv(4096*2) |
224 | 268 | if len(chunk): | 275 | chunk_len = len(chunk) |
225 | 276 | if chunk_len: | ||
226 | 269 | helper.work.chunks.append(chunk) | 277 | helper.work.chunks.append(chunk) |
229 | 270 | helper.work.n_left -= len(chunk) | 278 | helper.work.n_left -= chunk_len |
230 | 271 | helper.log('got %s bytes; %s left' % (len(chunk), helper.work.n_left)) | 279 | key = int(time.time()) |
231 | 280 | old_n_bytes = helper.work.bytes_per_second.get(key, 0) | ||
232 | 281 | new_n_bytes = old_n_bytes + chunk_len | ||
233 | 282 | helper.work.bytes_per_second[key] = new_n_bytes | ||
234 | 283 | helper.log('got %s bytes; %s left' % (chunk_len, helper.work.n_left)) | ||
235 | 272 | 284 | ||
236 | 273 | # cleanup if done | 285 | # cleanup if done |
237 | 274 | done = helper.work.n_left <= 0 | 286 | done = helper.work.n_left <= 0 |
238 | @@ -284,7 +296,7 @@ | |||
239 | 284 | user.start_next_task(user) | 296 | user.start_next_task(user) |
240 | 285 | helper.work = None | 297 | helper.work = None |
241 | 286 | 298 | ||
243 | 287 | if len(chunk) or done: | 299 | if chunk_len or done: |
244 | 288 | user = mockobject.objects[USER_PATH] | 300 | user = mockobject.objects[USER_PATH] |
245 | 289 | user.update_state_property(user) | 301 | user.update_state_property(user) |
246 | 290 | 302 | ||
247 | @@ -306,6 +318,7 @@ | |||
248 | 306 | work.n_left = n_bytes | 318 | work.n_left = n_bytes |
249 | 307 | work.sock = parent | 319 | work.sock = parent |
250 | 308 | work.uuid = mockobject.objects[USER_PATH].current_task | 320 | work.uuid = mockobject.objects[USER_PATH].current_task |
251 | 321 | work.bytes_per_second = {} | ||
252 | 309 | helper.work = work | 322 | helper.work = work |
253 | 310 | 323 | ||
254 | 311 | # start checking periodically | 324 | # start checking periodically |
255 | @@ -325,7 +338,7 @@ | |||
256 | 325 | 338 | ||
257 | 326 | def mock_add_backup_choice(mock, uuid, props): | 339 | def mock_add_backup_choice(mock, uuid, props): |
258 | 327 | 340 | ||
260 | 328 | keys = [KEY_NAME, KEY_TYPE, KEY_SUBTYPE, KEY_ICON, KEY_HELPER] | 341 | keys = [KEY_NAME, KEY_TYPE, KEY_SUBTYPE, KEY_HELPER] |
261 | 329 | if set(keys) != set(props.keys()): | 342 | if set(keys) != set(props.keys()): |
262 | 330 | badarg('need props: %s got %s' % (keys, props.keys())) | 343 | badarg('need props: %s got %s' % (keys, props.keys())) |
263 | 331 | 344 | ||
264 | @@ -339,7 +352,7 @@ | |||
265 | 339 | 352 | ||
266 | 340 | def mock_add_restore_choice(mock, uuid, props): | 353 | def mock_add_restore_choice(mock, uuid, props): |
267 | 341 | 354 | ||
269 | 342 | keys = [KEY_NAME, KEY_TYPE, KEY_SUBTYPE, KEY_ICON, KEY_HELPER, | 355 | keys = [KEY_NAME, KEY_TYPE, KEY_SUBTYPE, KEY_HELPER, |
270 | 343 | KEY_SIZE, KEY_CTIME, KEY_BLOB] | 356 | KEY_SIZE, KEY_CTIME, KEY_BLOB] |
271 | 344 | if set(keys) != set(props.keys()): | 357 | if set(keys) != set(props.keys()): |
272 | 345 | badarg('need props: %s got %s' % (keys, props.keys())) | 358 | badarg('need props: %s got %s' % (keys, props.keys())) |
273 | 346 | 359 | ||
274 | === modified file 'tests/dbusmock/keeper-template-test.cpp' | |||
275 | --- tests/dbusmock/keeper-template-test.cpp 2016-07-27 10:13:02 +0000 | |||
276 | +++ tests/dbusmock/keeper-template-test.cpp 2016-07-28 19:50:41 +0000 | |||
277 | @@ -51,7 +51,6 @@ | |||
278 | 51 | { KEY_NAME, QStringLiteral("some-name") }, | 51 | { KEY_NAME, QStringLiteral("some-name") }, |
279 | 52 | { KEY_TYPE, QStringLiteral("some-type") }, | 52 | { KEY_TYPE, QStringLiteral("some-type") }, |
280 | 53 | { KEY_SUBTYPE, QStringLiteral("some-subtype") }, | 53 | { KEY_SUBTYPE, QStringLiteral("some-subtype") }, |
281 | 54 | { KEY_ICON, QStringLiteral("some-icon") }, | ||
282 | 55 | { KEY_HELPER, QString::fromUtf8(FAKE_BACKUP_HELPER_EXEC) } | 54 | { KEY_HELPER, QString::fromUtf8(FAKE_BACKUP_HELPER_EXEC) } |
283 | 56 | }; | 55 | }; |
284 | 57 | 56 | ||
285 | @@ -90,7 +89,6 @@ | |||
286 | 90 | { KEY_NAME, QStringLiteral("some-name") }, | 89 | { KEY_NAME, QStringLiteral("some-name") }, |
287 | 91 | { KEY_TYPE, QStringLiteral("some-type") }, | 90 | { KEY_TYPE, QStringLiteral("some-type") }, |
288 | 92 | { KEY_SUBTYPE, QStringLiteral("some-subtype") }, | 91 | { KEY_SUBTYPE, QStringLiteral("some-subtype") }, |
289 | 93 | { KEY_ICON, QStringLiteral("some-icon") }, | ||
290 | 94 | { KEY_HELPER, QString::fromUtf8("/dev/null") }, | 92 | { KEY_HELPER, QString::fromUtf8("/dev/null") }, |
291 | 95 | { KEY_SIZE, quint64(blob.size()) }, | 93 | { KEY_SIZE, quint64(blob.size()) }, |
292 | 96 | { KEY_CTIME, quint64(time(nullptr)) }, | 94 | { KEY_CTIME, quint64(time(nullptr)) }, |
293 | @@ -143,7 +141,6 @@ | |||
294 | 143 | { KEY_NAME, QStringLiteral("Music") }, | 141 | { KEY_NAME, QStringLiteral("Music") }, |
295 | 144 | { KEY_TYPE, QStringLiteral("folder") }, | 142 | { KEY_TYPE, QStringLiteral("folder") }, |
296 | 145 | { KEY_SUBTYPE, sandbox.path() }, | 143 | { KEY_SUBTYPE, sandbox.path() }, |
297 | 146 | { KEY_ICON, QStringLiteral("music-icon") }, | ||
298 | 147 | { KEY_HELPER, QString::fromUtf8(FAKE_BACKUP_HELPER_EXEC) } | 144 | { KEY_HELPER, QString::fromUtf8(FAKE_BACKUP_HELPER_EXEC) } |
299 | 148 | }; | 145 | }; |
300 | 149 | 146 | ||
301 | 150 | 147 | ||
302 | === modified file 'tests/unit/metadata-providers/user-dirs-test.cpp' | |||
303 | --- tests/unit/metadata-providers/user-dirs-test.cpp 2016-07-01 15:17:06 +0000 | |||
304 | +++ tests/unit/metadata-providers/user-dirs-test.cpp 2016-07-28 19:50:41 +0000 | |||
305 | @@ -70,13 +70,11 @@ | |||
306 | 70 | 70 | ||
307 | 71 | // confirm that choices has the advertised public properties | 71 | // confirm that choices has the advertised public properties |
308 | 72 | const auto type_str = QStringLiteral("type"); | 72 | const auto type_str = QStringLiteral("type"); |
309 | 73 | const auto icon_str = QStringLiteral("icon"); | ||
310 | 74 | for(const auto& choice : choices) | 73 | for(const auto& choice : choices) |
311 | 75 | { | 74 | { |
312 | 76 | ASSERT_FALSE(choice.key().isEmpty()); | 75 | ASSERT_FALSE(choice.key().isEmpty()); |
313 | 77 | ASSERT_FALSE(choice.display_name().isEmpty()); | 76 | ASSERT_FALSE(choice.display_name().isEmpty()); |
314 | 78 | ASSERT_TRUE(choice.has_property(type_str)); | 77 | ASSERT_TRUE(choice.has_property(type_str)); |
315 | 79 | EXPECT_TRUE(choice.has_property(icon_str)); | ||
316 | 80 | } | 78 | } |
317 | 81 | 79 | ||
318 | 82 | // confirm that we have a system-data choice | 80 | // confirm that we have a system-data choice |
319 | @@ -86,7 +84,7 @@ | |||
320 | 86 | break; | 84 | break; |
321 | 87 | ASSERT_TRUE(i != n); | 85 | ASSERT_TRUE(i != n); |
322 | 88 | auto system_data = choices[i]; | 86 | auto system_data = choices[i]; |
324 | 89 | EXPECT_TRUE(system_data.has_property(icon_str)); | 87 | EXPECT_TRUE(system_data.has_property(type_str)); |
325 | 90 | 88 | ||
326 | 91 | // confirm that we have user-dir choices | 89 | // confirm that we have user-dir choices |
327 | 92 | std::set<QString> expected_user_dir_display_names = { | 90 | std::set<QString> expected_user_dir_display_names = { |
328 | 93 | 91 | ||
329 | === modified file 'tests/unit/tar/keeper-tar-create-test.cpp' | |||
330 | --- tests/unit/tar/keeper-tar-create-test.cpp 2016-07-22 13:49:34 +0000 | |||
331 | +++ tests/unit/tar/keeper-tar-create-test.cpp 2016-07-28 19:50:41 +0000 | |||
332 | @@ -43,7 +43,6 @@ | |||
333 | 43 | // tell keeper that's a backup choice | 43 | // tell keeper that's a backup choice |
334 | 44 | const auto uuid = add_backup_choice(QMap<QString,QVariant>{ | 44 | const auto uuid = add_backup_choice(QMap<QString,QVariant>{ |
335 | 45 | { KEY_NAME, QDir(in.path()).dirName() }, | 45 | { KEY_NAME, QDir(in.path()).dirName() }, |
336 | 46 | { KEY_ICON, QStringLiteral("folder") }, | ||
337 | 47 | { KEY_TYPE, QStringLiteral("folder") }, | 46 | { KEY_TYPE, QStringLiteral("folder") }, |
338 | 48 | { KEY_SUBTYPE, in.path() }, | 47 | { KEY_SUBTYPE, in.path() }, |
339 | 49 | { KEY_HELPER, QString::fromUtf8(KEEPER_TAR_CREATE_INVOKE) } | 48 | { KEY_HELPER, QString::fromUtf8(KEEPER_TAR_CREATE_INVOKE) } |
340 | 50 | 49 | ||
341 | === modified file 'tests/utils/keeper-dbusmock-fixture.h' | |||
342 | --- tests/utils/keeper-dbusmock-fixture.h 2016-07-22 13:47:58 +0000 | |||
343 | +++ tests/utils/keeper-dbusmock-fixture.h 2016-07-28 19:50:41 +0000 | |||
344 | @@ -37,22 +37,21 @@ | |||
345 | 37 | #define KEY_CTIME "ctime" | 37 | #define KEY_CTIME "ctime" |
346 | 38 | #define KEY_BLOB "blob-data" | 38 | #define KEY_BLOB "blob-data" |
347 | 39 | #define KEY_HELPER "helper-exec" | 39 | #define KEY_HELPER "helper-exec" |
348 | 40 | #define KEY_ICON "icon" | ||
349 | 41 | #define KEY_NAME "display-name" | 40 | #define KEY_NAME "display-name" |
350 | 42 | #define KEY_PERCENT "percent-done" | 41 | #define KEY_PERCENT "percent-done" |
351 | 43 | #define KEY_SIZE "size" | 42 | #define KEY_SIZE "size" |
352 | 43 | #define KEY_SPEED "speed" | ||
353 | 44 | #define KEY_SUBTYPE "subtype" | 44 | #define KEY_SUBTYPE "subtype" |
354 | 45 | #define KEY_TYPE "type" | 45 | #define KEY_TYPE "type" |
355 | 46 | #define KEY_UUID "uuid" | 46 | #define KEY_UUID "uuid" |
356 | 47 | 47 | ||
357 | 48 | // FIXME: this should go in a shared header in include/ | 48 | // FIXME: this should go in a shared header in include/ |
365 | 49 | enum | 49 | static constexpr char const * ACTION_QUEUED = {"queued"}; |
366 | 50 | { | 50 | static constexpr char const * ACTION_SAVING = {"saving"}; |
367 | 51 | ACTION_QUEUED = 0, | 51 | static constexpr char const * ACTION_RESTORING = {"restoring"}; |
368 | 52 | ACTION_SAVING = 1, | 52 | static constexpr char const * ACTION_CANCELLED = {"cancelled"}; |
369 | 53 | ACTION_RESTORING = 2, | 53 | static constexpr char const * ACTION_FAILED = {"failed"}; |
370 | 54 | ACTION_IDLE = 3 | 54 | static constexpr char const * ACTION_COMPLETE = {"complete"}; |
364 | 55 | }; | ||
371 | 56 | 55 | ||
372 | 57 | using namespace QtDBusMock; | 56 | using namespace QtDBusMock; |
373 | 58 | using namespace QtDBusTest; | 57 | using namespace QtDBusTest; |
I'm not sure if after landing this I will have conflicts with my branch: /code.launchpad .net/~xavi- garcia- mena/keeper/ using-cwd- and-user- startbackup/ +merge/ 301496
https:/
It looks good and your branch was first, so... let's merge it. :)