No project description provided
Project description
Installation
$ pip install pytest-tipsi-django
Features
Default django test settings
if you run pytest after install pytest-tipsi-django, Configuration already has django settings.CACHE[‘default’]
of course if you has Custom django settings, this settings to below are ignored.
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
BROKER_BACKEND = 'memory'
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'TIMEOUT': 60 * 15
}
}
API helpers
There is built-in fixture anonymouse_client and you can create helpers for your users wrapping them with pytest_tipsi_django.client_fixtures.UserWrapper.
It provides you usefull helpers for all request types.
expected parameter in <METHOD>_json is very usefull to prevent tedious status code checks.
from pytest_tipsi_django.client_fixtures import UserWrapper
def test_00_anonymous(anonymous_client, some_url):
query_params = {'filter': 'query'}
body = {'param1': 'param''}
anonymous_client.get_json(some_url, query_params, expected=401)
anonymous_client.post_json(some_url, body, expected=403)
json_response = anonymous_client.patch_json(some_url, body)
anonymous_client.put_json(some_url, body)
anonymous_client.delete_json(some_url)
@pytest.fixture
def user_client(user_object):
yield UserWrapper(user_client)
def test_01_authorized(user_client, some_url):
resp_json = user_client.get_json(some_url, expected=200)
Other fixtures
debug_db_queries - prints performed queries
License
pytest-tipsi-django is distributed under the terms of the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pytest-tipsi-django-2.7.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e76faf3f752d932f21fbe1a1a8a67cf81298cc5ac65f48c822d3631fd8e582b |
|
MD5 | d6ef93a1ed708f61b5fcb4484774c5d2 |
|
BLAKE2b-256 | 3feea6fb6c9fec16458e34f3dfc97af76f1a3be3f8941296d281ca36b6ae5a47 |
Hashes for pytest_tipsi_django-2.7.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d072dd479748ac01790a8030716a20e38c92c7d65a7ea06d7a461082681cfc26 |
|
MD5 | 8a400031c3b7413134116ab8dc5052e1 |
|
BLAKE2b-256 | 9fb891c9868acb91d7999bc66d87f3a9689baeb3fbb2cd5d42796d183034a777 |