File: test_sanitize.py

package info (click to toggle)
python-django-debug-toolbar 1%3A6.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,084 kB
  • sloc: python: 7,661; javascript: 636; makefile: 67; sh: 16
file content (18 lines) | stat: -rw-r--r-- 482 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import unittest

from debug_toolbar.sanitize import force_str


class ForceStrTestCase(unittest.TestCase):
    def test_success_convert(self):
        input = 0

        self.assertEqual(force_str(input), "0")

    def test_failed_convert(self):
        input = bytes.fromhex(
            "a3f2b8c14e972d5a8fb3c7291a64e0859c472bf63d18a0945e73b2c84f917ae2"
        )
        self.assertEqual(
            force_str(input), "Django Debug Toolbar was unable to parse value."
        )