From 5bfb00db7367d0f842d9ea7804c18a0d00e100e4 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Wed, 23 Jan 2019 09:44:03 +0100 Subject: [PATCH] Upgrade bs4 and be compatible to latest soupsieve --- src/requirements/production.txt | 2 +- src/setup.py | 2 +- src/tests/control/test_events.py | 6 ++-- src/tests/presale/test_checkout.py | 46 +++++++++++++++--------------- src/tests/presale/test_orders.py | 8 +++--- 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/requirements/production.txt b/src/requirements/production.txt index 77e61aa42f..617acff845 100644 --- a/src/requirements/production.txt +++ b/src/requirements/production.txt @@ -20,7 +20,7 @@ celery>=4.1.1,<4.2.0 kombu==4.2.* django-statici18n==1.8.* inlinestyler==0.2.* -BeautifulSoup4==4.6.* +BeautifulSoup4==4.7.* slimit lxml static3==0.7.* diff --git a/src/setup.py b/src/setup.py index 4e0879174f..52f6de2f3e 100644 --- a/src/setup.py +++ b/src/setup.py @@ -108,7 +108,7 @@ setup( 'kombu==4.2.*', 'django-statici18n==1.8.*', 'inlinestyler==0.2.*', - 'BeautifulSoup4==4.6.*', + 'BeautifulSoup4==4.7.*', 'slimit', 'lxml', 'static3==0.7.*', diff --git a/src/tests/control/test_events.py b/src/tests/control/test_events.py index 52c6058962..7682c15fa4 100644 --- a/src/tests/control/test_events.py +++ b/src/tests/control/test_events.py @@ -238,15 +238,15 @@ class EventsTest(SoupTest): def test_plugins(self): doc = self.get_doc('/control/event/%s/%s/settings/plugins' % (self.orga1.slug, self.event1.slug)) self.assertIn("PayPal", doc.select(".form-plugins")[0].text) - self.assertIn("Enable", doc.select("[name=plugin:pretix.plugins.paypal]")[0].text) + self.assertIn("Enable", doc.select("[name=\"plugin:pretix.plugins.paypal\"]")[0].text) doc = self.post_doc('/control/event/%s/%s/settings/plugins' % (self.orga1.slug, self.event1.slug), {'plugin:pretix.plugins.paypal': 'enable'}) - self.assertIn("Disable", doc.select("[name=plugin:pretix.plugins.paypal]")[0].text) + self.assertIn("Disable", doc.select("[name=\"plugin:pretix.plugins.paypal\"]")[0].text) doc = self.post_doc('/control/event/%s/%s/settings/plugins' % (self.orga1.slug, self.event1.slug), {'plugin:pretix.plugins.paypal': 'disable'}) - self.assertIn("Enable", doc.select("[name=plugin:pretix.plugins.paypal]")[0].text) + self.assertIn("Enable", doc.select("[name=\"plugin:pretix.plugins.paypal\"]")[0].text) def test_live_disable(self): self.event1.live = False diff --git a/src/tests/presale/test_checkout.py b/src/tests/presale/test_checkout.py index 8e482bb849..e473d48e78 100644 --- a/src/tests/presale/test_checkout.py +++ b/src/tests/presale/test_checkout.py @@ -171,10 +171,10 @@ class CheckoutTestCase(TestCase): response = self.client.get('/%s/%s/checkout/questions/' % (self.orga.slug, self.event.slug), follow=True) doc = BeautifulSoup(response.rendered_content, "lxml") - self.assertEqual(len(doc.select('input[name=%s-question_%s]' % (cr1.id, q1.id))), 1) - self.assertEqual(len(doc.select('input[name=%s-question_%s]' % (cr2.id, q1.id))), 1) - self.assertEqual(len(doc.select('input[name=%s-question_%s]' % (cr1.id, q2.id))), 1) - self.assertEqual(len(doc.select('input[name=%s-question_%s]' % (cr2.id, q2.id))), 1) + self.assertEqual(len(doc.select('input[name="%s-question_%s"]' % (cr1.id, q1.id))), 1) + self.assertEqual(len(doc.select('input[name="%s-question_%s"]' % (cr2.id, q1.id))), 1) + self.assertEqual(len(doc.select('input[name="%s-question_%s"]' % (cr1.id, q2.id))), 1) + self.assertEqual(len(doc.select('input[name="%s-question_%s"]' % (cr2.id, q2.id))), 1) # Not all required fields filled out, expect failure response = self.client.post('/%s/%s/checkout/questions/' % (self.orga.slug, self.event.slug), { @@ -477,7 +477,7 @@ class CheckoutTestCase(TestCase): response = self.client.get('/%s/%s/checkout/questions/' % (self.orga.slug, self.event.slug), follow=True) doc = BeautifulSoup(response.rendered_content, "lxml") - self.assertEqual(len(doc.select('input[name=%s-question_%s]' % (cr1.id, q1.id))), 1) + self.assertEqual(len(doc.select('input[name="%s-question_%s"]' % (cr1.id, q1.id))), 1) f = SimpleUploadedFile("testfile.txt", b"file_content") response = self.client.post('/%s/%s/checkout/questions/' % (self.orga.slug, self.event.slug), { @@ -510,7 +510,7 @@ class CheckoutTestCase(TestCase): ) response = self.client.get('/%s/%s/checkout/questions/' % (self.orga.slug, self.event.slug), follow=True) doc = BeautifulSoup(response.rendered_content, "lxml") - self.assertEqual(len(doc.select('input[name=%s-attendee_email]' % cr1.id)), 1) + self.assertEqual(len(doc.select('input[name="%s-attendee_email"]' % cr1.id)), 1) # Not all required fields filled out, expect failure response = self.client.post('/%s/%s/checkout/questions/' % (self.orga.slug, self.event.slug), { @@ -540,7 +540,7 @@ class CheckoutTestCase(TestCase): ) response = self.client.get('/%s/%s/checkout/questions/' % (self.orga.slug, self.event.slug), follow=True) doc = BeautifulSoup(response.rendered_content, "lxml") - self.assertEqual(len(doc.select('input[name=%s-attendee_name_parts_0]' % cr1.id)), 1) + self.assertEqual(len(doc.select('input[name="%s-attendee_name_parts_0"]' % cr1.id)), 1) # Not all required fields filled out, expect failure response = self.client.post('/%s/%s/checkout/questions/' % (self.orga.slug, self.event.slug), { @@ -571,10 +571,10 @@ class CheckoutTestCase(TestCase): ) response = self.client.get('/%s/%s/checkout/questions/' % (self.orga.slug, self.event.slug), follow=True) doc = BeautifulSoup(response.rendered_content, "lxml") - self.assertEqual(len(doc.select('input[name=%s-attendee_name_parts_0]' % cr1.id)), 1) - self.assertEqual(len(doc.select('input[name=%s-attendee_name_parts_1]' % cr1.id)), 1) - self.assertEqual(len(doc.select('input[name=%s-attendee_name_parts_2]' % cr1.id)), 1) - self.assertEqual(len(doc.select('input[name=%s-attendee_name_parts_3]' % cr1.id)), 1) + self.assertEqual(len(doc.select('input[name="%s-attendee_name_parts_0"]' % cr1.id)), 1) + self.assertEqual(len(doc.select('input[name="%s-attendee_name_parts_1"]' % cr1.id)), 1) + self.assertEqual(len(doc.select('input[name="%s-attendee_name_parts_2"]' % cr1.id)), 1) + self.assertEqual(len(doc.select('input[name="%s-attendee_name_parts_3"]' % cr1.id)), 1) # Not all required fields filled out, expect failure response = self.client.post('/%s/%s/checkout/questions/' % (self.orga.slug, self.event.slug), { @@ -606,7 +606,7 @@ class CheckoutTestCase(TestCase): ) response = self.client.get('/%s/%s/checkout/questions/' % (self.orga.slug, self.event.slug), follow=True) doc = BeautifulSoup(response.rendered_content, "lxml") - self.assertEqual(len(doc.select('input[name=%s-attendee_name_parts_0]' % cr1.id)), 1) + self.assertEqual(len(doc.select('input[name="%s-attendee_name_parts_0"]' % cr1.id)), 1) # Not all fields filled out, expect success response = self.client.post('/%s/%s/checkout/questions/' % (self.orga.slug, self.event.slug), { @@ -630,7 +630,7 @@ class CheckoutTestCase(TestCase): ) response = self.client.get('/%s/%s/checkout/questions/' % (self.orga.slug, self.event.slug), follow=True) doc = BeautifulSoup(response.rendered_content, "lxml") - self.assertEqual(len(doc.select('input[name=city]')), 1) + self.assertEqual(len(doc.select('input[name="city"]')), 1) # Not all required fields filled out, expect failure response = self.client.post('/%s/%s/checkout/questions/' % (self.orga.slug, self.event.slug), { @@ -680,7 +680,7 @@ class CheckoutTestCase(TestCase): ) response = self.client.get('/%s/%s/checkout/questions/' % (self.orga.slug, self.event.slug), follow=True) doc = BeautifulSoup(response.rendered_content, "lxml") - self.assertEqual(len(doc.select('input[name=city]')), 1) + self.assertEqual(len(doc.select('input[name="city"]')), 1) # Not all required fields filled out, expect failure response = self.client.post('/%s/%s/checkout/questions/' % (self.orga.slug, self.event.slug), { @@ -703,8 +703,8 @@ class CheckoutTestCase(TestCase): ) response = self.client.get('/%s/%s/checkout/questions/' % (self.orga.slug, self.event.slug), follow=True) doc = BeautifulSoup(response.rendered_content, "lxml") - self.assertEqual(len(doc.select('input[name=name_parts_0]')), 1) - self.assertEqual(len(doc.select('input[name=street]')), 0) + self.assertEqual(len(doc.select('input[name="name_parts_0"]')), 1) + self.assertEqual(len(doc.select('input[name="street"]')), 0) # Not all required fields filled out, expect failure response = self.client.post('/%s/%s/checkout/questions/' % (self.orga.slug, self.event.slug), { @@ -731,7 +731,7 @@ class CheckoutTestCase(TestCase): ) response = self.client.get('/%s/%s/checkout/payment/' % (self.orga.slug, self.event.slug), follow=True) doc = BeautifulSoup(response.rendered_content, "lxml") - self.assertEqual(len(doc.select('input[name=payment]')), 2) + self.assertEqual(len(doc.select('input[name="payment"]')), 2) response = self.client.post('/%s/%s/checkout/payment/' % (self.orga.slug, self.event.slug), { 'payment': 'banktransfer' }, follow=True) @@ -748,14 +748,14 @@ class CheckoutTestCase(TestCase): ) response = self.client.get('/%s/%s/checkout/payment/' % (self.orga.slug, self.event.slug), follow=True) doc = BeautifulSoup(response.rendered_content, "lxml") - self.assertEqual(len(doc.select('input[name=payment]')), 2) + self.assertEqual(len(doc.select('input[name="payment"]')), 2) CartPosition.objects.create( event=self.event, cart_id=self.session_key, item=self.ticket, price=23, expires=now() + timedelta(minutes=10) ) response = self.client.get('/%s/%s/checkout/payment/' % (self.orga.slug, self.event.slug), follow=True) doc = BeautifulSoup(response.rendered_content, "lxml") - self.assertEqual(len(doc.select('input[name=payment]')), 1) + self.assertEqual(len(doc.select('input[name="payment"]')), 1) response = self.client.post('/%s/%s/checkout/payment/' % (self.orga.slug, self.event.slug), { 'payment': 'banktransfer' }, follow=True) @@ -773,7 +773,7 @@ class CheckoutTestCase(TestCase): ) response = self.client.get('/%s/%s/checkout/payment/' % (self.orga.slug, self.event.slug), follow=True) doc = BeautifulSoup(response.rendered_content, "lxml") - self.assertEqual(len(doc.select('input[name=payment]')), 1) + self.assertEqual(len(doc.select('input[name="payment"]')), 1) response = self.client.post('/%s/%s/checkout/payment/' % (self.orga.slug, self.event.slug), { 'payment': 'banktransfer' }, follow=True) @@ -797,7 +797,7 @@ class CheckoutTestCase(TestCase): ) response = self.client.get('/%s/%s/checkout/payment/' % (self.orga.slug, self.event.slug), follow=True) doc = BeautifulSoup(response.rendered_content, "lxml") - self.assertEqual(len(doc.select('input[name=payment]')), 2) + self.assertEqual(len(doc.select('input[name="payment"]')), 2) response = self.client.post('/%s/%s/checkout/payment/' % (self.orga.slug, self.event.slug), { 'payment': 'banktransfer' }, follow=True) @@ -821,7 +821,7 @@ class CheckoutTestCase(TestCase): ) response = self.client.get('/%s/%s/checkout/payment/' % (self.orga.slug, self.event.slug), follow=True) doc = BeautifulSoup(response.rendered_content, "lxml") - self.assertEqual(len(doc.select('input[name=payment]')), 2) + self.assertEqual(len(doc.select('input[name="payment"]')), 2) response = self.client.post('/%s/%s/checkout/payment/' % (self.orga.slug, self.event.slug), { 'payment': 'banktransfer' }, follow=True) @@ -845,7 +845,7 @@ class CheckoutTestCase(TestCase): ) response = self.client.get('/%s/%s/checkout/payment/' % (self.orga.slug, self.event.slug), follow=True) doc = BeautifulSoup(response.rendered_content, "lxml") - self.assertEqual(len(doc.select('input[name=payment]')), 1) + self.assertEqual(len(doc.select('input[name="payment"]')), 1) response = self.client.post('/%s/%s/checkout/payment/' % (self.orga.slug, self.event.slug), { 'payment': 'banktransfer' }, follow=True) diff --git a/src/tests/presale/test_orders.py b/src/tests/presale/test_orders.py index 5b72424e9b..d567c72a71 100644 --- a/src/tests/presale/test_orders.py +++ b/src/tests/presale/test_orders.py @@ -157,7 +157,7 @@ class OrdersTest(TestCase): response = self.client.get( '/%s/%s/order/%s/%s/modify' % (self.orga.slug, self.event.slug, self.order.code, self.order.secret)) doc = BeautifulSoup(response.rendered_content, "lxml") - self.assertEqual(len(doc.select('input[name=%s-attendee_name_parts_0]' % self.ticket_pos.id)), 1) + self.assertEqual(len(doc.select('input[name="%s-attendee_name_parts_0"]' % self.ticket_pos.id)), 1) # Not all fields filled out, expect success response = self.client.post( @@ -178,7 +178,7 @@ class OrdersTest(TestCase): response = self.client.get( '/%s/%s/order/%s/%s/modify' % (self.orga.slug, self.event.slug, self.order.code, self.order.secret)) doc = BeautifulSoup(response.rendered_content, "lxml") - self.assertEqual(len(doc.select('input[name=%s-attendee_name_parts_0]' % self.ticket_pos.id)), 1) + self.assertEqual(len(doc.select('input[name="%s-attendee_name_parts_0"]' % self.ticket_pos.id)), 1) assert "Peter" in response.rendered_content assert "Lukas" not in response.rendered_content @@ -207,7 +207,7 @@ class OrdersTest(TestCase): response = self.client.get( '/%s/%s/order/%s/%s/modify' % (self.orga.slug, self.event.slug, self.order.code, self.order.secret)) doc = BeautifulSoup(response.rendered_content, "lxml") - self.assertEqual(len(doc.select('input[name=%s-question_%s]' % ( + self.assertEqual(len(doc.select('input[name="%s-question_%s"]' % ( self.ticket_pos.id, self.question.id))), 1) # Not all fields filled out, expect success @@ -230,7 +230,7 @@ class OrdersTest(TestCase): response = self.client.get('/%s/%s/order/%s/%s/modify' % (self.orga.slug, self.event.slug, self.order.code, self.order.secret)) doc = BeautifulSoup(response.rendered_content, "lxml") - self.assertEqual(len(doc.select('input[name=%s-question_%s]' % ( + self.assertEqual(len(doc.select('input[name="%s-question_%s"]' % ( self.ticket_pos.id, self.question.id))), 1) # Not all required fields filled out, expect failure