Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

Commit

Permalink
Add test to accept UTF8 characters
Browse files Browse the repository at this point in the history
Make it more explicit that bad-characters contains
a unicode control character.

@yolinas, @alexmuller
  • Loading branch information
alexmuller committed Jul 19, 2013
1 parent 2fc914e commit 4da2c86
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backdrop/core/parse_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def parse_rows(data):
for datum in data:
if None in datum.keys():
raise ParseError(
'Some rows ins the CSV file contain more values than columns')
'Some rows in the CSV file contain more values than columns')
if None in datum.values():
raise ParseError(
'Some rows in the CSV file contain fewer values than columns')
Expand Down
1 change: 1 addition & 0 deletions features/fixtures/bad-characters.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
foo
unicodecontrol
4 changes: 4 additions & 0 deletions features/fixtures/currency-symbols.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
foo
£
$
16 changes: 15 additions & 1 deletion features/write_api/upload_validation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Feature: csv upload validation
then I should see the text "There was an error with your upload"
and the platform should have "0" items stored in "foo"

Scenario: non UTF8 characters
Scenario: should reject non UTF8 characters
Given a file named "data.csv" with fixture "bad-characters.csv"
and I am logged in
when I go to "/foo/upload"
Expand All @@ -47,6 +47,20 @@ Feature: csv upload validation
then I should see the text "There was an error with your upload"
and the platform should have "0" items stored in "foo"


Scenario: should accept UTF8 characters
Given a file named "data.csv" with fixture "currency-symbols.csv"
and I am logged in
when I go to "/foo/upload"
and I enter "data.csv" into the file upload field
and I click "Upload"
then the platform should have stored in "foo":
"""
{"foo": "£"}
{"foo": "$"}
{"foo": "€"}
"""

Scenario: no file is provided
Given I am logged in
when I go to "/foo/upload"
Expand Down

0 comments on commit 4da2c86

Please sign in to comment.