I am using pytest to write my tests - well I try to test my app. I am relative new to the topic.
I wrote a mixing that specializes the UserPassesTestMixin:
class UserInMyGroupMixin(UserPassesTestMixin):
def test_func(self):
return self.request.user.groups.filter(name="MyGroup").exists()
now Coverage tells me that I have to test it. But how?
It also tells me that I have to test:
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["object_type"] = "Schulung"
return context
def get_success_url(self):
return reverse("schulungen:list")
of my DetailView. Should I just instanciate the Classes and then call the functions? Or how would I test their methods?