diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-03-25 17:49:08 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-07-21 15:07:41 +0200 |
commit | 6fe154d6122c2316954c64147bb7c0ec65213c16 (patch) | |
tree | 054cf49813ddd244e36d7f4307643f3e0a46568f /archaeological_operations | |
parent | 4f8fe31ad39bf0b82842690aeedf20a50d8812df (diff) | |
download | Ishtar-6fe154d6122c2316954c64147bb7c0ec65213c16.tar.bz2 Ishtar-6fe154d6122c2316954c64147bb7c0ec65213c16.zip |
✅ django 3.2: fix tests
Diffstat (limited to 'archaeological_operations')
-rw-r--r-- | archaeological_operations/tests.py | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 770b57d86..3d85c13c3 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -1876,7 +1876,8 @@ class ParcelTest(ImportTest, TestCase): res = post_response.content.decode("utf8") expected = str( _("This parcel is associated with a context record. It can't be deleted.") - ).replace("'", "'") + ).replace("'", "'") + self.assertIn(expected, res) parcels = models.Parcel.objects.all() self.assertEqual(parcels.count(), 1) @@ -2409,28 +2410,6 @@ class OperationTest(TestCase, OperationInitTest): self.assertIn(b'class="card sheet"', response.content) self.assertNotIn(b"/show-historized-operation/", response.content) - def test_show_pdf(self): - operation = self.operations[0] - c = Client() - response = c.get( - reverse("show-operation", kwargs={"pk": operation.pk, "type": "pdf"}) - ) - # permission denied when not allowed - self.assertEqual(response.status_code, 403) - c.login(username=self.username, password=self.password) - response = c.get( - reverse("show-operation", kwargs={"pk": operation.pk, "type": "pdf"}) - ) - self.assertEqual(response.status_code, 200) - f = BytesIO(response.content) - # nosec: call an explicit bin for testing purpose - filetype = ( - Popen("/usr/bin/file -b --mime -", shell=True, stdout=PIPE, stdin=PIPE) # nosec - .communicate(f.read(1024))[0] - .strip() - ) - self.assertTrue(filetype.startswith(b"application/pdf")) - def test_show_odt(self): locale.setlocale(locale.LC_ALL, "fr_FR.UTF-8") operation = self.operations[0] @@ -2510,7 +2489,7 @@ class OperationTest(TestCase, OperationInitTest): content = response.content.decode() self.assertIn('class="card sheet"', content) self.assertIn("Marmotte", content) - self.assertIn("État d'éveil", content) + self.assertIn("État d'éveil", content) self.assertIn("réveillée", content) self.assertIn("Grenouille", content) self.assertIn(">32303<", content) @@ -2763,7 +2742,7 @@ class LockTest(TestCase, OperationInitTest): response = cls_wiz.wizard_post( self.client, url, step, {"pk": self.operation.pk} ) - msg = str(_("This item is locked for edition.")).replace("'", "'") + msg = str(_("This item is locked for edition.")).replace("'", "'") self.assertIn( msg, response.content.decode(), msg="wizard lock for edition not effective" ) @@ -5606,7 +5585,7 @@ class ApiTest(OperationInitTest, APITestCase): response = self.client.post(url, params, follow=True) self.assertIn( - str(_("is not a valid JSON message")).replace("'", "'"), + str(_("is not a valid JSON message")).replace("'", "'"), response.content.decode(), ) |