@@ -60,7 +60,8 @@ def test_load_student_page(self, student):
6060 def test_appt_sort_order (self , student ):
6161 appts = nessie_timeline_utils .get_sis_appts (student )
6262 appts .extend (nessie_timeline_utils .get_ycbm_appts (student ))
63- appts .sort (key = lambda ap : [ap .created_date , ap .record_id ], reverse = True )
63+ appts .extend (nessie_timeline_utils .get_calendly_appts (student ))
64+ appts .sort (key = lambda ap : [(ap .created_date or ap .start_time ), ap .record_id ], reverse = True )
6465 expected_ids = [a .record_id for a in appts ]
6566 visible_ids = self .student_page .visible_appt_ids ()
6667 utils .assert_equivalence (visible_ids , expected_ids )
@@ -79,7 +80,7 @@ def test_load_student_page(self, tc):
7980
8081 def test_collapsed_detail (self , tc ):
8182 visible = self .student_page .collapsed_appt_detail (tc .appt )
82- if tc .appt .source == TimelineRecordSource .YCBM :
83+ if tc .appt .source in [ TimelineRecordSource .CALENDLY , TimelineRecordSource . YCBM ] :
8384 assert tc .appt .title
8485 utils .assert_equivalence (visible , tc .appt .title )
8586 elif tc .appt .source == TimelineRecordSource .SIS :
@@ -90,15 +91,14 @@ def test_collapsed_detail(self, tc):
9091 utils .assert_actual_includes_expected (visible , placeholder )
9192
9293 def test_collapsed_status (self , tc ):
93- if tc .appt .status == 'Canceled' :
94- utils .assert_equivalence (self .student_page .collapsed_appt_status (tc .appt ), 'CANCELED' )
94+ if tc .appt .status :
95+ utils .assert_equivalence (self .student_page .collapsed_appt_status (tc .appt ), tc . appt . status . upper () )
9596
9697 def test_collapsed_date (self , tc ):
9798 if tc .appt .source == TimelineRecordSource .SIS :
98- assert tc .appt .updated_date
9999 expected = self .student_page .expected_item_short_date_format (tc .appt .updated_date )
100100 else :
101- expected = self .student_page .expected_item_short_date_format (tc .appt .created_date )
101+ expected = self .student_page .expected_item_short_date_format (tc .appt .start_time )
102102 utils .assert_actual_includes_expected (self .student_page .collapsed_appt_date (tc .appt ), expected )
103103
104104 def test_expanded_details (self , tc ):
@@ -107,21 +107,18 @@ def test_expanded_details(self, tc):
107107 assert self .student_page .expanded_appt_details (tc .appt )
108108
109109 def test_expanded_date (self , tc ):
110- assert tc .appt .created_date
111- expected = self .student_page .expected_item_short_date_format (tc .appt .created_date )
110+ if tc .appt .source == TimelineRecordSource .SIS :
111+ expected = self .student_page .expected_item_short_date_format (tc .appt .created_date )
112+ else :
113+ expected = self .student_page .expected_item_short_date_format (tc .appt .start_time )
112114 utils .assert_equivalence (self .student_page .expanded_appt_date (tc .appt ), expected )
113115
114116 def test_expanded_times (self , tc ):
115- if tc .appt .source == TimelineRecordSource .YCBM :
116- assert tc .appt .start_time
117- assert tc .appt .end_time
117+ if tc .appt .source in [TimelineRecordSource .CALENDLY , TimelineRecordSource .YCBM ]:
118118 start = datetime .datetime .strftime (tc .appt .start_time , '%-l:%M %p' )
119119 end = datetime .datetime .strftime (tc .appt .end_time , '%-l:%M %p' )
120120 utils .assert_actual_includes_expected (self .student_page .expanded_appt_time_range (tc .appt ),
121121 f'{ start } - { end } ' )
122- else :
123- assert not tc .appt .start_time
124- assert not tc .appt .end_time
125122
126123 def test_expanded_advisor (self , tc ):
127124 # Appts have varying amounts of advisor info, just verify something's there
@@ -131,7 +128,7 @@ def test_expanded_advisor(self, tc):
131128 elif tc .appt .advisor .last_name :
132129 assert visible
133130
134- def test_expanded_cancellation (self , tc ):
131+ def test_expanded_status (self , tc ):
135132 visible = self .student_page .expanded_appt_cancel_reason (tc .appt )
136133 if tc .appt .status == 'Canceled' and tc .appt .cancel_reason :
137134 actual = re .sub (r'\W' , '' , visible )
@@ -143,7 +140,9 @@ def test_expanded_cancellation(self, tc):
143140 def test_expanded_contact_type (self , tc ):
144141 visible = self .student_page .expanded_appt_type (tc .appt )
145142 if tc .appt .contact_type and tc .appt .contact_type != 'None' :
146- utils .assert_equivalence (visible , tc .appt .contact_type )
143+ utils .assert_actual_includes_expected (visible , tc .appt .contact_type )
144+ elif tc .appt .source == TimelineRecordSource .CALENDLY :
145+ utils .assert_actual_includes_expected (visible , TimelineRecordSource .CALENDLY .value ['name' ])
147146 else :
148147 assert not visible
149148
@@ -170,13 +169,14 @@ def test_expanded_attachments(self, tc):
170169 self .student_page .download_attachment (tc .appt , attach , tc .student )
171170
172171 def test_appt_search (self , tc ):
173- search_string = boa_utils .generate_appt_search_query (tc .appt )
174- if search_string :
175- self .student_page .show_appts ()
176- self .student_page .clear_timeline_appt_search ()
177- appt_count = len (self .student_page .visible_appt_ids ())
178- self .student_page .search_within_timeline_appts (search_string )
179- results = self .student_page .visible_appt_ids ()
180- utils .assert_actual_includes_expected (results , tc .appt .record_id )
181- if appt_count > 1 :
182- assert len (results ) < appt_count
172+ if tc .appt .source != TimelineRecordSource .CALENDLY :
173+ search_string = boa_utils .generate_appt_search_query (tc .appt )
174+ if search_string :
175+ self .student_page .show_appts ()
176+ self .student_page .clear_timeline_appt_search ()
177+ appt_count = len (self .student_page .visible_appt_ids ())
178+ self .student_page .search_within_timeline_appts (search_string )
179+ results = self .student_page .visible_appt_ids ()
180+ utils .assert_actual_includes_expected (results , tc .appt .record_id )
181+ if appt_count > 1 :
182+ assert len (results ) < appt_count
0 commit comments