Completed
Push — main ( 1d0096...a0aaae )
by Jochen
01:51
created

tests.test_token_cli   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 2

2 Functions

Rating   Name   Duplication   Size   Complexity  
A test_generate_token_produces_different_results() 0 4 1
A test_generate_token() 0 5 1
1
"""
2
:Copyright: 2007-2020 Jochen Kupperschmidt
3
:License: MIT, see LICENSE for details.
4
"""
5
6
import pytest
7
8
from weitersager.tokencli import generate_token
9
10
11
def test_generate_token():
12
    token = generate_token()
13
14
    assert token is not None
15
    assert len(token) >= 32  # Arbitrary number, but token shouldn't be short.
16
17
18
def test_generate_token_produces_different_results():
19
    sample_count = 10
20
    tokens = [generate_token() for _ in range(sample_count)]
21
    assert len(set(tokens)) == sample_count
22