<commit_before>from requests import session

from config import Config
from tests.utils import (find_csrf_token,
                         get_sms_via_heroku,
                         create_sample_csv_file,
                         sign_in,
                         sign_out)


def test_csv_upload_journey():
    client = session()
    base_url = Config.NOTIFY_ADMIN_URL
    sign_in(
        client,
        base_url,
        Config.FUNCTIONAL_TEST_EMAIL,
        Config.FUNCTIONAL_TEST_PASSWORD)
    csv_upload_url = '{}/services/{}/send/{}'.format(
        base_url,
        Config.FUNCTIONAL_SERVICE_ID,
        Config.FUNCTIONAL_TEMPLATE_ID)
    get_csv_upload = client.get(csv_upload_url)
    next_token = find_csrf_token(get_csv_upload.text)
    csv_file = create_sample_csv_file([[Config.TWILIO_TEST_NUMBER]])
    files = {'file': ("preview_file.csv", csv_file, 'text/csv')}
    data = {'csrf_token': next_token}
    post_csv_upload = client.post(
        csv_upload_url,
        data=data,
        files=files,
        headers=dict(Referer=csv_upload_url))
    assert post_csv_upload.status_code == 200
    assert 'services/{}/check'.format(Config.FUNCTIONAL_SERVICE_ID) in post_csv_upload.url
    next_token = find_csrf_token(post_csv_upload.text)
    data = {'csrf_token': next_token}
    post_check_sms = client.post(
        post_csv_upload.url,
        data=data,
        headers=dict(Referer=post_csv_upload.url))
    assert post_check_sms.status_code == 200
    assert '/jobs' in post_check_sms.url
    message = get_sms_via_heroku(client)

    # Verify the correct sms message was sent
    assert "The quick brown fox jumped over the lazy dog" in message
    sign_out(client, base_url)<commit_msg>Check url has sms or email in it now<commit_after>from requests import session

from config import Config
from tests.utils import (find_csrf_token,
                         get_sms_via_heroku,
                         create_sample_csv_file,
                         sign_in,
                         sign_out)


def test_csv_upload_journey():
    client = session()
    base_url = Config.NOTIFY_ADMIN_URL
    sign_in(
        client,
        base_url,
        Config.FUNCTIONAL_TEST_EMAIL,
        Config.FUNCTIONAL_TEST_PASSWORD)
    csv_upload_url = '{}/services/{}/send/{}'.format(
        base_url,
        Config.FUNCTIONAL_SERVICE_ID,
        Config.FUNCTIONAL_TEMPLATE_ID)
    get_csv_upload = client.get(csv_upload_url)
    next_token = find_csrf_token(get_csv_upload.text)
    csv_file = create_sample_csv_file([[Config.TWILIO_TEST_NUMBER]])
    files = {'file': ("preview_file.csv", csv_file, 'text/csv')}
    data = {'csrf_token': next_token}
    post_csv_upload = client.post(
        csv_upload_url,
        data=data,
        files=files,
        headers=dict(Referer=csv_upload_url))
    assert post_csv_upload.status_code == 200
    assert 'services/{}/sms/check'.format(Config.FUNCTIONAL_SERVICE_ID) in post_csv_upload.url
    next_token = find_csrf_token(post_csv_upload.text)
    data = {'csrf_token': next_token}
    post_check_sms = client.post(
        post_csv_upload.url,
        data=data,
        headers=dict(Referer=post_csv_upload.url))
    assert post_check_sms.status_code == 200
    assert '/jobs' in post_check_sms.url
    message = get_sms_via_heroku(client)

    # Verify the correct sms message was sent
    assert "The quick brown fox jumped over the lazy dog" in message
    sign_out(client, base_url)
{'fraction_non_alphanumeric': 0.08659136982334202, 'fraction_numerical': 0.0034752389226759338, 'mean_word_length': 2.846325167037862, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '900976', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1113, 'n_words': 205}