コード例 #1
0
def seed(keep_unmentioned=False):
    """Actual seed function

    NB this is defined separately so it can also be called internally,
    i.e. from sync

    """
    # Request context necessary for generating data from own HTTP APIs
    with app.test_request_context():
        add_static_concepts()

    add_static_interventions()
    add_static_organization()
    add_static_relationships()
    add_static_roles()
    db.session.commit()

    # import site export file if found
    SitePersistence(target_dir=None).import_(keep_unmentioned=keep_unmentioned)
コード例 #2
0
ファイル: manage.py プロジェクト: uwcirg/true_nth_usa_portal
def seed(keep_unmentioned=False):
    """Actual seed function

    NB this is defined separately so it can also be called internally,
    i.e. from sync

    """
    # Request context necessary for generating data from own HTTP APIs
    with app.test_request_context():
        add_static_concepts()

    add_static_interventions()
    add_static_organization()
    add_static_relationships()
    add_static_roles()
    db.session.commit()

    # import site export file if found
    SitePersistence(target_dir=None).import_(
        keep_unmentioned=keep_unmentioned)
コード例 #3
0
ファイル: manage.py プロジェクト: jmillr/true_nth_usa_portal
def seed(exclude_interventions=False, keep_unmentioned=False):
    """Seed database with required data"""

    # Request context necessary for generating data from own HTTP APIs
    with app.test_request_context():
        add_static_concepts()

    add_static_interventions()
    add_static_organization()
    add_static_relationships()
    add_static_roles()
    db_maintenance()
    db.session.commit()

    # Always update interventions on development systems
    if app.config["SYSTEM_TYPE"].lower() == 'development':
        exclude_interventions = False

    # import site export file if found
    SitePersistence().import_(exclude_interventions, keep_unmentioned)
コード例 #4
0
ファイル: __init__.py プロジェクト: ivan-c/truenth-portal
    def setUp(self):
        """Reset all tables before testing."""

        db.drop_all()  # clean up from previous tests
        db.create_all()
        with SessionScope(db):
            # concepts take forever, only load the quick ones.
            # add directly (via self.add_concepts()) if test needs them
            add_static_concepts(only_quick=True)
            add_static_interventions()
            add_static_organization()
            add_static_relationships()
            add_static_roles()
            db.session.commit()
        self.init_data()

        # bootstrapping mysteries continue, config variables set during
        # tests don't die; removed unwanted config items if present
        for item in (
                'REQUIRED_CORE_DATA', 'LOCALIZED_AFFILIATE_ORG',
                'ACCEPT_TERMS_ON_NEXT_ORG'):
            if item in self.client.application.config:
                del self.client.application.config[item]
コード例 #5
0
    def setUp(self):
        """Reset all tables before testing."""

        db.drop_all()  # clean up from previous tests
        db.create_all()
        with SessionScope(db):
            # concepts take forever, only load the quick ones.
            # add directly (via self.add_concepts()) if test needs them
            add_static_concepts(only_quick=True)
            add_static_interventions()
            add_static_organization()
            add_static_relationships()
            add_static_roles()
            db.session.commit()
        self.init_data()

        self.client = self.__app.test_client()

        # removed unwanted config items if present
        for item in ('REQUIRED_CORE_DATA', 'LOCALIZED_AFFILIATE_ORG'):
            if item in self.client.application.config:
                del self.client.application.config[item]
        # reload coredata config
        configure_coredata(self.client.application)