← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:poll-timebombs into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:poll-timebombs into launchpad:master.

Commit message:
Remove some timebombs from poll tests

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/413760

These would otherwise have started failing in 2024.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:poll-timebombs into launchpad:master.
diff --git a/database/sampledata/current-dev.sql b/database/sampledata/current-dev.sql
index 56cdf56..a96d297 100644
--- a/database/sampledata/current-dev.sql
+++ b/database/sampledata/current-dev.sql
@@ -6888,7 +6888,6 @@ INSERT INTO poll (id, team, name, title, dateopens, datecloses, proposition, typ
 INSERT INTO poll (id, team, name, title, dateopens, datecloses, proposition, type, allowspoilt, secrecy, date_created) VALUES (4, 17, 'never-closes2', 'A second random poll that never closes', '2004-01-01 00:00:00', '2104-01-15 00:00:00', 'Whatever proposition.', 2, true, 3, '2006-10-16 18:31:44.616371');
 INSERT INTO poll (id, team, name, title, dateopens, datecloses, proposition, type, allowspoilt, secrecy, date_created) VALUES (5, 17, 'never-closes3', 'A third random poll that never closes', '2004-01-01 00:00:00', '2104-01-15 00:00:00', 'Whatever proposition.', 2, true, 1, '2006-10-16 18:31:44.617218');
 INSERT INTO poll (id, team, name, title, dateopens, datecloses, proposition, type, allowspoilt, secrecy, date_created) VALUES (6, 17, 'never-closes4', 'A public poll that never closes', '2004-01-01 00:00:00', '2104-01-15 00:00:00', 'Whatever proposition.', 1, true, 1, '2007-01-16 18:31:44.615511');
-INSERT INTO poll (id, team, name, title, dateopens, datecloses, proposition, type, allowspoilt, secrecy, date_created) VALUES (7, 17, 'not-yet-opened', 'A public poll that has not opened yet', '2024-01-01 00:00:00', '2104-01-15 00:00:00', 'Whatever proposition.', 1, true, 1, '2007-01-16 18:31:44.615511');
 
 
 ALTER TABLE poll ENABLE TRIGGER ALL;
@@ -6922,7 +6921,6 @@ INSERT INTO polloption (id, poll, name, title, active, date_created) VALUES (20,
 INSERT INTO polloption (id, poll, name, title, active, date_created) VALUES (21, 6, 'OptionB', 'OptionB', true, '2006-10-16 18:31:44.62576');
 INSERT INTO polloption (id, poll, name, title, active, date_created) VALUES (22, 6, 'OptionC', 'OptionC', true, '2006-10-16 18:31:44.626146');
 INSERT INTO polloption (id, poll, name, title, active, date_created) VALUES (23, 6, 'OptionD', 'OptionD', true, '2006-10-16 18:31:44.626573');
-INSERT INTO polloption (id, poll, name, title, active, date_created) VALUES (24, 7, 'OptionX', 'OptionX', true, '2006-10-16 18:31:44.625374');
 
 
 ALTER TABLE polloption ENABLE TRIGGER ALL;
diff --git a/database/sampledata/current.sql b/database/sampledata/current.sql
index df050c1..1121534 100644
--- a/database/sampledata/current.sql
+++ b/database/sampledata/current.sql
@@ -6802,7 +6802,6 @@ INSERT INTO poll (id, team, name, title, dateopens, datecloses, proposition, typ
 INSERT INTO poll (id, team, name, title, dateopens, datecloses, proposition, type, allowspoilt, secrecy, date_created) VALUES (4, 17, 'never-closes2', 'A second random poll that never closes', '2004-01-01 00:00:00', '2104-01-15 00:00:00', 'Whatever proposition.', 2, true, 3, '2006-10-16 18:31:44.616371');
 INSERT INTO poll (id, team, name, title, dateopens, datecloses, proposition, type, allowspoilt, secrecy, date_created) VALUES (5, 17, 'never-closes3', 'A third random poll that never closes', '2004-01-01 00:00:00', '2104-01-15 00:00:00', 'Whatever proposition.', 2, true, 1, '2006-10-16 18:31:44.617218');
 INSERT INTO poll (id, team, name, title, dateopens, datecloses, proposition, type, allowspoilt, secrecy, date_created) VALUES (6, 17, 'never-closes4', 'A public poll that never closes', '2004-01-01 00:00:00', '2104-01-15 00:00:00', 'Whatever proposition.', 1, true, 1, '2007-01-16 18:31:44.615511');
-INSERT INTO poll (id, team, name, title, dateopens, datecloses, proposition, type, allowspoilt, secrecy, date_created) VALUES (7, 17, 'not-yet-opened', 'A public poll that has not opened yet', '2024-01-01 00:00:00', '2104-01-15 00:00:00', 'Whatever proposition.', 1, true, 1, '2007-01-16 18:31:44.615511');
 
 
 ALTER TABLE poll ENABLE TRIGGER ALL;
@@ -6836,7 +6835,6 @@ INSERT INTO polloption (id, poll, name, title, active, date_created) VALUES (20,
 INSERT INTO polloption (id, poll, name, title, active, date_created) VALUES (21, 6, 'OptionB', 'OptionB', true, '2006-10-16 18:31:44.62576');
 INSERT INTO polloption (id, poll, name, title, active, date_created) VALUES (22, 6, 'OptionC', 'OptionC', true, '2006-10-16 18:31:44.626146');
 INSERT INTO polloption (id, poll, name, title, active, date_created) VALUES (23, 6, 'OptionD', 'OptionD', true, '2006-10-16 18:31:44.626573');
-INSERT INTO polloption (id, poll, name, title, active, date_created) VALUES (24, 7, 'OptionX', 'OptionX', true, '2006-10-16 18:31:44.625374');
 
 
 ALTER TABLE polloption ENABLE TRIGGER ALL;
diff --git a/lib/lp/registry/doc/poll.txt b/lib/lp/registry/doc/poll.txt
index bbd77c2..01be4ea 100644
--- a/lib/lp/registry/doc/poll.txt
+++ b/lib/lp/registry/doc/poll.txt
@@ -50,6 +50,11 @@ Now we create a new poll on this team.
     ...     u"leader-election", title, proposition, opendate,
     ...     closedate, secrecy, allowspoilt, type)
 
+We also create a new poll that hasn't yet been opened, which we'll use later.
+    >>> _ = factory.makePoll(
+    ...     team, 'not-yet-opened', 'A public poll that has not opened yet',
+    ...     'Whatever proposition.')
+
 Now we test the if the poll is open or closed in some specific dates.
     >>> poll.isOpen(when=opendate)
     True
diff --git a/lib/lp/registry/interfaces/poll.py b/lib/lp/registry/interfaces/poll.py
index 9fb73ba..699ed59 100644
--- a/lib/lp/registry/interfaces/poll.py
+++ b/lib/lp/registry/interfaces/poll.py
@@ -231,11 +231,8 @@ class IPoll(Interface):
         """Return a timedelta object of the interval between now and the date
         when this poll opens."""
 
-    def newOption(name, title=None, active=True):
-        """Create a new PollOption for this poll.
-
-        If title is None it'll be the same as name.
-        """
+    def newOption(name, title, active=True):
+        """Create a new PollOption for this poll."""
 
     def getActiveOptions():
         """Return all PollOptions of this poll that are active."""
diff --git a/lib/lp/registry/stories/team-polls/edit-options.txt b/lib/lp/registry/stories/team-polls/edit-options.txt
index 75d51c4..5ba7015 100644
--- a/lib/lp/registry/stories/team-polls/edit-options.txt
+++ b/lib/lp/registry/stories/team-polls/edit-options.txt
@@ -29,8 +29,19 @@ either:
     >>> print_feedback_messages(browser.contents)
     You can’t edit any options because the poll is already open.
 
-Since Jeff is an administrator of ubuntu-team and we have a poll that hasn't
-been opened yet, he should be able to edit its options.
+Since Jeff is an administrator of ubuntu-team, he should be able to edit the
+options of a poll that hasn't been opened yet.
+
+    >>> from zope.component import getUtility
+    >>> from lp.registry.interfaces.person import IPersonSet
+
+    >>> login('test@xxxxxxxxxxxxx')
+    >>> ubuntu_team = getUtility(IPersonSet).getByName('ubuntu-team')
+    >>> not_yet_opened = factory.makePoll(
+    ...     ubuntu_team, 'not-yet-opened',
+    ...     'A public poll that has not opened yet', 'Whatever proposition.')
+    >>> _ = not_yet_opened.newOption('OptionX', 'OptionX')
+    >>> logout()
 
     >>> browser.open('http://launchpad.test/~ubuntu-team/+polls')
     >>> browser.getLink('A public poll that has not opened yet').click()

Follow ups