gcivil-nyu-org / spring2020-cs-gy-9223-class

2 stars 14 forks source link

Export View's Unit Test generates unexpected file #635

Open jackxujh opened 4 years ago

jackxujh commented 4 years ago

The following function on master branch creates an untracked file in project repository: https://github.com/gcivil-nyu-org/spring2020-cs-gy-9223-class/blob/f4fd5ec5fbee3b10397b6b41c6bbf551bee6a560/mercury/tests/test_event.py#L326-L337

Expected Behavior

The test should be tidy in the way that it deletes all files that are generated during the testing process. So it should remove test.json file after its execution.

Current Behavior

A file named test.json will appear after running this test.

Ideas for Improvement

Add the code to remove the file after the test passes.

Steps to Reproduce

  1. Run the above test independently or the entire test suite, for example: python manage.py test mercury.tests.test_event.TestEventView.test_export_all_json
  2. A file named test.json will persist after the test, if it passes. It is unclear to this point whether the file is also left undeleted if the test fails.