summaryrefslogtreecommitdiffstats
path: root/tools/pharos-dashboard/src/notification/models.py
diff options
context:
space:
mode:
authormaxbr <maxbr@mi.fu-berlin.de>2016-10-17 14:56:11 +0200
committermaxbr <maxbr@mi.fu-berlin.de>2016-10-17 14:56:11 +0200
commitaf9b7ddeb637278a7705964ba98c8e6a2e7307f4 (patch)
tree503203445b0760bc5cd13c1e2d2347fe7fa069bf /tools/pharos-dashboard/src/notification/models.py
parent7022542bc70c448f71fa56c06d90595e276d7dcc (diff)
Add unit tests
JIRA: RELENG-12 This commit increases test statement coverage to 84%. It also fixes the bugs that emerged while testing. Change-Id: I696091f1a07f8b7647872c7cb15f4368a4690619 Signed-off-by: maxbr <maxbr@mi.fu-berlin.de>
Diffstat (limited to 'tools/pharos-dashboard/src/notification/models.py')
-rw-r--r--tools/pharos-dashboard/src/notification/models.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/pharos-dashboard/src/notification/models.py b/tools/pharos-dashboard/src/notification/models.py
index 2d199181..0ee275dd 100644
--- a/tools/pharos-dashboard/src/notification/models.py
+++ b/tools/pharos-dashboard/src/notification/models.py
@@ -26,7 +26,8 @@ class BookingNotification(models.Model):
}
def save(self, *args, **kwargs):
- notifications = self.booking.bookingnotification_set.filter(type=self.type)
- if notifications.count() > 1:
+ notifications = self.booking.bookingnotification_set.filter(type=self.type).exclude(
+ id=self.id)
+ if notifications.count() > 0:
raise ValueError('Doubled Notification')
return super(BookingNotification, self).save(*args, **kwargs) \ No newline at end of file