tiramisu/tests/test_option_username.py

34 lines
1.1 KiB
Python
Raw Normal View History

2014-03-06 22:09:12 +01:00
"configuration objects global API"
2017-07-09 09:49:03 +02:00
from .autopath import do_autopath
2015-07-24 17:54:10 +02:00
do_autopath()
2020-01-22 20:46:18 +01:00
import pytest
2014-03-06 22:09:12 +01:00
2020-01-22 20:46:18 +01:00
from tiramisu import UsernameOption
2018-10-31 08:00:19 +01:00
2014-03-06 22:09:12 +01:00
def test_username():
UsernameOption('a', '', 'string')
UsernameOption('a', '', '_string')
UsernameOption('a', '', 's_tring')
UsernameOption('a', '', 'string_')
UsernameOption('a', '', 'string$')
UsernameOption('a', '', '_string$')
2020-01-22 20:46:18 +01:00
with pytest.raises(ValueError):
UsernameOption('a', '', 'strin$g')
2014-03-06 22:09:12 +01:00
UsernameOption('a', '', 's-tring')
2020-01-22 20:46:18 +01:00
with pytest.raises(ValueError):
UsernameOption('a', '', '-string')
2014-03-06 22:09:12 +01:00
UsernameOption('a', '', 's9tring')
2020-01-22 20:46:18 +01:00
with pytest.raises(ValueError):
UsernameOption('a', '', '9string')
with pytest.raises(ValueError):
UsernameOption('a', '', '')
2014-03-06 22:09:12 +01:00
UsernameOption('a', '', 's')
UsernameOption('a', '', 's2345678901234567890123456789012')
2020-01-22 20:46:18 +01:00
with pytest.raises(ValueError):
UsernameOption('a', '', 's23456789012345678901234567890123')
2014-03-06 22:09:12 +01:00
UsernameOption('a', '', 's234567890123456789012345678901$')
2020-01-22 20:46:18 +01:00
with pytest.raises(ValueError):
UsernameOption('a', '', 's2345678901234567890123456789012$')