1

I would like to test couple of methods that involves Python requests library. Cases I'd like to cover are:

  1. server unreachable
  2. server reachable, but targeted service not available
  3. call failed
  4. call succeeded

Now the tricky part is, I need to cover also SSL certificates failure(s):

  1. valid
  2. expired
  3. missing/invalid one certificate in chain

Is this possible with requests-mock or other library?

Many thanks in advance

Progman
  • 16,827
  • 6
  • 33
  • 48
nikoladsp
  • 115
  • 2
  • 8
  • It seems like the easiest thing to do here is to generate certificates as part of your test setup and configure an http server to use them. You can create a trivial https server [using the `http` module](https://stackoverflow.com/a/19706670/147356). – larsks Sep 16 '22 at 12:51
  • @larsks Thanks, I was also thinking about it, but not sure is this the right approach. If I don't find anything more suitable, will go that path for sure. – nikoladsp Sep 16 '22 at 15:10

0 Answers0