def _create_inclusion_requests(comms, record): """Create inclusion requests for communities. :param comms: Community IDs for which the inclusion requests might should be created (if they don't exist already). :type comms: list of str :param record: Record corresponding to this deposit. :type record: `invenio_records.api.Record` """ for comm_id in comms: comm = Community.get(comm_id) if not InclusionRequest.get(comm_id, record.id): InclusionRequest.create(comm, record)
def _create_inclusion_requests(comms, record): """Create inclusion requests for communities. :param comms: Community IDs for which the inclusion requests might should be created (if they don't exist already). :type comms: list of str :param record: Record corresponding to this deposit. :type record: `invenio_records.api.Record` """ for comm_id in comms: comm = Community.get(comm_id) if not InclusionRequest.get(comm_id, record.id): InclusionRequest.create(comm, record)
def test_community_delete_task(app, db, communities): """Test the community deletion task.""" (comm1, comm2, comm3) = communities communities_key = app.config["COMMUNITIES_RECORD_KEY"] rec1 = Record.create({'title': 'Foobar'}) InclusionRequest.create(community=comm1, record=rec1, notify=False) assert InclusionRequest.get(comm1.id, rec1.id) comm1.accept_record(rec1) assert 'comm1' in rec1[communities_key] comm1.delete() assert comm1.is_deleted
def test_community_delete_task(app, db, communities): """Test the community deletion task.""" (comm1, comm2, comm3) = communities communities_key = app.config["COMMUNITIES_RECORD_KEY"] rec1 = Record.create({'title': 'Foobar'}) InclusionRequest.create(community=comm1, record=rec1, notify=False) assert InclusionRequest.get(comm1.id, rec1.id) comm1.accept_record(rec1) assert 'comm1' in rec1[communities_key] comm1.delete() assert comm1.is_deleted