Skip to content

Commit

Permalink
Merge pull request #25 from stphivos/version/0.0.14
Browse files Browse the repository at this point in the history
Upload v0.0.14 to PyPI
  • Loading branch information
stphivos authored Dec 15, 2016
2 parents 65658d3 + a06fd4b commit 78d89ca
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
33 changes: 18 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,14 @@ To run your Django tests without a database, add a new settings file, and call
`monkey_patch_test_db()`. Use a wildcard import to get all the regular settings
as well.

# settings_mocked.py
from django_mock_queries.mocks import monkey_patch_test_db

from users.settings import *

monkey_patch_test_db()
```python
# settings_mocked.py
from django_mock_queries.mocks import monkey_patch_test_db

from users.settings import *

monkey_patch_test_db()
```

Then run your Django tests with the new settings file:

Expand All @@ -165,16 +167,17 @@ If you want to run your tests without a database, you need to tell Django
to skip the tests that need a database. You can do that by putting a skip
decorator on the test classes or test methods that need a database.

@skipIfDBFeature('is_mocked')
class TestApi(TestCase):
def test_create(self):
start_count = User.objects.count()

User.objects.create(username='bob')
final_count = User.objects.count()

self.assertEqual(start_count+1, final_count)
```python
@skipIfDBFeature('is_mocked')
class TestApi(TestCase):
def test_create(self):
start_count = User.objects.count()

User.objects.create(username='bob')
final_count = User.objects.count()

self.assertEqual(start_count + 1, final_count)
```

## Installation

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name='django_mock_queries',
packages=['django_mock_queries'],
version='0.0.13',
version='0.0.14',
description='A django library for mocking queryset functions in memory for testing',
author='Phivos Stylianides',
author_email='[email protected]',
Expand Down

0 comments on commit 78d89ca

Please sign in to comment.