rspotify icon indicating copy to clipboard operation
rspotify copied to clipboard

Make Spotify base URLs configurable for tests

Open jjmark15 opened this issue 3 years ago • 3 comments
trafficstars

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.

jjmark15 avatar Jul 26 '22 21:07 jjmark15

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?

marioortizmanero avatar Jul 26 '22 21:07 marioortizmanero

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 😓

jjmark15 avatar Jul 26 '22 21:07 jjmark15

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?

marioortizmanero avatar Jul 29 '22 22:07 marioortizmanero

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

github-actions[bot] avatar Jun 25 '23 02:06 github-actions[bot]