コード例 #1
0
    def test_a_partner_should_not_need_to_see_beneficiaries_tutorial(self, app, db_session):
        # given
        user = User()
        view = PartnerUserView(model=User, session=db_session)

        # when
        view.on_model_change(Form(), model=user, is_created=True)

        # then
        assert user.hasSeenTutorials == True
コード例 #2
0
    def test_a_partner_should_never_be_an_admin(self, app, db_session):
        # given
        user = User()
        view = PartnerUserView(model=User, session=db_session)

        # when
        view.on_model_change(Form(), model=user, is_created=False)

        # then
        assert user.isAdmin == False
コード例 #3
0
    def test_a_partner_should_not_need_to_fill_cultural_survey(self, app, db_session):
        # given
        user = User()
        view = PartnerUserView(model=User, session=db_session)

        # when
        view.on_model_change(Form(), model=user, is_created=True)

        # then
        assert user.needsToFillCulturalSurvey == False
コード例 #4
0
    def test_should_preserve_password_on_edition(self, app, db_session):
        # given
        user = User()
        user.password = "******"
        view = PartnerUserView(model=User, session=db_session)

        # when
        view.on_model_change(Form(), model=user, is_created=False)

        # then
        assert user.password == "OriginalPassword"
コード例 #5
0
    def test_a_partner_should_never_be_a_beneficiary(self, app, db_session):
        # given
        user = User()
        user.add_beneficiary_role()
        view = PartnerUserView(model=User, session=db_session)

        # when
        view.on_model_change(Form(), model=user, is_created=False)

        # then
        assert not user.has_beneficiary_role
コード例 #6
0
    def test_should_generate_a_random_password_on_creation(self, app, db_session):
        # given
        user = User()
        user.password = None
        view = PartnerUserView(model=User, session=db_session)

        # when
        view.on_model_change(Form(), model=user, is_created=True)

        # then
        assert user.password is not None
コード例 #7
0
    def test_should_create_the_public_name(self, app, db_session):
        # given
        user = User()
        user.firstName = "Ken"
        user.lastName = "Thompson"
        user.publicName = None
        view = PartnerUserView(model=User, session=db_session)

        # when
        view.on_model_change(Form(), model=user, is_created=False)

        # then
        assert user.publicName == "Ken Thompson"
コード例 #8
0
def install_admin_views(admin: Admin, session: Session) -> None:
    admin.add_view(
        OfferView(Offer,
                  session,
                  name="Offres",
                  category=Category.OFFRES_STRUCTURES_LIEUX))
    admin.add_view(
        CriteriaView(Criterion,
                     session,
                     name="Tags des offres",
                     category=Category.OFFRES_STRUCTURES_LIEUX))
    admin.add_view(
        OffererView(Offerer,
                    session,
                    name="Structures",
                    category=Category.OFFRES_STRUCTURES_LIEUX))
    admin.add_view(
        VenueView(VenueSQLEntity,
                  session,
                  name="Lieux",
                  category=Category.OFFRES_STRUCTURES_LIEUX))
    admin.add_view(
        UserOffererView(UserOfferer,
                        session,
                        name="Lien Utilisateurs/Structures",
                        category=Category.OFFRES_STRUCTURES_LIEUX))
    admin.add_view(
        ProUserView(
            User,
            session,
            name="Comptes Pros",
            category=Category.USERS,
            endpoint="/pro_users",
        ))
    admin.add_view(
        BeneficiaryUserView(
            User,
            session,
            name="Comptes Jeunes/Grand Public",
            category=Category.USERS,
            endpoint="/beneficiary_users",
        ))
    admin.add_view(
        PartnerUserView(User,
                        session,
                        name="Comptes Partenaires",
                        category=Category.USERS,
                        endpoint="/partner_users"))
    admin.add_view(
        FeatureView(Feature, session, name="Fonctionnalités", category=None))
    admin.add_view(
        BeneficiaryImportView(BeneficiaryImport,
                              session,
                              name="Imports DMS",
                              category=Category.USERS))
    admin.add_view(
        AllocinePivotView(AllocinePivot,
                          session,
                          name="Pivot Allocine",
                          category=Category.OFFRES_STRUCTURES_LIEUX))
