File: test_pytest.py

package info (click to toggle)
django-webtest 1.9.13-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 268 kB
  • sloc: python: 1,115; sh: 16; makefile: 8
file content (23 lines) | stat: -rw-r--r-- 747 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- coding: utf-8 -*-

from django.conf import settings

initial_settings = {
    "DEBUG_PROPAGATE_EXCEPTIONS": settings.DEBUG_PROPAGATE_EXCEPTIONS,
    "AUTHENTICATION_BACKENDS": settings.AUTHENTICATION_BACKENDS,
}

def test_django_app(django_app):
    resp = django_app.get('/')
    assert resp.status_int == 200


def test_django_app_post(django_app_factory):
    app = django_app_factory(csrf_checks=False)
    resp = app.post('/')
    assert resp.status_int == 200

def test_app_factory():
    """Ensure django_app_factory properly resets settings."""
    assert settings.DEBUG_PROPAGATE_EXCEPTIONS is initial_settings["DEBUG_PROPAGATE_EXCEPTIONS"]
    assert settings.AUTHENTICATION_BACKENDS == initial_settings["AUTHENTICATION_BACKENDS"]