I need some help with my testing architecture. My code works but it seems ugly for me. Could you take a look :
The goal is to make the same tests for all my pages in Django :
I wrote a unit testing.py
from django.urls import reverse, resolve
class SinglePageTest(object):
    str_reverse = ''
    adresse = ''
    template = None
    template_path = ''
    str_contain = ''
    def initialize(self):
        self.url = reverse(self.str_reverse)
        self.view = resolve(self.adresse)
        self.response = self.client.get(self.url)
    def test_status_200(self):
        self.assertEqual(self.response.status_code, 200)
    def test_templates_home(self):
        self.assertTemplateUsed(self.response, self.template_path)
    def test_contains_HTML(self):
        self.assertContains(self.response,
                            self.str_contain)
    def test_url_resolve(self):
        self.assertEqual(self.view.func.__name__,
                         self.template.as_view().__name__)
When I need to test a page in test.py I do this :
from django.test import TestCase, SimpleTestCase
from DjangoTools.testing import SinglePageTest
class RetrievePassword(SimpleTestCase, SinglePageTest):
    def setUp(self):
        self.str_reverse = 'retrieve-password'
        self.adresse = '/accounts/retrieve-password'
        self.template = RetrievePasswordView
        self.template_path = 'accounts/retrieve-password.html'
        self.str_contain = '<h1> Récupérer le <span class="clr-org">mot de passe</span></h1>'
        super(RetrievePassword, self).setUp()
        SinglePageTest.initialize(self)
The problem is that PyCharm doesn't find the reference for a lot of method in testing.py and that's normal cause I'am using a basic object that doesn't contains these methods.
My questions are :
- Is-it well to do like this ?
 - Can I say that I'm using Mixins ?
 - How to tell pycharm to find assertTemplateUsed, client.get etc...
 
Have a nice day,
After using the solution provided unittest is trying to test the testing.py class
Solution of the problem : add to the base class
def setUp(self):
    if self.__class__ is BaseSinglePageTest:
        raise SkipTest("%s is an abstract base class" % self.__class__)
    else:
        super(BaseSinglePageTest, self).setUp()
