File: test_api_views.py

package info (click to toggle)
python-django-structlog 9.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,004 kB
  • sloc: python: 3,509; sh: 206; javascript: 79; makefile: 19
file content (14 lines) | stat: -rw-r--r-- 409 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import pytest

from .. import api_views

pytestmark = pytest.mark.django_db


class TestApiView:
    def test(self, caplog, request_factory):
        response = api_views.home_api_view(request_factory.get("/"))
        assert response.status_code == 200
        assert len(caplog.records) == 1
        record = caplog.records[0]
        assert record.msg["event"] == "This is a rest-framework structured log"