def testArchiveSetNull(self):

        assertEqual = self.assertEqual
        assertNotEqual = self.assertNotEqual
        assertTrue = self.assertTrue
        assertFalse = self.assertFalse

        s3db = current.s3db
        s3db.clear_config("del_master", "super_entity")

        master_id = self.master_id

        # Define component table
        s3db.define_table("del_component",
                          Field("del_master_id",
                                s3db.del_master,
                                ondelete="SET NULL"),
                          *s3_meta_fields())
        component = s3db["del_component"]
        s3db.add_components("del_master",
                            del_component="del_master_id")

        try:
            # Create a component record
            component_id = component.insert(del_master_id=master_id)
            component_record = component[component_id]
            assertNotEqual(component_record, None)
            current.db.commit()

            # Delete the master record
            resource = s3db.resource("del_master", id=master_id)
            success = resource.delete()
            assertEqual(success, 1)
            assertEqual(resource.error, None)

            # Master record is deleted
            table = s3db.del_master
            record = table[master_id]
            assertTrue(record.deleted)

            # Component record is not deleted, but unlinked
            component_record = component[component_id]
            assertFalse(component_record.deleted)
            assertEqual(component_record.del_master_id, None)

            # Check callbacks
            assertEqual(self.master_deleted, master_id)
            assertEqual(self.super_deleted, 0)
            assertEqual(self.component_deleted, 0)

        finally:
            component.drop()
            del current.model.components["del_master"]["component"]

    # -------------------------------------------------------------------------
Test archiving of a record which is referenced by
dataset/ETHPy150Open sahana/eden/modules/unit_tests/s3/s3resource.py/ResourceDeleteTests.testArchiveSetNull