Ejemplo n.º 1
0
def registration_approval(provider=None):
    if provider is None:
        return RegistrationApprovalFactory()
    sanction = RegistrationApprovalFactory()
    registration = sanction.target_registration
    registration.provider = provider
    registration.update_moderation_state()
    registration.save()
    return sanction
Ejemplo n.º 2
0
 def registration_approval(self, provider):
     sanction = RegistrationApprovalFactory()
     registration = sanction.target_registration
     registration.provider = provider
     registration.update_moderation_state()
     registration.save()
     return sanction
Ejemplo n.º 3
0
    def setUp(self):
        self.maxDiff = None
        super(TestRegistrationUpdate, self).setUp()
        self.user = AuthUserFactory()

        self.user_two = AuthUserFactory()
        self.user_three = AuthUserFactory()

        self.registration_approval = RegistrationApprovalFactory(state='unapproved', approve=False, user=self.user)
        self.unapproved_registration = Registration.find_one(Q('registration_approval', 'eq', self.registration_approval))
        self.unapproved_url = '/{}registrations/{}/'.format(API_BASE, self.unapproved_registration._id)

        self.public_project = ProjectFactory(title="Project One", is_public=True, creator=self.user)
        self.private_project = ProjectFactory(title="Project Two", is_public=False, creator=self.user)
        self.public_registration = RegistrationFactory(project=self.public_project, creator=self.user, is_public=True)
        self.private_registration = RegistrationFactory(project=self.private_project, creator=self.user)
        self.public_url = '/{}registrations/{}/'.format(API_BASE, self.public_registration._id)
        self.private_url = '/{}registrations/{}/'.format(API_BASE, self.private_registration._id)

        self.private_registration.add_contributor(self.user_two, permissions=[permissions.READ])
        self.private_registration.add_contributor(self.user_three, permissions=[permissions.WRITE])
        self.private_registration.save()

        self.payload = {
            "data": {
                "id": self.private_registration._id,
                "type": "registrations",
                "attributes": {
                    "public": True,
                }
            }
        }
    def setUp(self):
        super().setUp()
        self.embargo = EmbargoFactory()
        self.registration_approval = RegistrationApprovalFactory()
        self.retraction = RetractionFactory()
        self.embargo_termination = EmbargoTerminationApprovalFactory()
        self.provider = RegistrationProviderFactory()

        for sanction in [self.embargo, self.registration_approval, self.retraction, self.embargo_termination]:
            registration = sanction.target_registration
            registration.provider = self.provider
            registration.save()

        # EmbargoTerminationFactory actually calls terminate_embargo,
        # which updates state in the new world
        self.embargo_termination.target_registration.moderation_state = RegistrationModerationStates.INITIAL.db_name
        self.embargo_termination.target_registration.save()
 def registration_approval(self, user):
     return RegistrationApprovalFactory(state='unapproved',
                                        approve=False,
                                        user=user)
Ejemplo n.º 6
0
 def registration_approval(self):
     return RegistrationApprovalFactory()