Пример #1
0
 def setUp(self):
     self.super()
     self.start = normalize_date(now())
     duration = timedelta(days=20)
     self.end = normalize_date(self.start + duration)
     self.manager = SprintModelManager(self.env)
     self.tmm = TeamMemberModelManager(self.env)
Пример #2
0
 def setUp(self):
     self.super()
     self.start = normalize_date(now())
     duration = timedelta(days=20)
     self.end = normalize_date(self.start + duration)
     self.manager = SprintModelManager(self.env)
     self.tmm = TeamMemberModelManager(self.env)
Пример #3
0
    def testSprintWithTimezoneDifference(self):
        """Tests the sprint creation and manipulation with Timezone
        differences"""
        # Create a Sprint from Berlin with Daylight risk in Summer
        berlin_tz = get_timezone('GMT +2:00')  # 'Europe/Berlin'
        start_in_berlin = normalize_date(now(tz=berlin_tz))
        cmd_create = SprintController.CreateSprintCommand(
            self.env,
            name='TimezoneSprint',
            milestone='MyRelease',
            team=self.team.name,
            start=start_in_berlin,
            duration=15)
        sprint = self.controller.process_command(cmd_create)
        # now reload the sprint and check if the date is still valid
        # and has been correctly saved... but we will read from San
        # Francisco
        sf_tz = get_timezone('GMT -7:00')  # 'US/Pacific'
        # obvious, but you never know what pytz timezone does with the
        # daylight saving.
        self.assert_equals(start_in_berlin, start_in_berlin.astimezone(sf_tz))

        # check that the sprint.start is in UTC timezone
        self.assert_equals(timedelta(0), sprint.start.utcoffset())
        self.assert_equals(start_in_berlin, sprint.start.astimezone(berlin_tz))
        # now we read it as UTC and we create a SF timezone datetime
        start_in_sf = sprint.start.astimezone(sf_tz)
        # Python should compare the UTC value of the datetimes
        self.assert_equals(start_in_berlin, start_in_sf)
Пример #4
0
 def testSprintWithTimezoneDifference(self):
     """Tests the sprint creation and manipulation with Timezone
     differences"""
     # Create a Sprint from Berlin with Daylight risk in Summer
     berlin_tz = get_timezone('GMT +2:00') # 'Europe/Berlin'
     start_in_berlin = normalize_date(now(tz=berlin_tz))
     cmd_create = SprintController.CreateSprintCommand(self.env,
                                                       name='TimezoneSprint',
                                                       milestone='MyRelease',
                                                       team=self.team.name,
                                                       start=start_in_berlin,
                                                       duration=15)
     sprint = self.controller.process_command(cmd_create)
     # now reload the sprint and check if the date is still valid
     # and has been correctly saved... but we will read from San
     # Francisco
     sf_tz = get_timezone('GMT -7:00') # 'US/Pacific'
     # obvious, but you never know what pytz timezone does with the
     # daylight saving.
     self.assert_equals(start_in_berlin, 
                      start_in_berlin.astimezone(sf_tz))
     
     # check that the sprint.start is in UTC timezone
     self.assert_equals(timedelta(0), sprint.start.utcoffset())
     self.assert_equals(start_in_berlin, 
                      sprint.start.astimezone(berlin_tz))
     # now we read it as UTC and we create a SF timezone datetime
     start_in_sf = sprint.start.astimezone(sf_tz)
     # Python should compare the UTC value of the datetimes
     self.assert_equals(start_in_berlin, start_in_sf)
Пример #5
0
 def runTest(self):
     self._tester.login_as(Usernames.admin)
     # Create the milestone first
     self._tester.create_milestone('milestone2')
     
     # get sprint listing, should be empty
     page_url = self._tester.url + '/admin/agilo/sprints'
     tc.go(page_url)
     tc.url(page_url)
     tc.code(200)
     
     # add new sprint
     sprint_start = normalize_date(now())
     sprint_name = 'Test sprint'
     tc.formvalue('addsprint', 'name', sprint_name)
     tc.formvalue('addsprint', 'start', format_datetime(sprint_start, format='iso8601'))
     tc.formvalue('addsprint', 'duration', '1')
     tc.formvalue('addsprint', 'milestone', 'milestone2')
     tc.submit('add')
     # add redirects to list view, new sprint should be in there
     tc.find(sprint_name)
     # go to detail page
     tc.go("%s/%s" % (page_url, quote(sprint_name)))
     # see if milestone is set correctly
     tc.find('<option selected="selected">\s*milestone2')
     
     # test setting end date, not duration
     tc.formvalue('modcomp', 'description', '[http://www.example.com]')
     tomorrow = sprint_start + timedelta(days=1)
     tc.formvalue('modcomp', 'end', format_datetime(tomorrow, format='iso8601'))
     tc.formvalue('modcomp', 'duration', '')
     tc.submit('save')
     tc.url(page_url)
     
     # duration of the new sprint should be 2
     tc.find('"duration">2</td>')
     
     # --- test invalid values when adding sprint ---
     # no values, should redirect to list view
     tc.formvalue('addsprint', 'name', '')
     tc.submit('add')
     tc.url(page_url)
     
     # invalid date, should throw an error
     tc.formvalue('addsprint', 'name', 'Testsprint 2')
     tc.formvalue('addsprint', 'start', '2008 May 13')
     tc.formvalue('addsprint', 'duration', '1')
     tc.submit('add')
     tc.find('Error: Invalid Date')
     
     # no end date or duration
     tc.go(page_url)
     tc.formvalue('addsprint', 'name', 'Testsprint 2')
     yesterday = now() - timedelta(days=3)
     tc.formvalue('addsprint', 'start', 
                  format_datetime(yesterday, format='iso8601'))
     tc.submit('add')
     tc.url(page_url)
