diff options
Diffstat (limited to 'archaeological_operations/tests.py')
-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 97852379e..b9d28cd62 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -1879,7 +1879,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) @@ -2412,28 +2413,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] @@ -2513,7 +2492,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) @@ -2766,7 +2745,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" ) @@ -5665,7 +5644,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(), ) |