From 36d258253fd3283acaa4839863cccca2bdf35730 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Fri, 12 May 2017 21:32:17 +0100 Subject: [PATCH] Fix issues caused by dependency upgrades --- PyRIGS/decorators.py | 3 +-- RIGS/test_functional.py | 8 ++------ RIGS/test_models.py | 3 ++- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/PyRIGS/decorators.py b/PyRIGS/decorators.py index 4b897923..f9bb4c20 100644 --- a/PyRIGS/decorators.py +++ b/PyRIGS/decorators.py @@ -1,6 +1,5 @@ from django.contrib.auth import REDIRECT_FIELD_NAME from django.shortcuts import render -from django.template import RequestContext from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse @@ -88,7 +87,7 @@ def nottinghamtec_address_required(function): def wrap(request, *args, **kwargs): # Fail if current user's email address isn't @nottinghamtec.co.uk if not request.user.email.endswith('@nottinghamtec.co.uk'): - error_resp = render_to_response('RIGS/eventauthorisation_request_error.html', context_instance=RequestContext(request)) + error_resp = render(request, 'RIGS/eventauthorisation_request_error.html') return error_resp return function(request, *args, **kwargs) diff --git a/RIGS/test_functional.py b/RIGS/test_functional.py index 231ade20..38c7173a 100644 --- a/RIGS/test_functional.py +++ b/RIGS/test_functional.py @@ -520,9 +520,6 @@ class EventTest(LiveServerTestCase): self.assertIn("N%05d"%testEvent.pk, infoPanel.find_element_by_xpath('//dt[text()="Based On"]/following-sibling::dd[1]').text) - # Check the PO hasn't carried through - self.assertNotIn("TESTPO", infoPanel.find_element_by_xpath('//dt[text()="PO"]/following-sibling::dd[1]').text) - self.browser.get(self.live_server_url + '/event/' + str(testEvent.pk)) #Go back to the old event #Check that based-on hasn't crept into the old event @@ -530,9 +527,6 @@ class EventTest(LiveServerTestCase): self.assertNotIn("N%05d"%testEvent.pk, infoPanel.find_element_by_xpath('//dt[text()="Based On"]/following-sibling::dd[1]').text) - # Check the PO remains on the old event - self.assertIn("TESTPO", infoPanel.find_element_by_xpath('//dt[text()="PO"]/following-sibling::dd[1]').text) - # Check the items are as they were table = self.browser.find_element_by_id('item-table') # ID number is known, see above self.assertIn("Test Item 1", table.text) @@ -976,6 +970,7 @@ class ClientEventAuthorisationTest(TestCase): email='teccie@functional.test', is_superuser=True # lazily grant all permissions )[0] + self.vatrate = models.VatRate.objects.create(start_at='2014-03-05', rate=0.20, comment='test1') venue = models.Venue.objects.create(name='Authorisation Test Venue') client = models.Person.objects.create(name='Authorisation Test Person', email='authorisation@functional.test') organisation = models.Organisation.objects.create(name='Authorisation Test Organisation', union_account=False) @@ -1078,6 +1073,7 @@ class TECEventAuthorisationTest(TestCase): cls.profile.save() def setUp(self): + self.vatrate = models.VatRate.objects.create(start_at='2014-03-05', rate=0.20, comment='test1') venue = models.Venue.objects.create(name='Authorisation Test Venue') client = models.Person.objects.create(name='Authorisation Test Person', email='authorisation@functional.test') organisation = models.Organisation.objects.create(name='Authorisation Test Organisation', union_account=False) diff --git a/RIGS/test_models.py b/RIGS/test_models.py index 1fd8b4a0..b5dfd1e3 100644 --- a/RIGS/test_models.py +++ b/RIGS/test_models.py @@ -360,6 +360,7 @@ class EventPricingTestCase(TestCase): class EventAuthorisationTestCase(TestCase): def setUp(self): + models.VatRate.objects.create(rate=0.20, comment="TP V1", start_at='2013-01-01') self.profile = models.Profile.objects.get_or_create( first_name='Test', last_name='TEC User', @@ -385,7 +386,7 @@ class EventAuthorisationTestCase(TestCase): self.assertTrue(self.event.authorised) def test_last_edited(self): - with reversion.create_revision(): + with reversion.revisions.create_revision(): auth = models.EventAuthorisation.objects.create(event=self.event, email="authroisation@model.test.case", name="Test Auth", amount=self.event.total, sent_by=self.profile) self.assertIsNotNone(auth.last_edited_at)