コード例 #9
0
def install_admin_views(admin: Admin, session: Session) -> None:
    admin.add_view(
        offer_view.OfferView(models.Offer,
                             session,
                             name="Offres",
                             category=Category.OFFRES_STRUCTURES_LIEUX))
    admin.add_view(
        support_view.BeneficiaryView(User,
                                     session,
                                     name="Bénéficiaires",
                                     endpoint="support_beneficiary",
                                     category=Category.SUPPORT))
    admin.add_view(
        offer_view.OfferForVenueSubview(
            models.Offer,
            session,
            name="Offres pour un lieu",
            endpoint="offer_for_venue",
        ))
    admin.add_view(
        CriteriaView(models.Criterion,
                     session,
                     name="Tags des offres",
                     category=Category.OFFRES_STRUCTURES_LIEUX))
    admin.add_view(
        OffererView(Offerer,
                    session,
                    name="Structures",
                    category=Category.OFFRES_STRUCTURES_LIEUX))
    admin.add_view(
        VenueView(models.Venue,
                  session,
                  name="Lieux",
                  category=Category.OFFRES_STRUCTURES_LIEUX))
    admin.add_view(
        UserOffererView(models.UserOfferer,
                        session,
                        name="Lien Utilisateurs/Structures",
                        category=Category.OFFRES_STRUCTURES_LIEUX))
    admin.add_view(
        ProUserView(
            User,
            session,
            name="Comptes Pros",
            category=Category.USERS,
            endpoint="/pro_users",
        ))
    admin.add_view(
        VenueProviderView(
            VenueProvider,
            session,
            name="Imports automatiques",
            endpoint="venue_providers",
            category=Category.CUSTOM_OPERATIONS,
        ))
    admin.add_view(
        AdminUserView(
            User,
            session,
            name="Comptes admin",
            category=Category.USERS,
            endpoint="/admin_users",
        ))
    admin.add_view(
        BeneficiaryUserView(
            User,
            session,
            name="Comptes Jeunes",
            category=Category.USERS,
            endpoint="/beneficiary_users",
        ))
    admin.add_view(
        PartnerUserView(User,
                        session,
                        name="Comptes Grand Public",
                        category=Category.USERS,
                        endpoint="/partner_users"))
    admin.add_view(
        FeatureView(models.Feature,
                    session,
                    name="Feature Flipping",
                    category=None))
    admin.add_view(
        BeneficiaryImportView(models.BeneficiaryImport,
                              session,
                              name="Imports DMS",
                              category=Category.USERS))
    admin.add_view(
        ApiKeyView(ApiKey, session, name="Clés API", category=Category.USERS))
    admin.add_view(
        AllocinePivotView(models.AllocinePivot,
                          session,
                          name="Pivot Allocine",
                          category=Category.OFFRES_STRUCTURES_LIEUX))
    admin.add_view(
        ManyOffersOperationsView(
            name="Opérations sur plusieurs offres",
            endpoint="/many_offers_operations",
            category=Category.CUSTOM_OPERATIONS,
        ))
    admin.add_view(
        BookingView(
            name="Réservations",
            endpoint="/bookings",
            category=Category.CUSTOM_OPERATIONS,
        ))
    admin.add_view(
        offer_view.ValidationView(
            models.Offer,
            session,
            name="Validation",
            endpoint="/validation",
            category=Category.CUSTOM_OPERATIONS,
        ))

    admin.add_view(
        offer_view.ImportConfigValidationOfferView(
            OfferValidationConfig,
            session,
            name="Configuration des règles de fraude",
            endpoint="/fraud_rules_configuration",
            category=Category.CUSTOM_OPERATIONS,
        ))

    admin.add_view(
        SuspendFraudulentUsersByEmailProvidersView(
            name="Suspension d'utilisateurs via noms de domaine",
            endpoint="/suspend_fraud_users_by_email_providers",
            category=Category.CUSTOM_OPERATIONS,
        ))

    admin.add_view(
        SuspendFraudulentUsersByUserIdsView(
            name="Suspension d'utilisateurs via identifiants",
            endpoint="/suspend_fraud_users_by_user_ids",
            category=Category.CUSTOM_OPERATIONS,
        ))

    admin.add_view(
        CategoryView(
            name="Catégories",
            endpoint="/categories",
            category=Category.CUSTOM_OPERATIONS,
        ))

    admin.add_view(
        SubcategoryView(
            name="Sous-catégories",
            endpoint="/subcategories",
            category=Category.CUSTOM_OPERATIONS,
        ))
    admin.add_view(
        inapp_messages.MessageView(
            subscription_models.SubscriptionMessage,
            session,
            name="Messages utilisateurs dans l'app",
            category=Category.CUSTOM_OPERATIONS,
        ))

    admin.add_view(
        CustomReimbursementRuleView(
            CustomReimbursementRule,
            session,
            name="Règles de remboursement personnalisées",
            category=Category.CUSTOM_OPERATIONS,
        ))