unit and integration testing

netiawifi
selfisekai 2020-09-05 13:57:10 +02:00
parent 3f2f16abc0
commit ace723dd35
3 changed files with 31 additions and 0 deletions

13
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,13 @@
default:
image: python:3.8-alpine
before_script:
- pip3 install -r librefi/requirements.txt
- pip3 install -r librefi/dev_requirements.txt
unit_tests:
script:
- nosetests tests/*.py
integration_test:
script:
- python3 -m librefi

View File

@ -0,0 +1 @@
nose

17
tests/querystring.py Normal file
View File

@ -0,0 +1,17 @@
from librefi.utils import dump_qs
from hashlib import sha512
def test_dump():
result = dump_qs({
"key": "value",
"three": 3,
"two_and_half": 2.5,
"ziobro": [
{"kurwo": "jebana"},
{"przestań mi": ["kurwa", "rodzinę prześladować"]}],
})
assert sha512(result.encode("utf-8")).hexdigest(
# flake8: noqa: E501
) == '0d0d0598ea18ed0b28b1b4210ac06b742a1cf9a25cb5292db57b9c0cdbcb73bc65d19fa2b7df30dc8281796e3865412760776339a253c10b3025f4b32b187476'
pass