diff options
author | Aleksey Lim <alsroot@sugarlabs.org> | 2012-10-07 15:18:09 (GMT) |
---|---|---|
committer | Aleksey Lim <alsroot@sugarlabs.org> | 2012-10-07 15:18:09 (GMT) |
commit | ad04812dee4b65cc2b7580c661b3e94bb50e8c60 (patch) | |
tree | 30ef2aa8e87bb1426902132b7ae99d764bce2842 /tests/units/volume.py | |
parent | 0455f6f0a8fda5586ac2b708acd68abda864b230 (diff) |
With --lazy-open populate didn't happends
Diffstat (limited to 'tests/units/volume.py')
-rwxr-xr-x | tests/units/volume.py | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/tests/units/volume.py b/tests/units/volume.py index aa01da0..2bceb99 100755 --- a/tests/units/volume.py +++ b/tests/units/volume.py @@ -2,11 +2,12 @@ # sugar-lint: disable import json +from os.path import exists from __init__ import tests import active_document as ad -from sugar_network import node +from sugar_network import node, sugar from sugar_network.toolkit.collection import Sequence from sugar_network.toolkit.sneakernet import InPacket, OutBufferPacket, DiskFull from sugar_network.resources.volume import Volume, Resource, Commands, Request @@ -334,6 +335,42 @@ class VolumeTest(tests.Test): ]), sorted(call(cp, method='GET', document='context', reply=['guid', 'icon', 'layer'])['result'])) + def test_Populate(self): + self.touch( + ('db/context/1/1/guid', '{"value": "1"}'), + ('db/context/1/1/ctime', '{"value": 1}'), + ('db/context/1/1/mtime', '{"value": 1}'), + ('db/context/1/1/seqno', '{"value": 0}'), + ) + + ds_path = sugar.profile_path('datastore') + self.touch(ds_path + '/index_updated') + self.touch((ds_path + '/2/2/metadata/uid', '2')) + + volume = Volume('db', lazy_open=True) + cp = TestCommands(volume) + + assert not exists('db/context/index') + assert not exists('db/artifact/index') + + self.assertEqual( + [], + call(cp, method='GET', document='context')['result']) + coroutine.dispatch() + self.assertEqual( + [{'guid': '1'}], + call(cp, method='GET', document='context')['result']) + assert exists('db/context/index') + + self.assertEqual( + [], + call(cp, method='GET', document='artifact')['result']) + coroutine.dispatch() + self.assertEqual( + [{'guid': '2'}], + call(cp, method='GET', document='artifact')['result']) + assert exists('db/artifact/index') + class TestCommands(ad.VolumeCommands, Commands): |