I've been using Django for under a year and would like clarification on the role of tests within a reusable django app. Popular apps, for example, like django-allauth - https://github.com/pennersr/django-allauth - come with tests. From the point of view of the app consumer what is the purpose of these tests? I can see when I run -
python manage.py test
That only MY tests are executed and not the app tests.
Furthermore when I did run the tests -
python manage.py test allauth.account
Pretty much everything failed. For example the first test failed because allauth tried to create a user object with a keyword 'username' which isn't how my project user model is configured (I just have an email field). So these tests which all-auth provides are supposed to run within which project exactly? I'd have thought app designers should create tests which accommodate any proper app consumer project config. That way running the tests informs you whether or not your project is correctly integrated from the consumed apps point of view.
I noticed a similar question but it doesn't really help with my more general question - How to test single application (not project) in Django?
By the way I've checked my project config for consuming the all-auth app and it does have the right config. As per - https://django-allauth.readthedocs.io/en/latest/advanced.html#custom-user-models, for a user model with a unique email and no username i have -
ACCOUNT_USER_MODEL_USERNAME_FIELD = None
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_AUTHENTICATION_METHOD = 'email'
Aucun commentaire:
Enregistrer un commentaire