Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export View's Unit Test generates unexpected file #635

Open
jackxujh opened this issue May 1, 2020 · 0 comments
Open

Export View's Unit Test generates unexpected file #635

jackxujh opened this issue May 1, 2020 · 0 comments
Assignees
Labels
bug Something isn't working Front End Team

Comments

@jackxujh
Copy link
Contributor

jackxujh commented May 1, 2020

The following function on master branch creates an untracked file in project repository:

def test_export_all_json(self):
# Login
self._get_with_event_code(self.event_url, self.TESTCODE)
event = self.create_venue_and_event(self.event_name)
sensor = self.create_sensor()
self.create_measurement(event, sensor)
response = self.client.post(reverse(self.event_export_all_json_url))
# self.assertTrue("filename=events.zip" in response["Content-Disposition"])
self.assertEqual(200, response.status_code)

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.
@jackxujh jackxujh added bug Something isn't working Front End Team labels May 1, 2020
@jackxujh jackxujh changed the title Export View's Unit Test generate unexpected file Export View's Unit Test generates unexpected file May 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Front End Team
Projects
None yet
Development

No branches or pull requests

4 participants