librefi/tests/querystring.py

24 lines
695 B
Python

# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from librefi.utils import dump_qs
from librefi.compat import compat_str
from hashlib import sha512
def test_dump():
obj = {
"key": "value",
"three": 3,
"two_and_half": 2.5,
"ziobro": [
{"kurwo": "jebana"},
{"przestań mi": ["kurwa", "rodzinę prześladować"]}],
}
result = dump_qs(obj)
assert isinstance(result, compat_str)
assert sha512(result.encode("utf-8")).hexdigest(
# flake8: noqa: E501
) == "80cb0feb585e8a5969598797b74c6f7f2f314ee97dfd2d6f4aaf431b800f6c7a1dfe77efd550a1009d41ef2886b21b87ce1d9e4f11444af554a916987344aee1"
pass