def test_migrate(self):
        # Sanity check
        for obj in self.legacy_objs:
            guid_obj = Guid.load(obj._id)
            assert_equal(guid_obj.referent, obj)
        nobjs = OsfStorageGuidFile.find().count()
        main(dry_run=False)
        Guid._clear_caches()
        for obj in self.legacy_objs:
            guid_obj = Guid.load(obj._id)
            assert_not_equal(guid_obj.referent, obj)
            assert_true(isinstance(guid_obj.referent, OsfStorageGuidFile))
            assert_equal(guid_obj.referent.node, self.project)
            assert_equal(guid_obj.referent.path, obj.name)
            assert_equal(guid_obj.referent._id, obj._id)
        assert_equal(OsfStorageGuidFile.find().count(), nobjs + 3)
        # Test idempotence
        main(dry_run=False)
        assert_equal(OsfStorageGuidFile.find().count(), nobjs + 3)
dataset/ETHPy150Open CenterForOpenScience/osf.io/scripts/osfstorage/migrate_guids.py/TestMigrateGuids.test_migrate/original