alsur / django-admin-auto-tests Goto Github PK
View Code? Open in Web Editor NEWAutomatic tests for Django admin
License: MIT License
Automatic tests for Django admin
License: MIT License
See note on https://github.com/berinhard/model_mommy
pip doesnt like being used as a library.
You could use pip-api or pip-shims instead, but it is better to not rely on build dependencies. This setup.py is very complicated for rather non-complicated needs.
When trying to add tests to django-oscar, I am running into a problem with a model which uses https://github.com/django-treebeard/django-treebeard
First I need to map its slug field
from model_bakery import baker
from model_bakery.generators import default_mapping, SlugField
baker.generators.add('oscar.models.fields.slugfield.SlugField', default_mapping[SlugField])
Then the test_add
fails
FAIL: test_add (oscar.apps.catalogue.tests.test_admin.CategoryAdminTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/admin_auto_tests/test_model.py", line 123, in test_add
self.assertEqual(len(response.context_data['errors']), 0,
AssertionError: 1 != 0 : _position: This field is required.
The _position
feel is a required ChoiceField on the form.
I see model-bakery (and mommy) doesnt mentions support for ChoiceField, so I add _position
using the create_form_instance_data
hook (nice!)
This is a forms field, not a db field, which might account for bakery not supporting it.
I'll also raise an issue there.
If there isnt opportunity to add support for form fields to bakery, perhaps django-admin-auto-tests should detect required form fields and mark the test as a skip or fail with a better explanation of how to implement create_form_instance_data
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.