In a Django test, how to load a sample JSON file?

428 views Asked by At

I'm writing tests for a Django app that fetches and parses JSON data from an API. I want to test the parsing by giving the method a known, sample JSON file. Two questions:

  1. Where would it be best to put this? It's not quite a fixture, so I'm not sure if putting it in my app's fixtures/ directory will be confusing.
  2. I know I can load the file using open() but how should I specify the correct filepath in a way that will be robust?
0

There are 0 answers