<commit_before>import pytest
import YesssSMS
from requests import Session
import time

try:
    from secrets import YESSS_LOGIN, YESSS_PASSWD, YESSS_TO
except ImportError:
    pass


def test_credentials_exist():
    sms = YesssSMS.YesssSMS()
    assert type(sms._logindata['login_rufnummer']) == str
    assert type(sms._logindata['login_passwort']) == str
    assert len(sms._logindata['login_rufnummer']) > 10
    assert len(sms._logindata['login_passwort']) > 0


def test_login():
    sms = YesssSMS.YesssSMS()
    s, r = sms._login(Session(), get_request=True)
    s.get(sms._logout_url)
    assert sms._logindata['login_rufnummer'][-7:]+"</a>" in r.text
    assert r.url == sms._kontomanager


def test_empty_message():
    sms = YesssSMS.YesssSMS()
    with pytest.raises(ValueError) as e_info:
        sms.send(YESSS_TO, "")


def test_login_error():
    # non existing user and password
    sms = YesssSMS.YesssSMS("0000000000", "<PASSWORD>")
    # LoginError
    with pytest.raises(sms.LoginError) as e_info:
        sms.send(YESSS_TO, "test")


def test_login_suspended_error():
    # non existing user and password
    sms = YesssSMS.YesssSMS("0000000123", "<PASSWORD>")
    assert (sms.login_data_valid() is False)
    time.sleep(1.4)
    assert (sms.login_data_valid() is False)
    time.sleep(2.6)
    assert (sms.login_data_valid() is False)
    time.sleep(3.1)
    # LoginError
    with pytest.raises(sms.AccountSuspendedError) as e_info:
        sms.send(YESSS_TO, "test")


def test_send_sms():
    try:
        sms = YesssSMS.YesssSMS()
        sms.send(YESSS_TO, "testing YesssSMS version {}, seems to work! :)"
                           .format(sms._version))
    except ValueError or RuntimeError:
        pytest.fail("Exception raised while sending SMS")<commit_msg>account suspended test<commit_after>import pytest
import YesssSMS
from requests import Session
import time

try:
    from secrets import YESSS_LOGIN, YESSS_PASSWD, YESSS_TO
except ImportError:
    pass


def test_credentials_exist():
    sms = YesssSMS.YesssSMS()
    assert type(sms._logindata['login_rufnummer']) == str
    assert type(sms._logindata['login_passwort']) == str
    assert len(sms._logindata['login_rufnummer']) > 10
    assert len(sms._logindata['login_passwort']) > 0


def test_login():
    sms = YesssSMS.YesssSMS()
    s, r = sms._login(Session(), get_request=True)
    s.get(sms._logout_url)
    assert sms._logindata['login_rufnummer'][-7:]+"</a>" in r.text
    assert r.url == sms._kontomanager


def test_empty_message():
    sms = YesssSMS.YesssSMS()
    with pytest.raises(ValueError) as e_info:
        sms.send(YESSS_TO, "")


def test_login_error():
    # non existing user and password
    sms = YesssSMS.YesssSMS("0000000000", "<PASSWORD>")
    # LoginError
    with pytest.raises(sms.LoginError) as e_info:
        sms.send(YESSS_TO, "test")


def test_login_suspended_error():
    # non existing user and password
    sms = YesssSMS.YesssSMS("0000000123", "CU4uNvCsee")
    assert (sms.login_data_valid() is False)
    time.sleep(1.4)
    assert (sms.login_data_valid() is False)
    time.sleep(2.6)
    assert (sms.login_data_valid() is False)
    time.sleep(3.1)
    # LoginError
    with pytest.raises(sms.AccountSuspendedError) as e_info:
        sms.send(YESSS_TO, "test")
    assert sms._suspended is True
    assert sms.account_is_suspended() is True


def test_send_sms():
    try:
        sms = YesssSMS.YesssSMS()
        sms.send(YESSS_TO, "testing YesssSMS version {}, seems to work! :)"
                           .format(sms._version))
    except ValueError or RuntimeError:
        pytest.fail("Exception raised while sending SMS")
{'fraction_non_alphanumeric': 0.11815954260822216, 'fraction_numerical': 0.016607677647699427, 'mean_word_length': 3.4969400244798043, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2935965', 'n_tokens_mistral': 1429, 'n_tokens_neox': 1359, 'n_words': 273}