コード例 #1
0
def test_docker_list_images_help_output():
    with pytest.raises(SkipException) as ex:
        docker_list.DockerListImages(context_wrap(DOCKER_HELP_OUTPUT))
    assert 'No data only help output.' in str(ex)

    with pytest.raises(SkipException) as ex:
        docker_list.DockerListContainers(context_wrap(DOCKER_HELP_OUTPUT))
    assert 'No data only help output.' in str(ex)
コード例 #2
0
def test_docker_list_images():
    result = docker_list.DockerListImages(context_wrap(DOCKER_LIST_IMAGES))
    # All rows get read:
    assert len(result.rows) == 4
    # Rows with data are as normal
    assert result.rows[0].get("REPOSITORY") == "rhel6_vsftpd"
    assert result.rows[0].get("TAG") == "latest"
    assert result.rows[0].get("DIGEST") == "<none>"
    assert result.rows[0].get("IMAGE ID") == '412b684338a1178f0e5ad68a5fd00df01a10a18495959398b2cf92c2033d3d02'
    assert result.rows[0].get("CREATED") == "37 minutes ago"
    assert result.rows[0].get("VIRTUAL SIZE") == "459.5 MB"
    # Rows with <none> still get processed.
    assert result.rows[3].get("REPOSITORY") == "<none>"
    assert result.rows[1].get("TAG") == "latest"
    assert result.rows[3].get("IMAGE ID") == '34c167d900afb820ecab622a214ce3207af80ec755c0dcb6165b425087ddbc3a'
    assert result.rows[2].get("REPOSITORY") == "rhel6_nss-softokn"
    assert result.rows[2].get("TAG") == "latest"
    assert result.rows[2].get("IMAGE ID") == 'dd87dad2c7841a19263ae2dc96d32c501ee84a92f56aed75bb67f57efe4e48b5'

    assert result.data['rhel6_vsftpd']['CREATED'] == '37 minutes ago'
    # Same data in both accessors
    assert result.data['rhel6_vsftpd'] == result.rows[0]
    # Can't list repositories if they don't have a repository name
    assert '<none>' not in result.data
コード例 #3
0
def test_docker_list_images():
    result = docker_list.DockerListImages(context_wrap(DOCKER_LIST_IMAGES))
    # All rows get read:
    assert len(result.rows) == 3
    # Rows with data are as normal
    assert result.rows[0].get("REPOSITORY") == "rhel6_vsftpd"
    assert result.rows[0].get("TAG") == "latest"
    assert result.rows[0].get("DIGEST") == "<none>"
    assert result.rows[0].get("IMAGE ID") == '412b684338a1178f0e5ad68a5fd00df01a10a18495959398b2cf92c2033d3d02'
    assert result.rows[0].get("CREATED") == "37 minutes ago"
    assert result.rows[0].get("VIRTUAL SIZE") == "459.5 MB"
    # Rows with <none> still get processed.
    assert result.rows[1].get("REPOSITORY") == "<none>"
    assert result.rows[1].get("TAG") == "<none>"
    assert result.rows[1].get("IMAGE ID") == '34c167d900afb820ecab622a214ce3207af80ec755c0dcb6165b425087ddbc3a'
    assert result.rows[2].get("REPOSITORY") == "<none>"
    assert result.rows[2].get("TAG") == "<none>"
    assert result.rows[2].get("IMAGE ID") == '76e65756ff110ca5ea54ac02733fe04301b33a9190689eb524dd5aa18843996a'

    assert result.data['rhel6_vsftpd']['CREATED'] == '37 minutes ago'
    # Same data in both accessors
    assert result.data['rhel6_vsftpd'] == result.rows[0]
    # Can't list repositories if they don't have a repository name
    assert '<none>' not in result.data
コード例 #4
0
def test_docker_list_images_no_data():
    with pytest.raises(SkipException) as ex:
        docker_list.DockerListImages(context_wrap(DOCKER_LIST_IMAGES_NO_DATA))
    assert 'No data.' in str(ex)
コード例 #5
0
def test_docker_list_images_no_data():
    result = docker_list.DockerListImages(context_wrap(DOCKER_LIST_IMAGES_NO_DATA))
    # All rows get read:
    assert len(result.rows) == 0
    assert result.no_data