예제 #1
0
파일: test_fail.py 프로젝트: jellydonut/icw
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)
예제 #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)
예제 #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)
예제 #4
0
파일: test_fail.py 프로젝트: jellydonut/icw
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)
예제 #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)
예제 #6
0
파일: test_fail.py 프로젝트: jellydonut/icw
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)
예제 #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)
예제 #8
0
파일: test_fail.py 프로젝트: jellydonut/icw
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)