~didrocks/ubuntuone-client/use_result_var

« back to all changes in this revision

Viewing changes to tests/syncdaemon/test_fsm.py

  • Committer: Bazaar Package Importer
  • Author(s): Rodney Dawes
  • Date: 2011-03-18 15:32:09 UTC
  • mfrom: (1.1.47 upstream)
  • Revision ID: james.westby@ubuntu.com-20110318153209-eiao2x342xppviid
Tags: 1.5.7-0ubuntu1
* New upstream release.
  - Connection notifications are pointless (LP: #734895)
  - Use a single platform Notification instance (LP: #734985)
* 01_reset-udf-typeerror.patch:
  - Removed patch which is now included upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
610
610
        self.assertEqual(newmdobj.generation, None)
611
611
        # check that the trash is the same:
612
612
        self.assertEqual(self.fsm.trash,
613
 
                         {("share", "uuid_1"): (mdid_1, "parent", path_1)})
 
613
                         {("share", "uuid_1"):
 
614
                                (mdid_1, "parent", path_1, False)})
614
615
        self.assertEqual(list(self.fsm.get_iter_trash()),
615
 
                         [("share", "uuid_1", "parent", path_1)])
 
616
                         [("share", "uuid_1", "parent", path_1, False)])
616
617
        # check the move limbo
617
618
        expected = [(("share", "uuid_1"),
618
619
                    ("old_parent", "new_parent", "new_name", "pfrom", "pto"))]
669
670
        self.assertEqual(newmdobj.generation, None)
670
671
        # check that the trash is the same:
671
672
        self.assertEqual(self.fsm.trash,
672
 
                         {("share", "uuid_1"): (mdid_1, "parent", path_1)})
 
673
                         {("share", "uuid_1"):
 
674
                                (mdid_1, "parent", path_1, False)})
673
675
        self.assertEqual(list(self.fsm.get_iter_trash()),
674
 
                         [("share", "uuid_1", "parent", path_1)])
 
676
                         [("share", "uuid_1", "parent", path_1, False)])
675
677
        # check the move limbo
676
678
        expected = [(("share", "uuid_1"),
677
679
                    ("old_parent", "new_parent", "new_name", "pfrom", "pto"))]
2096
2098
        # check that the info for the overwritten one is gone to trash
2097
2099
        self.assert_no_metadata(mdid2, testfile1, "share", "uuid2")
2098
2100
        self.assertEqual(self.fsm.trash[(self.share.id, "uuid2")],
2099
 
                         (mdid2, self.share.node_id, testfile2))
 
2101
                         (mdid2, self.share.node_id, testfile2, False))
2100
2102
 
2101
2103
    def test_move_file_withdir(self):
2102
2104
        """Test that a dir is moved from one point to the other."""
2420
2422
        self.fsm.delete_to_trash(mdid, "parent")
2421
2423
        self.assertFalse(self.fsm.has_metadata(mdid=mdid))
2422
2424
        self.assertEqual(self.fsm.trash,
2423
 
                         {("share", "uuid"): (mdid, "parent", testfile)})
 
2425
                         {("share", "uuid"):
 
2426
                                (mdid, "parent", testfile, False)})
2424
2427
        self.assertEqual(list(self.fsm.get_iter_trash()),
2425
 
                         [("share", "uuid", "parent", testfile)])
 
2428
                         [("share", "uuid", "parent", testfile, False)])
2426
2429
        self.assertTrue(self.fsm.node_in_trash("share", "uuid"))
2427
2430
 
2428
2431
        # remove from trash
2432
2435
        self.assertEqual(list(self.fsm.get_iter_trash()), [])
2433
2436
        self.assertFalse(self.fsm.node_in_trash("share", "uuid"))
2434
2437
 
2435
 
    def test_trash_old(self):
2436
 
        """Test that get_iter_trash supports old trash."""
 
2438
    def test_trash_older(self):
 
2439
        """get_iter_trash supports older trash (no is_dir)."""
 
2440
        self.fsm.trash  = {("share", "uuid"): ("mdid", "parent", "path1")}
 
2441
        self.assertEqual(list(self.fsm.get_iter_trash()),
 
2442
                         [("share", "uuid", "parent", "path1", False)])
 
2443
 
 
2444
    def test_trash_oldest(self):
 
2445
        """get_iter_trash supports oldest trash (no is_dir nor path)."""
2437
2446
        self.fsm.trash  = {("share", "uuid"): ("mdid", "parent")}
2438
2447
        self.assertEqual(list(self.fsm.get_iter_trash()),
2439
 
                         [("share", "uuid", "parent", "fake_unblocking_path")])
 
2448
                         [("share", "uuid", "parent", "fake_unblocking_path",
 
2449
                           False)])
2440
2450
 
2441
2451
    def test_trash_with_node_in_none(self):
2442
2452
        """Test that in trash is saved the marker if node_id is None."""
2448
2458
        self.fsm.delete_to_trash(mdid, "parent")
2449
2459
        marker = MDMarker(mdid)
2450
2460
        self.assertEqual(self.fsm.trash,
2451
 
                         {("share", marker): (mdid, "parent", testfile)})
 
2461
                         {("share", marker):
 
2462
                                (mdid, "parent", testfile, False)})
2452
2463
 
2453
2464
    def test_dereference_ok_limbos_none(self):
2454
2465
        """Limbos' markers ok dereferencing is fine if no marker at all."""