1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-12-22 14:54:22 +00:00

📔 Add todos

This commit is contained in:
Steffo 2021-10-28 09:49:39 +02:00
parent 667bfe9e16
commit 14faaad7dc

View file

@ -57,18 +57,18 @@ class ReadSophonTestCase(BetterAPITestCase, metaclass=abc.ABCMeta):
raise NotImplementedError() raise NotImplementedError()
@classmethod @classmethod
def get_url(cls, action: str, *args, **kwargs) -> str: def get_url(cls, kind: str, *args, **kwargs) -> str:
""" """
Find the URL of a specific action by using :func:`django.urls.reverse`. Find the URL of a specific action by using :func:`django.urls.reverse`.
:param action: The action to perform on the ViewSet, such as `"list"` or `"destroy"`. :param kind: The kind of view of the ViewSet to access: either ``"list"`` or ``"detail"``.
:param args: Positional arguments passed to :func:`django.urls.reverse` for getting the URL. :param args: Positional arguments passed to :func:`django.urls.reverse` for getting the URL.
:param kwargs: Keyword arguments passed to :func:`django.urls.reverse` for getting the URL. :param kwargs: Keyword arguments passed to :func:`django.urls.reverse` for getting the URL.
:return: The URL corresponding to the action with all parameters filled in. :return: The URL corresponding to the action with all parameters filled in.
""" """
basename = cls.get_basename() basename = cls.get_basename()
try: try:
return reverse(f"{basename}-{action}", args=args, kwargs=kwargs) return reverse(f"{basename}-{kind}", args=args, kwargs=kwargs)
except django.urls.exceptions.NoReverseMatch: except django.urls.exceptions.NoReverseMatch:
raise errors.HTTPException(404) raise errors.HTTPException(404)
@ -524,3 +524,9 @@ class ResearchGroupTestCase(WriteSophonTestCase):
def test_destroy_403(self): def test_destroy_403(self):
with self.as_user(self.outside_user.username): with self.as_user(self.outside_user.username):
self.assertActionDestroy("alpha", 403) self.assertActionDestroy("alpha", 403)
# TODO: Test join and leave
# TODO: Test instance details
# TODO: Test some more code