예제 #1
0
def test_generate_code_returns_valid_sha1_string():
    import re

    code = Article.generate_code()
    assert re.match(r'^[0-9a-f]{40}$', code)
예제 #2
0
def test_generate_code_returns_always_new_code():
    codes = [c for c in filter(lambda x: Article.generate_code(), range(5))]
    assert 5 == len(set(codes))
예제 #3
0
def test_generate_code_returns_fixed_length_string():
    code = Article.generate_code()
    assert 40 == len(code)