wiremock / python-wiremock

A Python library for API mocking and testing with Testcontainers module and WireMock
https://wiremock.readthedocs.io
Other
59 stars 26 forks source link

[Win11] It is not possible to change the default root_dir #96

Open Saex05 opened 1 year ago

Saex05 commented 1 year ago

Proposal

It is not possible to modify the root_dir using win11 because the attribute "--root-dir" contains "=" like an extra character and when this character is used to run wiremock-standalone the mappings file and __files file are created in "C:/" and not in the expected path.

https://github.com/wiremock/python-wiremock/blob/20442b222982fe4ceb060aff6b5ca969a31cf8a3/wiremock/server/server.py#L64

Python Script to reproduce the bug:

import requests
from pathlib import Path
from wiremock.server.server import WireMockServer
from wiremock.constants import Config

with WireMockServer(port=8080, root_dir=Path('wiremock_demo').absolute()) as wm:
    Config.base_url = 'http://localhost:{}'.format(wm.port)
    response = requests.get(Config.base_url + "/users")
    print(response.status_code)
    print(response.json())

Expected command: image

Reproduction steps

References

No response

simonjgould commented 12 months ago

I duplicated this https://github.com/wiremock/python-wiremock/issues/100

I am happy to submit a PR for this fix if required

simonjgould commented 11 months ago

pr put in containing fix https://github.com/wiremock/python-wiremock/pull/101