Пример #1
0
 def test_get_json(self):
     """Test the get_json method can read a JSON file."""
     test_file_name = None
     with NamedTemporaryFile(mode='w', delete=False) as test_file:
         json_data = [1, 2, 3, 4, {'foo': 'bar'}]
         json.dump(json_data, test_file)
         test_file_name = test_file.name
     result = get_json(test_file_name)
     self.assertEqual(result, json_data)
Пример #2
0
def read_api_json():
    """Read the openapi.json file out of the docs dir."""
    test_filename = os.path.join(APPS_DIR, 'static/openapi.json')
    return get_json(test_filename)
Пример #3
0
def read_api_json():
    """Read the openapi.json file out of the docs dir."""
    test_filename = os.path.join(settings.BASE_DIR, "..",
                                 "docs/source/specs/openapi.json")
    return get_json(test_filename)