예제 #1
0
파일: team_test.py 프로젝트: nagyist/agilo
 def test_can_combine_different_timezones(self):
     team, member1, member2 = self.team_with_two_members()
     set_user_attribute_in_session(self.env, 'tz', 'GMT', member1.name)
     set_user_attribute_in_session(self.env, 'tz', 'GMT +1:00', member2.name)
     
     capacities = team.capacity(member1.timezone()).hourly_capacities_for_day(today())
     self.assert_length(11, capacities)
     self.assert_equals(1, capacities[0].capacity)
     self.assert_equals(1, capacities[-2].capacity)
예제 #2
0
파일: team_test.py 프로젝트: nagyist/agilo
 def test_can_access_timezone_in_session_table(self):
     timezone_name = "GMT +7:00"
     timezone_offset = timedelta(hours=7)
     timezone = get_timezone(timezone_name)
     self.assert_equals(timezone_offset, timezone.utcoffset(None))
     
     set_user_attribute_in_session(self.env, 'tz', timezone_name, 'tm')
     
     member = self.tmm.create(name='tm')
     self.assert_equals(timezone_offset, member.timezone().utcoffset(None))
예제 #3
0
파일: team_test.py 프로젝트: nagyist/agilo
 def test_can_load_name_and_email_from_session_attributes(self):
     # Create a team member in the session simulating registration
     full_name = "Team Member Test"
     email = "*****@*****.**"
     
     set_user_attribute_in_session(self.env, 'name', full_name, 'tm')
     set_user_attribute_in_session(self.env, 'email', email, 'tm')
     
     tm = self.tmm.create(name='tm')
     self.assert_equals(full_name, tm.full_name)
     self.assert_equals(email, tm.email)
예제 #4
0
파일: team_test.py 프로젝트: nagyist/agilo
 def test_capacity_can_take_timezone_parameter(self):
     team, member = self.team_with_one_member()
     self._set_default_capacity_for_member(0, member)
     set_user_attribute_in_session(self.env, 'tz', 'GMT', member.name)
     self.set_hours_for_day_on_team_member(9, today(member.timezone()), member)
     
     viewer_timezone = get_timezone('GMT -12:00')
     capacitator = team.capacity(viewer_timezone)
     # Need to take the member timezone for start and end, to make sure that we really cut off all
     # workhours he has on the previous day - even though they would be on the current day when
     # viewed from the viewers timezone.
     hourly_capacities = capacitator.hourly_capacities_in_interval(today(tz=member.timezone()), tomorrow(tz=member.timezone()))
     self.assert_length(7, hourly_capacities)
예제 #5
0
파일: team_test.py 프로젝트: nagyist/agilo
 def test_includes_times_from_next_day_that_get_shifted_to_today_through_the_timezone_difference(self):
     team, member1, member2 = self.team_with_two_members()
     set_user_attribute_in_session(self.env, 'tz', 'GMT', member1.name)
     set_user_attribute_in_session(self.env, 'tz', 'GMT +10:00', member2.name)
     
     day = today(tz=member1.timezone())
     tomorrow = day + timedelta(days=1)
     self.set_hours_for_day_on_team_member(9, tomorrow, member2)
     # member2s first hour of tomorrow should happen on today for member1
     capacities = team.capacity(member1.timezone()).hourly_capacities_for_day(day)
     member1_last_hour = datetime.combine(day, time(23, tzinfo=member1.timezone()))
     self.assert_equals(member1_last_hour, capacities[-2].when)
     self.assert_equals(1, capacities[-2].capacity)
