@urlmatch(netloc='localhost:4502')
def packages_mock(url, request):
    get_command_stack().append((url, request))

    if request.method == 'POST':
        if url.path == '/crx/packmgr/service.jsp':
            with open('tests/test_data/packages_list.xml') as f:
                return f.read()
        elif url.path.startswith('/crx/packmgr/service/.json/etc/packages'):
            return '{"success": true, "msg": "Package Installed"}'
        else:
            raise Exception("Unknown path " + url.path)
    elif request.method == 'GET':
        if url.path == '/etc/packages/test_packages/mock_package-1.6.5.zip':
            return '{"success":true,"msg":"Package built"}'

    else:
        raise Exception("Unknown method " + request.method + " for " + url.path)
dataset/ETHPy150Open bjorns/aem-cmd/tests/tools/test_packages.py/packages_mock/original