From 0cc999410b443c1173b46bfb5282dedc79691e36 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sun, 27 Jun 2021 01:03:54 +1000 Subject: [PATCH] More unit test fixes --- InvenTree/part/test_api.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/InvenTree/part/test_api.py b/InvenTree/part/test_api.py index 3fbf26f8bb..ee01df89cf 100644 --- a/InvenTree/part/test_api.py +++ b/InvenTree/part/test_api.py @@ -445,7 +445,14 @@ class PartDetailTests(InvenTreeAPITestCase): # Try to remove the part response = self.client.delete(url) - + + # As the part is 'active' we cannot delete it + self.assertEqual(response.status_code, 405) + + # So, let's make it not active + response = self.patch(url, {'active': False}, expected_code=200) + + response = self.client.delete(url) self.assertEqual(response.status_code, 204) # Part count should have reduced