ramsayleung / rspotify

Spotify Web API SDK implemented on Rust
MIT License
639 stars 123 forks source link

Make Spotify base URLs configurable for tests #350

Closed jjmark15 closed 1 year ago

jjmark15 commented 2 years ago

Is your feature request related to a problem? Please describe. I want to be able to write tests against a local mock of Spotify. Spotify URLs are hard-coded in the library which makes this impractical.

e.g. https://github.com/ramsayleung/rspotify/blob/9197a908e9a61e20b47e22cac6cf9af75c6769b4/src/lib.rs#L188

Describe the solution you'd like Make target base URLs configurable.

marioortizmanero commented 2 years ago

I saw aspotify did something like that but I always wondered why it would be useful. So you've replicated the API? Would you be able to tell me more about it?

jjmark15 commented 2 years ago

Sure 👍🏻 . I generally prefer black-box functional (or integration depending on terminology) testing of an API. In order to do that I need to be able to make a real HTTP call to a downstream, which usually means using an http mock. Not sure if I've explained myself well enough there 😓

marioortizmanero commented 2 years ago

I was wondering whether we should have these fields as a String or as a Box<str> or &'static str. It's not like anyone is going to modify the prefix URL at runtime, right?

github-actions[bot] commented 1 year ago

Message to comment on stale issues. If none provided, will not mark issues stale