示例#1
0
 def test_users_have_independent_clocks(self):
     admin_clock = ClockFeature(self.admin)
     employee_clock = ClockFeature(self.employee)
     admin_clock.start_clock()
     with self.assertRaises(ClockFeature.UnstartedClock):
         employee_clock.stop_clock()
     employee_clock.start_clock()
     employee_clock.stop_clock()
     admin_clock.stop_clock()
示例#2
0
 def stop_clock(self):
     clock = ClockFeature(self.current_user)
     try:
         clock.stop_clock()
     except ClockFeature.UnstartedClock:
         self.error_message('Clock was not started')
     return redirect('/clock')
示例#3
0
 def start_clock(self):
     clock = ClockFeature(self.current_user)
     try:
         clock.start_clock()
     except ClockFeature.ClockAlreadyStarted:
         self.error_message('Clock was already started')
     return redirect('/clock')
示例#4
0
 def get(self):
     clock_feature = ClockFeature(self.current_user)
     clock_is_open = clock_feature.clock_is_open()
     clocks = clock_feature.get_clocks().limit(20)
     now = datetime.now()
     return render_template('dashboard/clock.html', **locals())
示例#5
0
 def setUp(self):
     self.clock = ClockFeature(self.employee)