Skip to content

Commit

Permalink
remove TestingCache
Browse files Browse the repository at this point in the history
  • Loading branch information
nitely committed Jan 8, 2015
1 parent 9cc55d2 commit fe9832a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 23 deletions.
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,9 @@ The following form fields were tested: `BooleanField`, `CharField`, `EmailField`

Fields that return complex objects are not supported. Basically any object that can be store in a data base is supported, except for DateField which is not supported at this time (sorry).

## Testing helpers
## Testing

DjConfig comes with a helpful cache called `TestingCache`.
This cache is similar to LocMemCache, except it can't be cleared. So you can call `cache.clear()` to clear all your caches but the DjConfig one.
Add `LOCATION` to your cache so you can call `cache.clear()` to clear all your caches but the DjConfig one.

Usage:
```python
Expand All @@ -144,14 +143,12 @@ CACHES = {
# ...
},
'djconfig': {
'BACKEND': 'djconfig.backends.TestingCache',
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': 'test-djconfig',
},
}
```

> **Note:** `LOCATION` is required, otherwise it won't work.
## Limitations

* Although you can register several forms, field names must be unique across forms.
Expand Down
9 changes: 0 additions & 9 deletions djconfig/backends.py

This file was deleted.

9 changes: 1 addition & 8 deletions djconfig/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,6 @@ def test_config(self):
'good': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
},
'also_good': {
'BACKEND': 'djconfig.backends.TestingCache',
},
'bad': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
}
Expand Down Expand Up @@ -285,10 +282,6 @@ def test_config_middleware_check_backend(self):
middleware = DjConfigLocMemMiddleware()
self.assertIsNone(middleware.check_backend())

djconfig.BACKEND = 'also_good'
middleware = DjConfigLocMemMiddleware()
self.assertIsNone(middleware.check_backend())

djconfig.BACKEND = 'bad'
self.assertRaises(ValueError, middleware.check_backend)
finally:
Expand All @@ -300,7 +293,7 @@ def test_config_middleware_check_backend(self):
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
},
'djconfig': {
'BACKEND': 'djconfig.backends.TestingCache',
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': 'test-djconfig',
}
}
Expand Down

0 comments on commit fe9832a

Please sign in to comment.