File: test_status.py

package info (click to toggle)
djangorestframework 3.16.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 19,092 kB
  • sloc: javascript: 31,965; python: 29,367; makefile: 32; sh: 6
file content (33 lines) | stat: -rw-r--r-- 951 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
24
25
26
27
28
29
30
31
32
33
from django.test import TestCase

from rest_framework.status import (
    is_client_error, is_informational, is_redirect, is_server_error, is_success
)


class TestStatus(TestCase):
    def test_status_categories(self):
        assert not is_informational(99)
        assert is_informational(100)
        assert is_informational(199)
        assert not is_informational(200)

        assert not is_success(199)
        assert is_success(200)
        assert is_success(299)
        assert not is_success(300)

        assert not is_redirect(299)
        assert is_redirect(300)
        assert is_redirect(399)
        assert not is_redirect(400)

        assert not is_client_error(399)
        assert is_client_error(400)
        assert is_client_error(499)
        assert not is_client_error(500)

        assert not is_server_error(499)
        assert is_server_error(500)
        assert is_server_error(599)
        assert not is_server_error(600)