~didrocks/ubuntuone-client/dont-suffer-zg-crash

« back to all changes in this revision

Viewing changes to tests/syncdaemon/test_sync.py

  • Committer: Bazaar Package Importer
  • Author(s): Rodney Dawes
  • Date: 2011-01-25 16:42:52 UTC
  • mto: This revision was merged to the branch mainline in revision 64.
  • Revision ID: james.westby@ubuntu.com-20110125164252-rl1pybasx1nsqgoy
Tags: upstream-1.5.3
ImportĀ upstreamĀ versionĀ 1.5.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
    FakeMain,
36
36
    FakeVolumeManager,
37
37
    BaseTwistedTestCase,
38
 
    MementoHandler,
39
38
    Listener,
40
39
)
41
40
 
 
41
from ubuntuone.devtools.handlers import MementoHandler
42
42
from ubuntuone.syncdaemon.filesystem_manager import FileSystemManager
43
43
from ubuntuone.syncdaemon.tritcask import Tritcask
44
44
from ubuntuone.syncdaemon.fsm import fsm as fsm_module
340
340
        mdobj = self.fsm.get_by_mdid(mdid)
341
341
        self.sync._handle_SV_HASH_NEW(mdobj.share_id, mdobj.node_id, '')
342
342
        self.assertTrue(self.called)
 
343
        
 
344
    def test_SV_HASH_NEW_with_file_uploadinterrupted_coverage(self):
 
345
        """A SV_HASH_NEW is received after upload interrupted."""
 
346
        self.called = False
 
347
        
 
348
        # create a file and put it in local, without server_hash, as
 
349
        # if the upload was cut in the middle after the make file
 
350
        somepath = os.path.join(self.root, 'somepath')
 
351
        mdid = self.fsm.create(somepath, '', node_id='node_id')
 
352
        self.fsm.set_by_mdid(mdid, local_hash='somehash', crc32='crc32',
 
353
                             stat='stat', size='size')
343
354
 
 
355
        # send the event with no content and check
 
356
        mdobj = self.fsm.get_by_mdid(mdid)
 
357
        self.sync._handle_SV_HASH_NEW(mdobj.share_id, mdobj.node_id, '')
 
358
        
344
359
    def test_AQ_FILE_NEW_OK_with_md_in_none(self):
345
360
        """Created the file, and MD says it's in NONE."""
346
361
        # fake method