示例#1
0
    def test_create_release(self):
        """ Test creation of upgrades """
        from invenio.modules.upgrader.engine import InvenioUpgrader
        from invenio.modules.upgrader.commands import \
            cmd_upgrade_create_standard_recipe, \
            cmd_upgrade_create_release_recipe

        engine = InvenioUpgrader(packages=[
            'invenio_upgrader_test', 'invenio_upgrader_test.mymod'])

        cmd_upgrade_create_standard_recipe(
            'invenio_upgrader_test', depends_on=[]
        )
        cmd_upgrade_create_standard_recipe(
            'invenio_upgrader_test.mymod', depends_on=[]
        )

        cmd_upgrade_create_release_recipe(
            'invenio_upgrader_test', repository='invenio', upgrader=engine
        )

        # Find all endpoints in all repositories
        upgrades = engine.get_upgrades(remove_applied=False)
        for u in upgrades:
            if u['id'] == 'invenio_release_x_y_z':
                assert len(u['depends_on']) == 2
示例#2
0
def populate(default_data=True, truncate_tables_first=False):
    """Populate database with default data"""

    from invenio.config import CFG_PREFIX
    from invenio.base.scripts.config import get_conf

    if not default_data:
        print('>>> No data filled...')
        return

    print(">>> Going to fill tables...")

    load_fixtures(truncate_tables_first=truncate_tables_first)

    conf = get_conf()

    from invenio.legacy.inveniocfg import cli_cmd_reset_sitename, \
        cli_cmd_reset_siteadminemail, cli_cmd_reset_fieldnames

    cli_cmd_reset_sitename(conf)
    cli_cmd_reset_siteadminemail(conf)
    cli_cmd_reset_fieldnames(conf)

    for cmd in ["%s/bin/webaccessadmin -u admin -c -a" % CFG_PREFIX]:
        if os.system(cmd):
            print("ERROR: failed execution of", cmd)
            sys.exit(1)

    from invenio.modules.upgrader.engine import InvenioUpgrader
    iu = InvenioUpgrader()
    map(iu.register_success, iu.get_upgrades())

    print(">>> Tables filled successfully.")
示例#3
0
    def test_create_load_engine(self):
        """ Test creation and loading of upgrades with engine """
        from invenio.modules.upgrader.commands import \
            cmd_upgrade_create_standard_recipe

        cmd_upgrade_create_standard_recipe('invenio_upgrader_test',
                                           depends_on=[])

        expexted_name = "invenio_upgrader_test_%s_rename_me" % \
            date.today().strftime("%Y_%m_%d")

        # Test if upgrade can be found from the Upgrade
        from invenio.modules.upgrader.engine import InvenioUpgrader
        eng = InvenioUpgrader(packages=['invenio_upgrader_test'])
        upgrades = eng.get_upgrades(remove_applied=False)
        assert len(upgrades) == 1
        assert upgrades[0]['id'] == expexted_name
        assert upgrades[0]['repository'] == 'invenio_upgrader_test'
示例#4
0
    def test_create_load_engine(self):
        """ Test creation and loading of upgrades with engine """
        from invenio.modules.upgrader.commands import \
            cmd_upgrade_create_standard_recipe

        cmd_upgrade_create_standard_recipe(
            'invenio_upgrader_test',
            depends_on=[]
        )

        expexted_name = "invenio_upgrader_test_%s_rename_me" % \
            date.today().strftime("%Y_%m_%d")

        # Test if upgrade can be found from the Upgrade
        from invenio.modules.upgrader.engine import InvenioUpgrader
        eng = InvenioUpgrader(packages=['invenio_upgrader_test'])
        upgrades = eng.get_upgrades(remove_applied=False)
        assert len(upgrades) == 1
        assert upgrades[0]['id'] == expexted_name
        assert upgrades[0]['repository'] == 'invenio_upgrader_test'
示例#5
0
    def test_create_release(self):
        """ Test creation of upgrades """
        from invenio.modules.upgrader.engine import InvenioUpgrader
        from invenio.modules.upgrader.commands import \
            cmd_upgrade_create_standard_recipe, \
            cmd_upgrade_create_release_recipe

        engine = InvenioUpgrader(
            packages=['invenio_upgrader_test', 'invenio_upgrader_test.mymod'])

        cmd_upgrade_create_standard_recipe('invenio_upgrader_test',
                                           depends_on=[])
        cmd_upgrade_create_standard_recipe('invenio_upgrader_test.mymod',
                                           depends_on=[])

        cmd_upgrade_create_release_recipe('invenio_upgrader_test',
                                          repository='invenio',
                                          upgrader=engine)

        # Find all endpoints in all repositories
        upgrades = engine.get_upgrades(remove_applied=False)
        for u in upgrades:
            if u['id'] == 'invenio_release_x_y_z':
                assert len(u['depends_on']) == 2