コード例 #1
0
ファイル: test_init.py プロジェクト: jaychris/pypicloud-tools
def test_parse_args__list_all():
    """Ensure the parser is setup correctly for listing all packages."""

    pypicloud_tools.sys.argv = ["list", "--config", "fake.config"]
    options, parser = pypicloud_tools.parse_args(listing=True)

    assert isinstance(parser, pypicloud_tools.argparse.ArgumentParser)
    assert isinstance(options, pypicloud_tools.argparse.Namespace)

    expected_options = {
        "packages": [],
        "bucket": False,
        "server": False,
        "access": False,
        "secret": False,
        "user": False,
        "password": False,
        "config": ["fake.config"],
    }
    assert vars(options) == expected_options
コード例 #2
0
ファイル: test_init.py プロジェクト: jaychris/pypicloud-tools
def test_parse_args__download():
    """Ensure the parser is properly configured for downloads."""

    pypicloud_tools.sys.argv = ["download", "--secret", "abc", "fake_package"]
    options, parser = pypicloud_tools.parse_args(download=True)

    assert isinstance(parser, pypicloud_tools.argparse.ArgumentParser)
    assert isinstance(options, pypicloud_tools.argparse.Namespace)

    expected_options = {
        "packages": ["fake_package"],
        "bucket": False,
        "server": False,
        "access": False,
        "secret": ["abc"],
        "user": False,
        "password": False,
        "config": DEFAULT_CONFIG,
    }
    assert vars(options) == expected_options
    assert "Download package(s) from S3, bypassing PyPICloud" in str(parser)
コード例 #3
0
ファイル: test_init.py プロジェクト: jaychris/pypicloud-tools
def test_parse_args__list_package():
    """Ensure the parser is setup correctly for listing a package."""

    pypicloud_tools.sys.argv = ["list", "test_package"]
    options, parser = pypicloud_tools.parse_args(listing=True)

    assert isinstance(parser, pypicloud_tools.argparse.ArgumentParser)
    assert isinstance(options, pypicloud_tools.argparse.Namespace)

    expected_options = {
        "packages": ["test_package"],
        "bucket": False,
        "server": False,
        "access": False,
        "secret": False,
        "user": False,
        "password": False,
        "config": DEFAULT_CONFIG,
    }
    assert vars(options) == expected_options
    assert "List package(s) from S3, bypassing PyPICloud" in str(parser)
コード例 #4
0
ファイル: test_init.py プロジェクト: jaychris/pypicloud-tools
def test_parse_args__upload():
    """Ensure the upload keys are populated in the argument parser."""

    pypicloud_tools.sys.argv = ["upload", "--acl", "fake-acl", "fake_file.tar"]
    options, parser = pypicloud_tools.parse_args(upload=True)

    assert isinstance(parser, pypicloud_tools.argparse.ArgumentParser)
    assert isinstance(options, pypicloud_tools.argparse.Namespace)

    expected_options = {
        "files": ["fake_file.tar"],
        "bucket": False,
        "server": False,
        "access": False,
        "acl": ["fake-acl"],
        "secret": False,
        "user": False,
        "password": False,
        "config": DEFAULT_CONFIG,
    }
    assert vars(options) == expected_options
    assert "Upload package(s) to S3, bypassing PyPICloud" in str(parser)