def test_deltas_for_shares_with_moves(self):
        """Test deltas for shares where nodes have been moved out of them."""
        # root nodes
        root = self.vgw.get_root()
        r_dir = self.vgw.make_subdirectory(root.id, 'dir')
        r_subdir = self.vgw.make_subdirectory(r_dir.id, 'subdir')
        r_file1 = self.vgw.make_file(r_dir.id, 'file.txt')
        # user
        user2 = make_storage_user(username='shareuser')
        share = self.vgw.make_share(r_dir.id, 'Shared', user2.id)
        user2_gw = StorageUserGateway(user2)
        share = user2_gw.accept_share(share.id)
        user_share_gw = user2_gw.get_volume_gateway(share=share)
        sh_delta = list(user_share_gw.get_generation_delta(0))
        sh_subdir = user_share_gw.get_node(r_subdir.id)
        sh_file1 = user_share_gw.get_node(r_file1.id)
        # just the file is in there now
        self.assertEqual(len(sh_delta), 2)
        self.assertTrue(sh_subdir in sh_delta)
        self.assertTrue(sh_file1 in sh_delta)
        # after a move out of the share, the file will still be in the delta
        # but it will be Dead
        self.vgw.move_node(r_file1.id, root.id, r_file1.name)
        sh_delta = list(user_share_gw.get_generation_delta(0))
        self.assertEqual(len(sh_delta), 2)
        self.assertTrue(sh_subdir in sh_delta)
        self.assertTrue(sh_file1 in sh_delta)
        self.assertTrue(sh_delta[1].id, sh_file1.id)
        self.assertTrue(sh_delta[1].status, STATUS_DEAD)
        # moving it back into the share in a different folder.
        # the file will be in the delta Live
        r_subdir2 = self.vgw.make_subdirectory(r_dir.id, 'subdir2')
        sh_subdir2 = user_share_gw.get_node(r_subdir2.id)
        self.vgw.move_node(r_file1.id, r_subdir2.id, r_file1.name)
        sh_delta = list(user_share_gw.get_generation_delta(0))
        self.assertEqual(len(sh_delta), 3)
        self.assertTrue(sh_subdir in sh_delta)
        self.assertTrue(sh_subdir2 in sh_delta)
        self.assertTrue(sh_file1 in sh_delta)
        self.assertTrue(sh_delta[2].id, sh_file1.id)
        self.assertTrue(sh_delta[2].status, STATUS_LIVE)
        # moving it within the share to the root.
        # the file will be in the delta Live
        self.vgw.move_node(r_file1.id, r_subdir.id, r_file1.name)
        sh_delta = list(user_share_gw.get_generation_delta(0))
        self.assertEqual(len(sh_delta), 3)
        self.assertTrue(sh_subdir in sh_delta)
        self.assertTrue(sh_subdir2 in sh_delta)
        self.assertTrue(sh_file1 in sh_delta)
        self.assertTrue(sh_delta[2].id, sh_file1.id)
        self.assertTrue(sh_delta[2].status, STATUS_LIVE)