def test_install():
    sys.argv = ['appypi', 'install', 'projy']
    execute()
    bin_path = os.path.join(os.environ['HOME'], 'bin', 'projy')
    app_path = os.path.join(settings.APPYPI_DIR, 'projy')
    assert_equal(os.path.isfile(bin_path), True)
    assert_equal(os.path.isdir(app_path), True)
Exemple #2
0
def test_remove():
    # install first
    sys.argv = ['appypi', 'install', 'projy']
    execute()
    bin_path = os.path.join(os.environ['HOME'], 'bin', 'projy')
    app_path = os.path.join(settings.APPYPI_DIR, 'projy')
    db = AppypiDatabase()
    assert_equal(os.path.isfile(bin_path), True)
    assert_equal(os.path.isdir(app_path), True)
    assert_not_equal(db.app_is_installed('projy'), None)

    # remove then
    sys.argv = ['appypi', 'remove', 'projy']
    execute()
    assert_equal(os.path.isfile(bin_path), False)
    assert_equal(os.path.isdir(app_path), False)
    assert_equal(db.app_is_installed('projy'), None)
def test_real_upgrade():
    """ Upgrade of a package. """
    sys.argv = ['appypi', 'install', 'projy']
    execute()
    sys.argv = ['appypi', 'install', 'fabric']
    execute()

    # enter the fabric virtualenv
    exe = os.path.join(settings.APPYPI_DIR,
                       'fabric', 'venv', 'bin', 'activate_this.py')
    execfile(exe, dict(__file__=exe))
    # launch the downgrade
    subprocess.call(['pip', '-q', 'install', 'fabric==1.4.0'])
    # change the database
    dbase = AppypiDatabase()
    app = dbase.app_is_installed('fabric')
    app.installed_version = '1.4.0'
    dbase.save()

    # run the update
    sys.argv = ['appypi', 'upgrade', 'fabric']
    execute()
    # test
    app2 = dbase.app_is_installed('fabric')
    assert_not_equal(app2.installed_version, '1.4.0')
def test_list_and_show():
    sys.argv = ['appypi', 'install', 'projy']
    execute()
    sys.argv = ['appypi', 'list']
    execute()
    sys.argv = ['appypi', 'show', 'projy']
    execute()
def test_list_and_show():
    """ Install of a package, then list all installed packages,
        then show the installed package information. """
    sys.argv = ['appypi', 'install', 'projy']
    execute()
    sys.argv = ['appypi', 'list']
    execute()
    sys.argv = ['appypi', 'show', 'projy']
    execute()
def test_update():
    sys.argv = ['appypi', 'update']
    execute()
def test_unknown_command():
    sys.argv = ['appypi', 'NOT_A_COMMAND', 'plop']
    execute()
def test_install_without_package():
    sys.argv = ['appypi', 'install']
    execute()
def test_install_unknown_package():
    sys.argv = ['appypi', 'install', 'NOT_INSTALLED_PACKAGE']
    execute()
def test_remove_not_installed():
    """ Remove an uninstalled package. """
    sys.argv = ['appypi', 'remove', 'projy']
    execute()
Exemple #11
0
def test_remove_not_confirmed():
    """ Remove an installed package without confirmation. """
    sys.argv = ['appypi', 'install', 'projy']
    execute()
    sys.argv = ['appypi', 'remove', 'projy']
    execute()
def test_upgrade_all():
    sys.argv = ['appypi', 'install', 'projy']
    execute()
    sys.argv = ['appypi', 'upgrade']
    execute()
def test_upgrade_all():
    """ Upgrade all packages. """
    sys.argv = ['appypi', 'install', 'projy']
    execute()
    sys.argv = ['appypi', 'upgrade']
    execute()
def test_unknown_requirement_file():
    """ Show an unknown requirement file. """
    sys.argv = ['appypi', 'install', '--requirements=NOT_A_FILE']
    execute()
def test_update():
    """ Update packages. """
    sys.argv = ['appypi', 'update']
    execute()
def test_unknown_command():
    """ Use an unknown command. """
    sys.argv = ['appypi', 'NOT_A_COMMAND', 'plop']
    execute()
def test_empty_install():
    """ Install with no package. """
    sys.argv = ['appypi', 'install']
    execute()
def test_install_unknown():
    """ Install an uninstalled package. """
    sys.argv = ['appypi', 'install', 'NOT_INSTALLED_PACKAGE']
    execute()
def test_upgrade_uninstalled():
    """ Upgrade an uninstalled package. """
    sys.argv = ['appypi', 'upgrade', 'NOT_INSTALLED_PACKAGE']
    execute()
Exemple #20
0
def test_remove_not_confirmed():
    sys.argv = ['appypi', 'install', 'projy']
    execute()
    sys.argv = ['appypi', 'remove', 'projy']
    execute()
def test_show_unknown_package():
    sys.argv = ['appypi', 'show', 'NOT_INSTALLED_PACKAGE']
    execute()
def test_upgrade_uninstalled_package():
    sys.argv = ['appypi', 'upgrade', 'NOT_INSTALLED_PACKAGE']
    execute()
def test_remove_not_installed_package():
    sys.argv = ['appypi', 'remove', 'projy']
    execute()
Exemple #24
0
def test_requirement_erroneous_file():
    """ Install packages from a requirement file with unknown package. """
    sys.argv = ['appypi', 'install', '--requirements={0}'.
    format(os.path.join(os.getcwd(), 'tests/fixtures/requirements-FAIL.txt'))]
    execute()
def test_show_unknown():
    """ Show an uninstalled package. """
    sys.argv = ['appypi', 'show', 'NOT_INSTALLED_PACKAGE']
    execute()