Skip to content

Commit

Permalink
fix(Tests): Remove proof images on test tearDown (#529)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn authored Oct 19, 2024
1 parent 99f16df commit 5805eea
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions open_prices/api/proofs/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,15 @@ def setUpTestData(cls):
**PROOF,
"price_count": 15,
"source": "test",
"file": create_fake_image(),
}

def tearDown(self):
"""Clean delete to remove images"""
[p.delete() for p in Proof.objects.all()]
return super().tearDown()

def test_proof_create(self):
self.data["file"] = create_fake_image()
# anonymous
response = self.client.post(self.url, self.data)
self.assertEqual(response.status_code, 403)
Expand Down Expand Up @@ -192,7 +197,6 @@ def test_proof_create(self):
self.assertEqual(p.source, "API") # default value

def test_proof_create_with_app_name(self):
self.data["file"] = create_fake_image()
for app_name in ["", "test app"]:
# with empty app_name
response = self.client.post(
Expand Down

0 comments on commit 5805eea

Please sign in to comment.