Пример #6
0
 def testCreateSprintCommand(self):
     """Tests the creation of a Sprint like a View would do"""
     sprint_start = normalize_date(now(tz=utc))
     cmd_create = SprintController.CreateSprintCommand(self.env,
                                                       name='AnotherTestSprint',
                                                       milestone='MyRelease',
                                                       team=self.team.name,
                                                       start=sprint_start,
                                                       duration=15)
     sprint = self.controller.process_command(cmd_create)
     self.assert_not_none(sprint)
     self.assert_equals('AnotherTestSprint', sprint.name)
     self.assert_equals('MyRelease', sprint.milestone)
     self.assert_equals('ControllerTeam', sprint.team.name)
     self.assert_equals(sprint_start, sprint.start)
     # Negative test, should not create the sprint cause it exists already
     cmd_create.sprint_name = 'TestSprint'
     self.assert_none(self.controller.process_command(cmd_create))
Пример #7
0
 def testCreateSprintCommand(self):
     """Tests the creation of a Sprint like a View would do"""
     sprint_start = normalize_date(now(tz=utc))
     cmd_create = SprintController.CreateSprintCommand(
         self.env,
         name='AnotherTestSprint',
         milestone='MyRelease',
         team=self.team.name,
         start=sprint_start,
         duration=15)
     sprint = self.controller.process_command(cmd_create)
     self.assert_not_none(sprint)
     self.assert_equals('AnotherTestSprint', sprint.name)
     self.assert_equals('MyRelease', sprint.milestone)
     self.assert_equals('ControllerTeam', sprint.team.name)
     self.assert_equals(sprint_start, sprint.start)
     # Negative test, should not create the sprint cause it exists already
     cmd_create.sprint_name = 'TestSprint'
     self.assert_none(self.controller.process_command(cmd_create))
Пример #8
0
 def _create_sprint(self, name, start_date=None, duration=20, team=None):
     """Creates a sprint"""
     page_url = self._tester.url + '/roadmap'
     tc.go(page_url)
     # click "Add new sprint"
     tc.fv('addnew', 'add', 'click')
     tc.submit()
     tc.url(SPRINT_URL)
     tc.fv('editform', 'name', name)
     if not start_date:
         start_date = now() # This is with localtz
     start_date = normalize_date(start_date)
     tc.fv('editform', 'start', format_datetime(start_date))
     tc.fv('editform', 'duration', str(duration))
     if team:
         tc.fv('editform', 'team', team)
     tc.submit('save')
     tc.url('%s/%s' % (SPRINT_URL, name))
     tc.find('"%s"' % name)
     tc.find(r'(%s)' % format_datetime(start_date))
Пример #9
0
 def _before_set_end(self, value):
     """Sets the end of the sprint, normalizing it"""
     shift_to_next_work_day = not AgiloConfig(self.env).sprints_can_start_or_end_on_weekends
     return normalize_date(value, start=False, shift_to_next_work_day=shift_to_next_work_day)
Пример #10
0
 def test_normalize_date_can_work_with_dates(self):
     self.assert_isinstance(today(), date)
     
     normalize_date(today(), shift_to_next_work_day=True)
     normalize_date(today(), shift_to_next_work_day=False)
Пример #11
0
    def test_normalize_date_can_work_with_dates(self):
        self.assert_isinstance(today(), date)

        normalize_date(today(), shift_to_next_work_day=True)
        normalize_date(today(), shift_to_next_work_day=False)
Пример #12
0
 def _before_set_end(self, value):
     """Sets the end of the sprint, normalizing it"""
     shift_to_next_work_day = not AgiloConfig(self.env).sprints_can_start_or_end_on_weekends
     return normalize_date(value, start=False, shift_to_next_work_day=shift_to_next_work_day)