예제 #6
0
파일: team_test.py 프로젝트: nagyist/agilo
 def test_includes_times_from_previous_day_that_get_shifted_to_today_through_the_timezone_difference(self):
     team, member1, member2 = self.team_with_two_members()
     set_user_attribute_in_session(self.env, 'tz', 'GMT', member1.name)
     set_user_attribute_in_session(self.env, 'tz', 'GMT -7:00', member2.name)
     
     day = today(tz=member1.timezone())
     yesterday = day - timedelta(days=1)
     self.set_hours_for_day_on_team_member(9, yesterday, member2)
     # member2s last hour of yesterday should happen on today for member1
     capacities = team.capacity(member1.timezone()).hourly_capacities_for_day(day)
     member1_midnight = datetime.combine(day, time(0, tzinfo=member1.timezone()))
     self.assert_equals(member1_midnight, capacities[0].when)
     self.assert_equals(1, capacities[0].capacity)
예제 #7
0
파일: team_test.py 프로젝트: nagyist/agilo
 def test_cuts_off_times_that_would_be_on_previous_day_for_the_viewer(self):
     team, member1 = self.team_with_one_member()
     set_user_attribute_in_session(self.env, 'tz', 'GMT +11:00', member1.name)
     
     viewer_timezone = utc
     # don't want to get values from tomorrow
     self.set_hours_for_day_on_team_member(0, tomorrow(viewer_timezone), member1)
     # 11:00 at his place is 0:00 here, so two values should be lost
     
     capacities = team.capacity(viewer_timezone).hourly_capacities_for_day(today())
     self.assert_length(8, capacities)
     self.assert_equals(1, capacities[0].capacity)
     self.assert_equals(1, capacities[-2].capacity)
     start_of_day_for_member1 = midnight(now(tz=viewer_timezone))
     self.assert_equals(start_of_day_for_member1, capacities[0].when)
예제 #8
0
파일: team_test.py 프로젝트: nagyist/agilo
 def test_can_cut_off_times_that_would_be_on_next_day(self):
     team, member1, member2 = self.team_with_two_members()
     set_user_attribute_in_session(self.env, 'tz', 'GMT', member1.name)
     set_user_attribute_in_session(self.env, 'tz', 'GMT -8:00', member2.name)
     viewer_timezone = member1.timezone()
     self.set_hours_for_day_on_team_member(0, yesterday(viewer_timezone), member2)
     # 15:00 at his place is 23:00 here, so two values should be lost
     
     day = today(tz=member1.timezone())
     capacities = team.capacity(viewer_timezone).hourly_capacities_for_day(day)
     self.assert_length(16, capacities)
     self.assert_equals(1, capacities[0].capacity)
     self.assert_equals(1, capacities[-2].capacity)
     last_hour_of_member1 = datetime.combine(day, time(23, tzinfo=member1.timezone()))
     self.assert_equals(last_hour_of_member1, capacities[-2].when)
예제 #9
0
파일: team_test.py 프로젝트: nagyist/agilo
 def test_falls_back_to_server_timezone_if_garbage_is_set_in_session_table(self):
     set_user_attribute_in_session(self.env, 'tz', "fnord", 'tm')
     member = self.tmm.create(name='tm')
     local_timezone_offset = localtz.utcoffset(now())
     self.assert_equals(local_timezone_offset, member.timezone().utcoffset(now()))
예제 #10
0
파일: team_test.py 프로젝트: nagyist/agilo
 def test_set_get_session_attribute(self):
     team_member = self.tmm.create(name="test_member")
     env = self.teh.get_env()
     set_user_attribute_in_session(env, 'test', 'Test', team_member.name)
     self.assert_equals('Test', get_user_attribute_from_session(env, 'test', team_member.name))
예제 #11
0
파일: model.py 프로젝트: djangsters/agilo
 def _set_email(self, email):
     set_user_attribute_in_session(self.env, 'email', email, self.name)
예제 #12
0
파일: model.py 프로젝트: djangsters/agilo
 def _set_full_name(self, fullname):
     set_user_attribute_in_session(self.env, 'name', fullname, self.name)
예제 #13
0
파일: model.py 프로젝트: nagyist/agilo
 def _set_email(self, email):
     set_user_attribute_in_session(self.env, 'email', email, self.name)
예제 #14
0
파일: model.py 프로젝트: nagyist/agilo
 def _set_full_name(self, fullname):
     set_user_attribute_in_session(self.env, 'name', fullname, self.name)