def test_password_specific(self, length): """ Test the password command (with a length argument >= 4). """ res = commands.password(str(length)) assert len(res) == int(length) assert any(char in res for char in string.ascii_letters) assert any(char in res for char in string.digits) assert any(char in res for char in string.punctuation)
def test_password_specific_short(self, length): """ Test the password command with a length argument < 4. With passwords this short we can't guarantee they'll contain one of each character set. """ res = commands.password(str(length)) assert len(res) == int(length)
def test_password(self): """ Test the default password command. Result should include at least one ascii character, digit, and punctuation character. """ res = commands.password('') assert len(res) == 12 assert any(char in res for char in string.ascii_letters) assert any(char in res for char in string.digits) assert any(char in res for char in string.punctuation)
def test_password_nonint(self): """ Test the password command with a non-integer argument. """ res = commands.password('test') assert res == 'need an integer password length!'