https://github.com/dcramer/mock-django
https://github.com/dcramer/mock-django
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/dcramer/mock-django
- Owner: dcramer
- License: apache-2.0
- Created: 2012-02-06T21:39:47.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2023-05-31T07:40:27.000Z (about 2 years ago)
- Last Synced: 2025-04-13T00:42:24.450Z (about 2 months ago)
- Language: Python
- Homepage:
- Size: 66.4 KB
- Stars: 223
- Watchers: 6
- Forks: 31
- Open Issues: 11
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
mock-django
~~~~~~~~~~~A simple library for mocking certain Django behavior, such as the ORM.
Using mock-django objects
-------------------------
Inside your virtualenv:.. code:: python
>>> from django.conf import settings
>>> settings.configure() # required to convince Django it's properly configured
>>> from mock_django.query import QuerySetMock
>>> class Post(object): pass
...
>>> qs = QuerySetMock(Post, 1, 2, 3)
>>> list(qs.all())
[1, 2, 3]
>>> qs.count()
3
>>> list(qs.all().filter())
[1, 2, 3]See tests for more examples.
Testing
-------.. image:: https://secure.travis-ci.org/dcramer/mock-django.png
:alt: Build Status
:target: http://travis-ci.org/dcramer/mock-django``tox``