def testCanNotOverwriteExistingSprintByRename(self): self.assert_not_equals(tomorrow(utc), self.sprint.start) existing_name = 'existing' self.teh.create_sprint(existing_name, start=date_to_datetime(tomorrow(utc))) one_day_before = date_to_datetime(yesterday(), tz=utc) parameters = dict(old_sprint=self.sprint.name, sprint=existing_name, start=one_day_before) self.assert_raises(ICommand.NotValidError, self._save_sprint, **parameters)
def test_gets_read_only_backlog_for_ended_sprint(self): # ensure it ends before the weekend so the test doesn't fail on mondays... sprint_start = date_to_datetime(today() - timedelta(days=4)) sprint_end = sprint_start + timedelta(days=1) sprint = self.teh.create_sprint(name='fnord', start=sprint_start, end=sprint_end) self.assert_smaller_than(sprint.end, date_to_datetime(today())) backlog = self.teh.create_backlog(scope=sprint.name, b_type=BacklogType.SPRINT) backlog_access = self.access_rights_for_backlog(backlog) self.assert_true(backlog_access['is_read_only']) self.assert_equals('Cannot modify sprints that have ended.', backlog_access['reason'])
def test_can_return_backlog_info(self): sprint_start = date_to_datetime(today() - timedelta(days=4)) sprint_end = sprint_start + timedelta(days=1) sprint = self.teh.create_sprint(name='fnord', start=sprint_start, end=sprint_end) backlog = self.teh.create_backlog(scope=sprint.name, b_type=BacklogType.SPRINT) info = self.request_backlog(backlog).backlog_info self.assert_not_none(info.content['configured_columns'])
def testCanEditDataOfExistingSprint(self): # Disable normalization of dates, so that works also on Friday self.teh.disable_sprint_date_normalization() new_sprint_end = date_to_datetime(tomorrow(), tz=utc) self._save_sprint(old_sprint=self.sprint.name, sprint=self.sprint.name, end=new_sprint_end) sprint = self._get_sprint(self.sprint.name) self.assert_equals(new_sprint_end, sprint.end)
def test_not_read_only_if_sprint_not_started(self): self.teh.grant_permission(Usernames.team_member, Action.BACKLOG_EDIT) sprint = self.teh.create_sprint(name='fnord', start=date_to_datetime(today() + timedelta(3))) backlog = self.teh.create_backlog(scope=sprint.name, b_type=BacklogType.SPRINT) backlog_access = self.access_rights_for_backlog(backlog) self.assert_false(backlog_access['is_read_only'], backlog_access['reason'])
def test_date_to_datetime_conversion_returns_datetimes_unmodified(self): some_datetime = now() self.assert_equals(some_datetime, date_to_datetime(some_datetime))
def midnight_in_timezone(timestamp): return midnight( date_to_datetime(timestamp, self.viewer_timezone).astimezone( self.viewer_timezone))
def _filter_entries_outside_of_interval(self, capacities, start, end): start = date_to_datetime(start, self.viewer_timezone) end = date_to_datetime(end, self.viewer_timezone) is_within_interval = lambda capacity: start <= capacity.when <= end return filter(is_within_interval, capacities)
def test_can_convert_date_to_datetime(self): expected_datetime = datetime(2009, 5, 23, 0, 0, tzinfo=localtz) some_datetime = date_to_datetime(date(2009, 5, 23)) self.assert_not_none(some_datetime.tzinfo) self.assert_equals(expected_datetime, some_datetime)
def midnight_in_timezone(timestamp): return midnight(date_to_datetime(timestamp, self.viewer_timezone).astimezone(self.viewer_timezone))
def __init__(self, when): self.when = date_to_datetime(when)
def __init__(self, when): value = self._tick_label(when) when = date_to_datetime(when) self.super(value, when)