def test_should_not_approve_pending_registration_less_than_48_hours_old(self):
        # RegistrationApproval#iniation_date is read only
        self.registration.registration_approval.initiation_date = timezone.now() - timedelta(hours=47)
        self.registration.registration_approval.save()
        assert_false(self.registration.is_registration_approved)

        main(dry_run=False)
        assert_false(self.registration.is_registration_approved)
Пример #2
0
    def test_should_approve_pending_registration_more_than_48_hours_old(self):
        self.registration.registration_approval.initiation_date = timezone.now(
        ) - timedelta(days=365)
        self.registration.registration_approval.save()
        assert_false(self.registration.is_registration_approved)

        main(dry_run=False)
        self.registration.registration_approval.reload()
        assert_true(self.registration.is_registration_approved)
    def test_should_approve_pending_registration_more_than_48_hours_old(self):
        # RegistrationApproval#iniation_date is read only
        self.registration.registration_approval.initiation_date = timezone.now() - timedelta(days=365)
        self.registration.registration_approval.save()
        assert_false(self.registration.is_registration_approved)

        main(dry_run=False)
        self.registration.registration_approval.reload()
        assert_true(self.registration.is_registration_approved)
    def test_should_approve_pending_registration_that_is_48_hours_old(self):
        assert_true(self.registration.registration_approval.state)  # sanity check
        # RegistrationApproval#iniation_date is read only
        self.registration.registration_approval.initiation_date = timezone.now() - timedelta(hours=48)
        self.registration.registration_approval.save()
        assert_false(self.registration.is_registration_approved)

        main(dry_run=False)
        self.registration.registration_approval.reload()
        assert_true(self.registration.is_registration_approved)
Пример #5
0
    def test_should_approve_pending_registration_more_than_48_hours_old(self):
        # RegistrationApproval#iniation_date is read only
        self.registration.registration_approval._fields[
            'initiation_date'].__set__(self.registration.registration_approval,
                                       (timezone.now() - timedelta(days=365)),
                                       safe=True)
        self.registration.registration_approval.save()
        assert_false(self.registration.is_registration_approved)

        main(dry_run=False)
        assert_true(self.registration.is_registration_approved)
Пример #6
0
    def test_should_approve_pending_registration_more_than_48_hours_old(self):
        # RegistrationApproval#iniation_date is read only
        self.registration.registration_approval._fields['initiation_date'].__set__(
            self.registration.registration_approval,
            (datetime.utcnow() - timedelta(days=365)),
            safe=True
        )
        self.registration.registration_approval.save()
        assert_false(self.registration.is_registration_approved)

        main(dry_run=False)
        assert_true(self.registration.is_registration_approved)
Пример #7
0
    def test_should_not_approve_pending_registration_less_than_48_hours_old(self):
        # RegistrationApproval#iniation_date is read only
        self.registration.registration_approval._fields['initiation_date'].__set__(
            self.registration.registration_approval,
            (datetime.utcnow() - timedelta(hours=47)),
            safe=True
        )
        self.registration.registration_approval.save()
        assert_false(self.registration.is_registration_approved)

        main(dry_run=False)
        assert_false(self.registration.is_registration_approved)
    def test_registration_adds_to_parent_projects_log(self):
        initial_project_logs = self.registration.registered_from.logs.count()
        # RegistrationApproval#iniation_date is read only
        self.registration.registration_approval.initiation_date=timezone.now() - timedelta(days=365)
        self.registration.registration_approval.save()
        assert_false(self.registration.is_registration_approved)

        main(dry_run=False)
        self.registration.registration_approval.reload()
        assert_true(self.registration.is_registration_approved)
        assert_true(self.registration.is_public)
        # Logs: Created, approval initiated, approval initiated, registered, registration complete
        assert_equal(self.registration.registered_from.logs.count(), initial_project_logs + 2)
Пример #9
0
    def test_should_approve_pending_registration_that_is_48_hours_old(self):
        assert_true(self.registration.registration_approval.pending_approval)  # sanity check
        # RegistrationApproval#iniation_date is read only
        self.registration.registration_approval._fields['initiation_date'].__set__(
            self.registration.registration_approval,
            (datetime.utcnow() - timedelta(hours=48)),
            safe=True
        )
        self.registration.registration_approval.save()
        assert_false(self.registration.is_registration_approved)

        main(dry_run=False)
        assert_true(self.registration.is_registration_approved)
        assert_false(self.registration.registration_approval.pending_approval)
Пример #10
0
    def test_registration_adds_to_parent_projects_log(self):
        initial_project_logs = len(self.registration.registered_from.logs)
        # RegistrationApproval#iniation_date is read only
        self.registration.registration_approval._fields['initiation_date'].__set__(
            self.registration.registration_approval,
            (datetime.utcnow() - timedelta(days=365)),
            safe=True
        )
        self.registration.registration_approval.save()
        assert_false(self.registration.is_registration_approved)

        main(dry_run=False)
        assert_true(self.registration.is_registration_approved)
        assert_true(self.registration.is_public)
        # Logs: Created, approval initiated, approval initiated, registered, registration complete
        assert_equal(len(self.registration.registered_from.logs), initial_project_logs + 2)
Пример #11
0
    def test_registration_adds_to_parent_projects_log(self):
        assert_false(
            self.registration.registered_from.logs.filter(
                action=NodeLog.REGISTRATION_APPROVAL_APPROVED).exists())
        assert_false(
            self.registration.registered_from.logs.filter(
                action=NodeLog.PROJECT_REGISTERED).exists())
        assert_false(self.registration.is_registration_approved)

        self.registration.registration_approval.initiation_date = timezone.now(
        ) - timedelta(days=365)
        self.registration.registration_approval.save()
        main(dry_run=False)
        self.registration.registration_approval.reload()

        assert_true(self.registration.is_registration_approved)
        assert_true(self.registration.is_public)
        assert_true(
            self.registration.registered_from.logs.filter(
                action=NodeLog.REGISTRATION_APPROVAL_APPROVED).exists())
        assert_true(
            self.registration.registered_from.logs.filter(
                action=NodeLog.PROJECT_REGISTERED).exists())
Пример #12
0
    def test_new_registration_should_not_be_approved(self):
        assert_true(self.registration.is_pending_registration)

        main(dry_run=False)
        assert_false(self.registration.is_registration_approved)