From b939bc5a64a20dc2266586548a47a5b33d111891 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Sun, 23 Oct 2016 14:05:25 +0100 Subject: [PATCH] Do not display "not saved" message when the event has been saved --- RIGS/rigboard.py | 4 ++-- RIGS/test_functional.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/RIGS/rigboard.py b/RIGS/rigboard.py index 2e2869ac..f85c72fe 100644 --- a/RIGS/rigboard.py +++ b/RIGS/rigboard.py @@ -125,8 +125,8 @@ class EventDuplicate(EventUpdate): if self.request.method in ('POST', 'PUT'): # This only happens on save (otherwise items won't display in editor) new.pk = None # This means a new event will be created on save, and all items will be re-created - - messages.info(self.request, 'Event data duplicated but not yet saved. Click save to complete operation.') + else: + messages.info(self.request, 'Event data duplicated but not yet saved. Click save to complete operation.') return new diff --git a/RIGS/test_functional.py b/RIGS/test_functional.py index 673dadd1..f6c60865 100644 --- a/RIGS/test_functional.py +++ b/RIGS/test_functional.py @@ -471,6 +471,9 @@ class EventTest(LiveServerTestCase): self.assertIn("Test Item 1", table.text) self.assertIn("Test Item 2", table.text) + # Check the info message is visible + self.assertIn("Event data duplicated but not yet saved",self.browser.find_element_by_id('content').text) + # Add item form.find_element_by_xpath('//button[contains(@class, "item-add")]').click() wait.until(animation_is_finished()) @@ -489,6 +492,7 @@ class EventTest(LiveServerTestCase): save.click() self.assertNotIn("N0000%d"%testEvent.pk, self.browser.find_element_by_xpath('//h1').text) + self.assertNotIn("Event data duplicated but not yet saved", self.browser.find_element_by_id('content').text) # Check info message not visible # Check the new items are visible table = self.browser.find_element_by_id('item-table') # ID number is known, see above