This PR updates the behaviour of QuantumInspireAPI to always normalize the base_url by adding a trailing slash if it is missing. The reason this is necessary is because urljoin rewrites the last part of the URL path if it doesn't terminate in a slash, as it interprets it as a file rather than a directory [1].
The tests for the QuantumInspireAPI implicitly relied on this behaviour, expecting FakeURL to be rewritten to schema/, whereas the correct URL would be FakeURL/schema/. The tests have been fixed to remove this inconsistency, as well as new tests to verify the behaviour both with and without trailing slash.
NOTE: this is a potentially breaking change if clients depend on the rewriting behaviour of urljoin in their use of the API object.
Coverage remained the same at 100.0% when pulling e581534aefee1dd6f731ca0a338406d93f2e65d4 on fix/SDS-316/trailing-slash into 30232955eb9db42b7860260c27e3d52e32aa73e9 on dev.
This PR updates the behaviour of
QuantumInspireAPI
to always normalize thebase_url
by adding a trailing slash if it is missing. The reason this is necessary is becauseurljoin
rewrites the last part of the URL path if it doesn't terminate in a slash, as it interprets it as a file rather than a directory [1].The tests for the
QuantumInspireAPI
implicitly relied on this behaviour, expectingFakeURL
to be rewritten toschema/
, whereas the correct URL would beFakeURL/schema/
. The tests have been fixed to remove this inconsistency, as well as new tests to verify the behaviour both with and without trailing slash.NOTE: this is a potentially breaking change if clients depend on the rewriting behaviour of
urljoin
in their use of the API object.[1] https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urljoin