예제 #1
0
파일: test_cli.py 프로젝트: fiveai/aiodxf
async def test_get_digest(dxf_main, capsys):
    if dxf_main['REGVER'] == 2.2:
        with pytest.raises(aiodxf.exceptions.DXFDigestNotAvailableForSchema1):
            await aiodxf.main.doit(['get-image-id', pytest.repo, 'hello'],
                                   dxf_main)
        return
    assert await aiodxf.main.doit(['get-image-id', pytest.repo, 'hello'],
                                  dxf_main) == 0
    out, err = capsys.readouterr()
    assert out == pytest.blob1_hash + os.linesep
    assert err == ""
    assert await aiodxf.main.doit(['get-image-id', pytest.repo, 'there'],
                                  dxf_main) == 0
    out, err = capsys.readouterr()
    assert out == pytest.blob1_hash + os.linesep
    assert err == ""
    assert await aiodxf.main.doit(['get-image-id', pytest.repo, 'world'],
                                  dxf_main) == 0
    out, err = capsys.readouterr()
    assert out == pytest.blob2_hash + os.linesep
    assert err == ""
    pytest.copy_registry_image(dxf_main['REGVER'])
    assert await aiodxf.main.doit(
        ['get-image-id', 'test/registry',
         str(dxf_main['REGVER'])], dxf_main) == 0
    out, err = capsys.readouterr()
    assert out == dxf_main['REG_DIGEST'] + os.linesep
    assert err == ""
예제 #2
0
파일: test_module.py 프로젝트: KastB/dxf
def test_get_digest(dxf_obj):
    if dxf_obj.regver == 2.2:
        with pytest.raises(dxf.exceptions.DXFDigestNotAvailableForSchema1):
            dxf_obj.get_digest('hello')
        return
    assert dxf_obj.get_digest('hello') == pytest.blob1_hash
    assert dxf_obj.get_digest('there') == pytest.blob1_hash
    assert dxf_obj.get_digest('world') == pytest.blob2_hash
    pytest.copy_registry_image(dxf_obj.regver)
    # pylint: disable=protected-access
    dxf_obj2 = dxf.DXF(dxf_obj._host, 'test/registry', dxf_obj._auth, dxf_obj._insecure, None, dxf_obj._tlsverify)
    assert dxf_obj2.get_digest(str(dxf_obj.regver)) == dxf_obj.reg_digest