Browse Source

add testcase for csv upload

pull/861/head
Christian Gill 4 years ago
parent
commit
43043e302b
3 changed files with 6 additions and 6 deletions
  1. 6
      app/api/tests/data/example.csv
  2. 0
      app/api/tests/data/example_column_and_row_not_matching.csv
  3. 6
      app/api/tests/test_api.py

6
app/api/tests/data/example.csv

@ -1,4 +1,4 @@
text,label
AAA,Positive
BBB,Positive
text,label,meta
AAA
BBB,Positive,The following is meta data
CCC,Negative CCC,Negative

app/api/tests/data/example.invalid.1.csv → app/api/tests/data/example_column_and_row_not_matching.csv

6
app/api/tests/test_api.py

@ -1195,11 +1195,11 @@ class TestUploader(APITestCase):
file_format='csv', file_format='csv',
expected_status=status.HTTP_201_CREATED) expected_status=status.HTTP_201_CREATED)
def test_cannot_upload_csv_file_does_not_match_column_and_row(self):
def test_can_upload_csv_file_does_not_match_column_and_row(self):
self.upload_test_helper(project_id=self.classification_project.id, self.upload_test_helper(project_id=self.classification_project.id,
filename='example.invalid.1.csv',
filename='example_column_and_row_not_matching.csv',
file_format='csv', file_format='csv',
expected_status=status.HTTP_400_BAD_REQUEST)
expected_status=status.HTTP_201_CREATED)
def test_cannot_upload_csv_file_has_too_many_columns(self): def test_cannot_upload_csv_file_has_too_many_columns(self):
self.upload_test_helper(project_id=self.classification_project.id, self.upload_test_helper(project_id=self.classification_project.id,

Loading…
Cancel
Save