Exemple #1
0
def test_fail_timeformat(client):
    """Fail with an improper time format."""

    for time_format in ['fail_timeformat.csv', 'fail_missing_endtime.csv']:
        with open(prefix(time_format)) as infile:
            with pytest.raises(DatetimeFormatError):
                # response = flask_post(client, infile)
                # return response
                return convert(infile)
Exemple #2
0
def test_fail_headers(client):
    """Test a few conditions with improper headers."""

    fail_headers_files = glob.glob('tests/fail_files/fail_*_header.csv')
    for fail_headers_file in fail_headers_files:
        with open(fail_headers_file) as infile:
            with pytest.raises(HeadersError):
                # response = flask_post(client, infile)
                # return response
                return convert(infile)
Exemple #3
0
def test_fail_timeformat(client):
    """Fail with an improper time format."""

    for time_format in ['fail_timeformat.csv',
                        'fail_missing_endtime.csv']:
        with open(prefix(time_format)) as infile:
            with pytest.raises(DatetimeFormatError):
                # response = flask_post(client, infile)
                # return response
                return convert(infile)
Exemple #4
0
def test_fail_headers(client):
    """Test a few conditions with improper headers."""

    fail_headers_files = glob.glob('tests/fail_files/fail_*_header.csv')
    for fail_headers_file in fail_headers_files:
        with open(fail_headers_file) as infile:
            with pytest.raises(HeadersError):
                # response = flask_post(client, infile)
                # return response
                return convert(infile)
Exemple #5
0
def test_fail_dateformat(client):
    """Fail with an improper date format."""

    for date_format in ['fail_2_digit_years.csv',
                        'fail_missing_startdate.csv']:
        with open(prefix(date_format)) as infile:

            with pytest.raises(DatetimeFormatError):
                # response = flask_post(client, infile)
                # return response
                return convert(infile)
Exemple #6
0
def test_fail_dateformat(client):
    """Fail with an improper date format."""

    for date_format in [
            'fail_2_digit_years.csv', 'fail_missing_startdate.csv'
    ]:
        with open(prefix(date_format)) as infile:

            with pytest.raises(DatetimeFormatError):
                # response = flask_post(client, infile)
                # return response
                return convert(infile)
Exemple #7
0
def test_fail_blank_subject(client):
    """Fail if subject is blank or consists only of spaces."""

    for blank_subject in ['fail_blank_subject_spaces.csv',
                          'fail_blank_subject.csv']:
        with open(prefix(blank_subject)) as infile:

            # Should raise ContentError since blank subject will be skipped
            # and it's the only event.

            # response = flask_post(client, infile)
            # assert "ContentError: " in response.data

            with pytest.raises(ContentError):
                return convert(infile)
Exemple #8
0
def test_fail_blank_subject(client):
    """Fail if subject is blank or consists only of spaces."""

    for blank_subject in [
            'fail_blank_subject_spaces.csv', 'fail_blank_subject.csv'
    ]:
        with open(prefix(blank_subject)) as infile:

            # Should raise ContentError since blank subject will be skipped
            # and it's the only event.

            # response = flask_post(client, infile)
            # assert "ContentError: " in response.data

            with pytest.raises(ContentError):
                return convert(infile)