File: test_util.py

package info (click to toggle)
pastescript 3.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 784 kB
  • sloc: python: 5,212; sh: 65; makefile: 61
file content (15 lines) | stat: -rw-r--r-- 397 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from paste.script.util import secret

def test_random():
    for length in (1, 10, 100):
        data = secret.random_bytes(length)
        assert isinstance(data, bytes)
        assert len(data) == length

def test_secret_string():
    data = secret.secret_string()
    assert isinstance(data, str)

    data = secret.secret_string(20)
    assert isinstance(data, str)
    assert len(data) == 20