Merged
Conversation
arnaudfnr
reviewed
May 4, 2026
| ) | ||
|
|
||
| self.assertEqual(response.status_code, 200) | ||
| self.assertIn('File uploaded successfully', response.json()['message']) |
Collaborator
There was a problem hiding this comment.
Maybe also assert the filename
| # NOTE: we do not use FileSystemStorage here, as it creates file name contanining both lower and upper case letters | ||
| # but pydantic does not accept upper case letters in file names | ||
| # furthermore, a temp file is more appropriate here because it is deleted automatically after context manager exits | ||
| with NamedTemporaryFile(suffix=uploaded_file_suffix) as temp_file: |
Collaborator
There was a problem hiding this comment.
I also had an issue with file-encoding, one of the csv we received from all4Trees was not utf-8 and an error was raised. I had to manually convert the csv file into utf-8 enconding to make it work.
Might be interesting to add enconding detection using chardet : https://github.com/chardet/chardet and convert every file to utf-8 before reading it (or add the detected encoding to the reader if more simple)
| # furthermore, a temp file is more appropriate here because it is deleted automatically after context manager exits | ||
| with NamedTemporaryFile(suffix=uploaded_file_suffix) as temp_file: | ||
| temp_file.write(uploaded_file.read()) | ||
| file = Path(temp_file.name) |
Collaborator
There was a problem hiding this comment.
The filename does not seems right. I get this : tmpzpc8sbht.csv
Suggested change
| file = Path(temp_file.name) | |
| file = Path(uploaded_file.name) |
arnaudfnr
requested changes
May 4, 2026
2013e4c to
d276449
Compare
arnaudfnr
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #109
map/add-data/