def test_that_history_file_present_is_valid(self): f = SimpleUploadedFile('history.csv', 'ID,DATE,AMOUNT,DESC\n1,2012-12-12,-19.95,"Amazon"\n2,2012-12-13,-7.50,"Papa Ginos"\n3,2012-12-15,100,"Paychex"') request = RequestFactory().post('/', {'history': f}) form = UploadForm(request.POST, request.FILES) assert form.is_valid()
def test_that_empty_file_is_rejected(self): f = SimpleUploadedFile('history.csv', '') request = RequestFactory().post('/', {'history': f}) form = UploadForm(request.POST, request.FILES) assert not form.is_valid()
def test_that_no_history_file_is_invalid(self): form = UploadForm() assert not form.is_valid()