def test_del_alias(dxf_obj): assert dxf_obj.get_alias('world') == [pytest.blob2_hash] if dxf_obj.regver == 2.2: with pytest.raises(requests.exceptions.HTTPError) as ex: dxf_obj.del_alias('world') assert ex.value.response.status_code == requests.codes.method_not_allowed assert dxf_obj.get_alias('world') == [pytest.blob2_hash] else: assert dxf_obj.del_alias('world') == [pytest.blob2_hash] # Note: test gc but it isn't needed to make a 404 pytest.gc() with pytest.raises(requests.exceptions.HTTPError) as ex: dxf_obj.get_alias('world') assert ex.value.response.status_code == requests.codes.not_found with pytest.raises(requests.exceptions.HTTPError) as ex: dxf_obj.del_alias('world') assert ex.value.response.status_code == requests.codes.not_found
async def test_del_alias(dxf_obj): assert await dxf_obj.get_alias('world') == [pytest.blob2_hash] if dxf_obj.regver == 2.2: with pytest.raises(aiohttp.ClientResponseError) as ex: await dxf_obj.del_alias('world') assert ex.value.status == aiohttp.web.HTTPMethodNotAllowed.status_code assert await dxf_obj.get_alias('world') == [pytest.blob2_hash] else: assert await dxf_obj.del_alias('world') == [pytest.blob2_hash] # Note: test gc but it isn't needed to make a 404 pytest.gc() with pytest.raises(aiohttp.ClientResponseError) as ex: await dxf_obj.get_alias('world') assert ex.value.status == aiohttp.web.HTTPNotFound.status_code with pytest.raises(aiohttp.ClientResponseError) as ex: await dxf_obj.del_alias('world') assert ex.value.status == aiohttp.web.HTTPNotFound.status_code
def test_del_alias(dxf_main, capsys): assert dxf.main.doit(['get-alias', pytest.repo, 'world'], dxf_main) == 0 out, err = capsys.readouterr() assert out == pytest.blob2_hash + os.linesep assert err == "" if dxf_main['REGVER'] == 2.2: with pytest.raises(requests.exceptions.HTTPError) as ex: dxf.main.doit(['del-alias', pytest.repo, 'world'], dxf_main) assert ex.value.response.status_code == requests.codes.method_not_allowed assert dxf.main.doit(['get-alias', pytest.repo, 'world'], dxf_main) == 0 else: assert dxf.main.doit(['del-alias', pytest.repo, 'world'], dxf_main) == 0 out, err = capsys.readouterr() assert out == pytest.blob2_hash + os.linesep # Note: test gc but it isn't needed to make a 404 pytest.gc() assert dxf.main.doit(['get-alias', pytest.repo, 'world'], dxf_main) == errno.ENOENT assert dxf.main.doit(['del-alias', pytest.repo, 'world'], dxf_main) == errno.ENOENT
async def test_del_alias(dxf_main, capsys): assert await aiodxf.main.doit(['get-alias', pytest.repo, 'world'], dxf_main) == 0 out, err = capsys.readouterr() assert out == pytest.blob2_hash + os.linesep assert err == "" if dxf_main['REGVER'] == 2.2: with pytest.raises(aiohttp.ClientResponseError) as ex: await aiodxf.main.doit(['del-alias', pytest.repo, 'world'], dxf_main) assert ex.value.status == aiohttp.web.HTTPMethodNotAllowed.status_code assert await aiodxf.main.doit(['get-alias', pytest.repo, 'world'], dxf_main) == 0 else: assert await aiodxf.main.doit(['del-alias', pytest.repo, 'world'], dxf_main) == 0 out, err = capsys.readouterr() assert out == pytest.blob2_hash + os.linesep # Note: test gc but it isn't needed to make a 404 pytest.gc() assert await aiodxf.main.doit(['get-alias', pytest.repo, 'world'], dxf_main) == errno.ENOENT assert await aiodxf.main.doit(['del-alias', pytest.repo, 'world'], dxf_main) == errno.ENOENT