This repository has been archived on 2022-05-05. You can view files and clone it, but cannot push or open issues or pull requests.
userausfall/userausfall/rest_api/tests/userausfall.py
2021-10-22 12:38:25 +02:00

19 lines
569 B
Python

from rest_framework.reverse import reverse
from rest_framework.test import APITestCase
def get_url(response, basename, instance):
return reverse(f"{basename}-detail", [instance.pk], request=response.wsgi_request)
class UserausfallAPITestCase(APITestCase):
base_url = "/api"
def get_api_url(self, url, **kwargs):
"""
Prepend the path to the full url for this test class.
:param url: an url fragment
:return: the url fragment prepended with the base url
"""
return f"{self.base_url}{url.format(**kwargs)}"