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)
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)
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)
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)
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)
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)