https://github.com/kmmbvnr/django-any
[DEPRICATED] Unobtrusive test models creation for django
https://github.com/kmmbvnr/django-any
Last synced: 7 days ago
JSON representation
[DEPRICATED] Unobtrusive test models creation for django
- Host: GitHub
- URL: https://github.com/kmmbvnr/django-any
- Owner: kmmbvnr
- License: mit
- Created: 2010-05-25T06:27:30.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2011-10-08T16:52:07.000Z (over 13 years ago)
- Last Synced: 2025-03-12T09:12:21.399Z (about 1 month ago)
- Language: Python
- Homepage:
- Size: 307 KB
- Stars: 72
- Watchers: 5
- Forks: 33
- Open Issues: 14
-
Metadata Files:
- Readme: README
- License: LICENSE
Awesome Lists containing this project
README
Unobtrusive test models creation for django
===========================================django-any the explicit replacement for old-style, big and error-prone
implicit fixture files.django-any allows to specify only fields important for test,
and fill rest by random with acceptable values.It makes tests clean and easy to undestood, without reading fixture files.
from django_any import any_model, WithTestDataSeed
class TestMyShop(TestCase):
def test_order_updates_user_account(self):
account = any_model(Account, amount=25, user__is_active=True)
order = any_model(Order, user=account.user, amount=10)
order.proceed()account = Account.objects.get(pk=account.pk)
self.assertEquals(15, account.amount)The same approach available for forms also (django_any.any_form)
See docs/quickstart.txt for more details