6
6
from pom .pages .completedShiftsPage import CompletedShiftsPage
7
7
from pom .pages .authenticationPage import AuthenticationPage
8
8
9
+ from shift .models import VolunteerShift
10
+
9
11
from shift .utils import (
10
12
create_volunteer ,
11
13
create_event_with_details ,
@@ -81,6 +83,11 @@ def test_edit_hours(self):
81
83
self .assertEqual (completed_shifts_page .get_shift_start_time (), '10 a.m.' )
82
84
self .assertEqual (completed_shifts_page .get_shift_end_time (), '1 p.m.' )
83
85
86
+ # database check to ensure logged hours are edited
87
+ self .assertEqual (len (VolunteerShift .objects .all ()), 1 )
88
+ self .assertNotEqual (len (VolunteerShift .objects .filter (
89
+ start_time = '10:00' , end_time = '13:00' )), 0 )
90
+
84
91
def test_end_hours_less_than_start_hours (self ):
85
92
self .register_dataset ()
86
93
completed_shifts_page = self .completed_shifts_page
@@ -93,6 +100,11 @@ def test_end_hours_less_than_start_hours(self):
93
100
except NoSuchElementException :
94
101
raise Exception ("End hours greater than start hours" )
95
102
103
+ # database check to ensure logged hours are not edited
104
+ self .assertEqual (len (VolunteerShift .objects .all ()), 1 )
105
+ self .assertNotEqual (len (VolunteerShift .objects .filter (
106
+ start_time = '12:00' , end_time = '13:00' )), 0 )
107
+
96
108
def test_logged_hours_between_shift_hours (self ):
97
109
self .register_dataset ()
98
110
completed_shifts_page = self .completed_shifts_page
@@ -102,6 +114,11 @@ def test_logged_hours_between_shift_hours(self):
102
114
self .assertEqual (completed_shifts_page .get_danger_box ().text ,
103
115
'Logged hours should be between shift hours' )
104
116
117
+ # database check to ensure logged hours are not edited
118
+ self .assertEqual (len (VolunteerShift .objects .all ()), 1 )
119
+ self .assertNotEqual (len (VolunteerShift .objects .filter (
120
+ start_time = '12:00' , end_time = '13:00' )), 0 )
121
+
105
122
def test_cancel_hours (self ):
106
123
self .register_dataset ()
107
124
completed_shifts_page = self .completed_shifts_page
@@ -117,3 +134,8 @@ def test_cancel_hours(self):
117
134
118
135
with self .assertRaises (NoSuchElementException ):
119
136
self .assertEqual (completed_shifts_page .get_shift_job (), 'job' )
137
+
138
+ # database check to ensure logged hours are cleared
139
+ self .assertEqual (len (VolunteerShift .objects .all ()), 1 )
140
+ self .assertEqual (len (VolunteerShift .objects .filter (
141
+ start_time__isnull = False , end_time__isnull = False )), 0 )
0 commit comments