|
| 1 | +package teammates.sqlui.webapi; |
| 2 | + |
| 3 | +import static org.mockito.Mockito.mock; |
| 4 | +import static org.mockito.Mockito.mockStatic; |
| 5 | +import static org.mockito.Mockito.never; |
| 6 | +import static org.mockito.Mockito.times; |
| 7 | +import static org.mockito.Mockito.verify; |
| 8 | +import static org.mockito.Mockito.verifyNoMoreInteractions; |
| 9 | +import static org.mockito.Mockito.when; |
| 10 | + |
| 11 | +import java.util.List; |
| 12 | + |
| 13 | +import org.mockito.MockedStatic; |
| 14 | +import org.mockito.Mockito; |
| 15 | +import org.testng.annotations.BeforeMethod; |
| 16 | +import org.testng.annotations.Test; |
| 17 | + |
| 18 | +import teammates.common.util.Const; |
| 19 | +import teammates.common.util.EmailWrapper; |
| 20 | +import teammates.common.util.RequestTracer; |
| 21 | +import teammates.storage.sqlentity.DeadlineExtension; |
| 22 | +import teammates.storage.sqlentity.FeedbackSession; |
| 23 | +import teammates.ui.output.MessageOutput; |
| 24 | +import teammates.ui.webapi.FeedbackSessionClosingSoonRemindersAction; |
| 25 | + |
| 26 | +/** |
| 27 | + * SUT: {@link FeedbackSessionClosingSoonRemindersAction}. |
| 28 | + */ |
| 29 | +public class FeedbackSessionClosingSoonRemindersActionTest |
| 30 | + extends BaseActionTest<FeedbackSessionClosingSoonRemindersAction> { |
| 31 | + |
| 32 | + private FeedbackSession session1; |
| 33 | + private FeedbackSession session2; |
| 34 | + private DeadlineExtension deadlineExtension1; |
| 35 | + private DeadlineExtension deadlineExtension2; |
| 36 | + private DeadlineExtension deadlineExtension3; |
| 37 | + private List<DeadlineExtension> deadlineExtensionsForSession1; |
| 38 | + private List<DeadlineExtension> deadlineExtensionsForSession2; |
| 39 | + |
| 40 | + @Override |
| 41 | + protected String getActionUri() { |
| 42 | + return Const.CronJobURIs.AUTOMATED_FEEDBACK_CLOSING_SOON_REMINDERS; |
| 43 | + } |
| 44 | + |
| 45 | + @Override |
| 46 | + protected String getRequestMethod() { |
| 47 | + return GET; |
| 48 | + } |
| 49 | + |
| 50 | + @BeforeMethod |
| 51 | + public void setUp() { |
| 52 | + Mockito.reset(mockLogic, mockSqlEmailGenerator); |
| 53 | + |
| 54 | + session1 = mock(FeedbackSession.class); |
| 55 | + session2 = mock(FeedbackSession.class); |
| 56 | + deadlineExtension1 = mock(DeadlineExtension.class); |
| 57 | + deadlineExtension2 = mock(DeadlineExtension.class); |
| 58 | + deadlineExtension3 = mock(DeadlineExtension.class); |
| 59 | + |
| 60 | + EmailWrapper mockEmail = mock(EmailWrapper.class); |
| 61 | + EmailWrapper mockEmail2 = mock(EmailWrapper.class); |
| 62 | + EmailWrapper mockDeadlineEmail = mock(EmailWrapper.class); |
| 63 | + EmailWrapper mockDeadlineEmail2 = mock(EmailWrapper.class); |
| 64 | + |
| 65 | + when(mockSqlEmailGenerator.generateFeedbackSessionClosingSoonEmails(session1)).thenReturn(List.of(mockEmail)); |
| 66 | + when(mockSqlEmailGenerator.generateFeedbackSessionClosingSoonEmails(session2)).thenReturn(List.of(mockEmail2)); |
| 67 | + |
| 68 | + when(deadlineExtension1.getFeedbackSession()).thenReturn(session1); |
| 69 | + when(deadlineExtension2.getFeedbackSession()).thenReturn(session1); |
| 70 | + when(deadlineExtension3.getFeedbackSession()).thenReturn(session2); |
| 71 | + |
| 72 | + when(session1.isClosingSoonEmailEnabled()).thenReturn(true); |
| 73 | + when(session2.isClosingSoonEmailEnabled()).thenReturn(false); |
| 74 | + |
| 75 | + deadlineExtensionsForSession1 = List.of(deadlineExtension1, deadlineExtension2); |
| 76 | + deadlineExtensionsForSession2 = List.of(deadlineExtension3); |
| 77 | + when(mockSqlEmailGenerator.generateFeedbackSessionClosingWithExtensionEmails( |
| 78 | + session1, deadlineExtensionsForSession1)).thenReturn(List.of(mockDeadlineEmail)); |
| 79 | + when(mockSqlEmailGenerator.generateFeedbackSessionClosingWithExtensionEmails( |
| 80 | + session2, deadlineExtensionsForSession2)).thenReturn(List.of(mockDeadlineEmail2)); |
| 81 | + } |
| 82 | + |
| 83 | + @Test |
| 84 | + void testExecute_allSessionsClosingSoonAndNoDeadlineExtensionsClosingSoon_emailsSent() { |
| 85 | + when(mockLogic.getFeedbackSessionsClosingWithinTimeLimit()).thenReturn(List.of(session1, session2)); |
| 86 | + when(mockLogic.getDeadlineExtensionsPossiblyNeedingClosingSoonEmail()).thenReturn(List.of()); |
| 87 | + |
| 88 | + try (MockedStatic<RequestTracer> mockRequestTracer = mockStatic(RequestTracer.class)) { |
| 89 | + FeedbackSessionClosingSoonRemindersAction action = getAction(); |
| 90 | + MessageOutput actionOutput = (MessageOutput) getJsonResult(action).getOutput(); |
| 91 | + |
| 92 | + verify(mockLogic, times(1)).getFeedbackSessionsClosingWithinTimeLimit(); |
| 93 | + mockRequestTracer.verify(RequestTracer::checkRemainingTime, times(2)); |
| 94 | + |
| 95 | + // Verify regular closing soon emails |
| 96 | + verify(mockSqlEmailGenerator, times(1)).generateFeedbackSessionClosingSoonEmails(session1); |
| 97 | + verify(mockSqlEmailGenerator, times(1)).generateFeedbackSessionClosingSoonEmails(session2); |
| 98 | + verify(session1, times(1)).setClosingSoonEmailSent(true); |
| 99 | + verify(session2, times(1)).setClosingSoonEmailSent(true); |
| 100 | + |
| 101 | + // Verify deadline extensions grouping |
| 102 | + verify(mockLogic, times(1)).getDeadlineExtensionsPossiblyNeedingClosingSoonEmail(); |
| 103 | + |
| 104 | + verifySpecifiedTasksAdded(Const.TaskQueue.SEND_EMAIL_QUEUE_NAME, 2); |
| 105 | + verifyNoMoreInteractions(mockSqlEmailGenerator, session1, session2, |
| 106 | + deadlineExtension1, deadlineExtension2, deadlineExtension3); |
| 107 | + assertEquals("Successful", actionOutput.getMessage()); |
| 108 | + } |
| 109 | + } |
| 110 | + |
| 111 | + @Test |
| 112 | + void testExecute_oneSessionClosingSoonAndNoDeadlineExtensionsClosingSoon_emailsSent() { |
| 113 | + when(mockLogic.getFeedbackSessionsClosingWithinTimeLimit()).thenReturn(List.of(session1)); |
| 114 | + when(mockLogic.getDeadlineExtensionsPossiblyNeedingClosingSoonEmail()).thenReturn(List.of()); |
| 115 | + |
| 116 | + try (MockedStatic<RequestTracer> mockRequestTracer = mockStatic(RequestTracer.class)) { |
| 117 | + FeedbackSessionClosingSoonRemindersAction action = getAction(); |
| 118 | + MessageOutput actionOutput = (MessageOutput) getJsonResult(action).getOutput(); |
| 119 | + |
| 120 | + verify(mockLogic, times(1)).getFeedbackSessionsClosingWithinTimeLimit(); |
| 121 | + mockRequestTracer.verify(RequestTracer::checkRemainingTime, times(1)); |
| 122 | + |
| 123 | + // Verify regular closing soon emails |
| 124 | + verify(mockSqlEmailGenerator, times(1)).generateFeedbackSessionClosingSoonEmails(session1); |
| 125 | + verify(session1, times(1)).setClosingSoonEmailSent(true); |
| 126 | + |
| 127 | + // Verify deadline extensions grouping |
| 128 | + verify(mockLogic, times(1)).getDeadlineExtensionsPossiblyNeedingClosingSoonEmail(); |
| 129 | + |
| 130 | + verifySpecifiedTasksAdded(Const.TaskQueue.SEND_EMAIL_QUEUE_NAME, 1); |
| 131 | + verifyNoMoreInteractions(mockSqlEmailGenerator, session1, session2, |
| 132 | + deadlineExtension1, deadlineExtension2, deadlineExtension3); |
| 133 | + assertEquals("Successful", actionOutput.getMessage()); |
| 134 | + } |
| 135 | + } |
| 136 | + |
| 137 | + @Test |
| 138 | + void testExecute_noSessionsClosingSoonAndNoDeadlineExtensionsClosingSoon_noEmailsSent() { |
| 139 | + when(mockLogic.getFeedbackSessionsClosingWithinTimeLimit()).thenReturn(List.of()); |
| 140 | + when(mockLogic.getDeadlineExtensionsPossiblyNeedingClosingSoonEmail()).thenReturn(List.of()); |
| 141 | + |
| 142 | + try (MockedStatic<RequestTracer> mockRequestTracer = mockStatic(RequestTracer.class)) { |
| 143 | + FeedbackSessionClosingSoonRemindersAction action = getAction(); |
| 144 | + MessageOutput actionOutput = (MessageOutput) getJsonResult(action).getOutput(); |
| 145 | + |
| 146 | + verify(mockLogic, times(1)).getFeedbackSessionsClosingWithinTimeLimit(); |
| 147 | + mockRequestTracer.verify(RequestTracer::checkRemainingTime, never()); |
| 148 | + verify(mockLogic, times(1)).getDeadlineExtensionsPossiblyNeedingClosingSoonEmail(); |
| 149 | + |
| 150 | + verifyNoTasksAdded(); |
| 151 | + verifyNoMoreInteractions(mockSqlEmailGenerator, session1, session2, |
| 152 | + deadlineExtension1, deadlineExtension2, deadlineExtension3); |
| 153 | + assertEquals("Successful", actionOutput.getMessage()); |
| 154 | + } |
| 155 | + } |
| 156 | + |
| 157 | + @Test |
| 158 | + void testExecute_noSessionsClosingSoonAndAllDeadlineExtensionsWithEmailEnabledClosingSoon_emailsSent() { |
| 159 | + when(mockLogic.getFeedbackSessionsClosingWithinTimeLimit()).thenReturn(List.of()); |
| 160 | + when(mockLogic.getDeadlineExtensionsPossiblyNeedingClosingSoonEmail()).thenReturn(deadlineExtensionsForSession1); |
| 161 | + |
| 162 | + try (MockedStatic<RequestTracer> mockRequestTracer = mockStatic(RequestTracer.class)) { |
| 163 | + FeedbackSessionClosingSoonRemindersAction action = getAction(); |
| 164 | + MessageOutput actionOutput = (MessageOutput) getJsonResult(action).getOutput(); |
| 165 | + |
| 166 | + verify(mockLogic, times(1)).getFeedbackSessionsClosingWithinTimeLimit(); |
| 167 | + mockRequestTracer.verify(RequestTracer::checkRemainingTime, times(1)); |
| 168 | + |
| 169 | + // Verify deadline extensions grouping |
| 170 | + verify(mockLogic, times(1)).getDeadlineExtensionsPossiblyNeedingClosingSoonEmail(); |
| 171 | + verify(deadlineExtension1, times(2)).getFeedbackSession(); |
| 172 | + verify(deadlineExtension2, times(1)).getFeedbackSession(); |
| 173 | + |
| 174 | + // Verify deadline extension emails for session1 (isClosingSoonEmailEnabled() = true) |
| 175 | + verify(session1, times(1)).isClosingSoonEmailEnabled(); |
| 176 | + verify(mockSqlEmailGenerator, times(1)) |
| 177 | + .generateFeedbackSessionClosingWithExtensionEmails(session1, deadlineExtensionsForSession1); |
| 178 | + verify(deadlineExtension1, times(1)).setClosingSoonEmailSent(true); |
| 179 | + verify(deadlineExtension2, times(1)).setClosingSoonEmailSent(true); |
| 180 | + |
| 181 | + verifySpecifiedTasksAdded(Const.TaskQueue.SEND_EMAIL_QUEUE_NAME, 1); |
| 182 | + verifyNoMoreInteractions(mockSqlEmailGenerator, session1, session2, |
| 183 | + deadlineExtension1, deadlineExtension2, deadlineExtension3); |
| 184 | + assertEquals("Successful", actionOutput.getMessage()); |
| 185 | + } |
| 186 | + } |
| 187 | + |
| 188 | + @Test |
| 189 | + void testExecute_noSessionsClosingSoonAndAllDeadlineExtensionsWithEmailDisabledClosingSoon_noEmailsSent() { |
| 190 | + when(mockLogic.getFeedbackSessionsClosingWithinTimeLimit()).thenReturn(List.of()); |
| 191 | + when(mockLogic.getDeadlineExtensionsPossiblyNeedingClosingSoonEmail()).thenReturn(deadlineExtensionsForSession2); |
| 192 | + |
| 193 | + try (MockedStatic<RequestTracer> mockRequestTracer = mockStatic(RequestTracer.class)) { |
| 194 | + FeedbackSessionClosingSoonRemindersAction action = getAction(); |
| 195 | + MessageOutput actionOutput = (MessageOutput) getJsonResult(action).getOutput(); |
| 196 | + |
| 197 | + verify(mockLogic, times(1)).getFeedbackSessionsClosingWithinTimeLimit(); |
| 198 | + mockRequestTracer.verify(RequestTracer::checkRemainingTime, times(1)); |
| 199 | + |
| 200 | + // Verify deadline extensions grouping |
| 201 | + verify(mockLogic, times(1)).getDeadlineExtensionsPossiblyNeedingClosingSoonEmail(); |
| 202 | + verify(deadlineExtension3, times(2)).getFeedbackSession(); |
| 203 | + |
| 204 | + // Verify no deadline extension emails for session2 (isClosingSoonEmailEnabled() = false) |
| 205 | + verify(session2, times(1)).isClosingSoonEmailEnabled(); |
| 206 | + verify(mockSqlEmailGenerator, never()) |
| 207 | + .generateFeedbackSessionClosingWithExtensionEmails(session2, deadlineExtensionsForSession2); |
| 208 | + verify(deadlineExtension3, never()).setClosingSoonEmailSent(true); |
| 209 | + |
| 210 | + verifyNoTasksAdded(); |
| 211 | + verifyNoMoreInteractions(mockSqlEmailGenerator, session1, session2, |
| 212 | + deadlineExtension1, deadlineExtension2, deadlineExtension3); |
| 213 | + assertEquals("Successful", actionOutput.getMessage()); |
| 214 | + } |
| 215 | + } |
| 216 | + |
| 217 | + @Test |
| 218 | + void testExecute_noSessionsClosingSoonAndAllDeadlineExtensionsClosingSoon_onlyEnabledEmailsSent() { |
| 219 | + when(mockLogic.getFeedbackSessionsClosingWithinTimeLimit()).thenReturn(List.of()); |
| 220 | + when(mockLogic.getDeadlineExtensionsPossiblyNeedingClosingSoonEmail()) |
| 221 | + .thenReturn(List.of(deadlineExtension1, deadlineExtension2, deadlineExtension3)); |
| 222 | + |
| 223 | + try (MockedStatic<RequestTracer> mockRequestTracer = mockStatic(RequestTracer.class)) { |
| 224 | + FeedbackSessionClosingSoonRemindersAction action = getAction(); |
| 225 | + MessageOutput actionOutput = (MessageOutput) getJsonResult(action).getOutput(); |
| 226 | + |
| 227 | + verify(mockLogic, times(1)).getFeedbackSessionsClosingWithinTimeLimit(); |
| 228 | + mockRequestTracer.verify(RequestTracer::checkRemainingTime, times(2)); |
| 229 | + |
| 230 | + // Verify deadline extensions grouping |
| 231 | + verify(mockLogic, times(1)).getDeadlineExtensionsPossiblyNeedingClosingSoonEmail(); |
| 232 | + verify(deadlineExtension1, times(2)).getFeedbackSession(); |
| 233 | + verify(deadlineExtension2, times(1)).getFeedbackSession(); |
| 234 | + verify(deadlineExtension3, times(2)).getFeedbackSession(); |
| 235 | + |
| 236 | + // Verify deadline extension emails for session1 (isClosingSoonEmailEnabled() = true) |
| 237 | + verify(session1, times(1)).isClosingSoonEmailEnabled(); |
| 238 | + verify(mockSqlEmailGenerator, times(1)) |
| 239 | + .generateFeedbackSessionClosingWithExtensionEmails(session1, deadlineExtensionsForSession1); |
| 240 | + verify(deadlineExtension1, times(1)).setClosingSoonEmailSent(true); |
| 241 | + verify(deadlineExtension2, times(1)).setClosingSoonEmailSent(true); |
| 242 | + |
| 243 | + // Verify no deadline extension emails for session2 (isClosingSoonEmailEnabled() = false) |
| 244 | + verify(session2, times(1)).isClosingSoonEmailEnabled(); |
| 245 | + verify(mockSqlEmailGenerator, never()) |
| 246 | + .generateFeedbackSessionClosingWithExtensionEmails(session2, deadlineExtensionsForSession2); |
| 247 | + verify(deadlineExtension3, never()).setClosingSoonEmailSent(true); |
| 248 | + |
| 249 | + verifySpecifiedTasksAdded(Const.TaskQueue.SEND_EMAIL_QUEUE_NAME, 1); |
| 250 | + verifyNoMoreInteractions(mockSqlEmailGenerator, session1, session2, |
| 251 | + deadlineExtension1, deadlineExtension2, deadlineExtension3); |
| 252 | + assertEquals("Successful", actionOutput.getMessage()); |
| 253 | + } |
| 254 | + } |
| 255 | + |
| 256 | + @Test |
| 257 | + void testExecute_allSessionsClosingSoonAndAllDeadlineExtensionsWithEmailEnabledClosingSoon_emailsSent() { |
| 258 | + when(mockLogic.getFeedbackSessionsClosingWithinTimeLimit()).thenReturn(List.of(session1, session2)); |
| 259 | + when(mockLogic.getDeadlineExtensionsPossiblyNeedingClosingSoonEmail()).thenReturn(deadlineExtensionsForSession1); |
| 260 | + |
| 261 | + try (MockedStatic<RequestTracer> mockRequestTracer = mockStatic(RequestTracer.class)) { |
| 262 | + FeedbackSessionClosingSoonRemindersAction action = getAction(); |
| 263 | + MessageOutput actionOutput = (MessageOutput) getJsonResult(action).getOutput(); |
| 264 | + |
| 265 | + verify(mockLogic, times(1)).getFeedbackSessionsClosingWithinTimeLimit(); |
| 266 | + mockRequestTracer.verify(RequestTracer::checkRemainingTime, times(3)); |
| 267 | + |
| 268 | + // Verify regular closing soon emails |
| 269 | + verify(mockSqlEmailGenerator, times(1)).generateFeedbackSessionClosingSoonEmails(session1); |
| 270 | + verify(mockSqlEmailGenerator, times(1)).generateFeedbackSessionClosingSoonEmails(session2); |
| 271 | + verify(session1, times(1)).setClosingSoonEmailSent(true); |
| 272 | + verify(session2, times(1)).setClosingSoonEmailSent(true); |
| 273 | + |
| 274 | + // Verify deadline extensions grouping |
| 275 | + verify(mockLogic, times(1)).getDeadlineExtensionsPossiblyNeedingClosingSoonEmail(); |
| 276 | + verify(deadlineExtension1, times(2)).getFeedbackSession(); |
| 277 | + verify(deadlineExtension2, times(1)).getFeedbackSession(); |
| 278 | + |
| 279 | + // Verify deadline extension emails for session1 (isClosingSoonEmailEnabled() = true) |
| 280 | + verify(session1, times(1)).isClosingSoonEmailEnabled(); |
| 281 | + verify(mockSqlEmailGenerator, times(1)) |
| 282 | + .generateFeedbackSessionClosingWithExtensionEmails(session1, deadlineExtensionsForSession1); |
| 283 | + verify(deadlineExtension1, times(1)).setClosingSoonEmailSent(true); |
| 284 | + verify(deadlineExtension2, times(1)).setClosingSoonEmailSent(true); |
| 285 | + |
| 286 | + verifySpecifiedTasksAdded(Const.TaskQueue.SEND_EMAIL_QUEUE_NAME, 3); |
| 287 | + verifyNoMoreInteractions(mockSqlEmailGenerator, session1, session2, |
| 288 | + deadlineExtension1, deadlineExtension2, deadlineExtension3); |
| 289 | + assertEquals("Successful", actionOutput.getMessage()); |
| 290 | + } |
| 291 | + } |
| 292 | + |
| 293 | + @Test |
| 294 | + void testExecute_oneSessionClosingSoonAndAllDeadlineExtensionsClosingSoon_onlyEnabledEmailsSent() { |
| 295 | + when(mockLogic.getFeedbackSessionsClosingWithinTimeLimit()).thenReturn(List.of(session1)); |
| 296 | + when(mockLogic.getDeadlineExtensionsPossiblyNeedingClosingSoonEmail()) |
| 297 | + .thenReturn(List.of(deadlineExtension1, deadlineExtension2, deadlineExtension3)); |
| 298 | + |
| 299 | + try (MockedStatic<RequestTracer> mockRequestTracer = mockStatic(RequestTracer.class)) { |
| 300 | + FeedbackSessionClosingSoonRemindersAction action = getAction(); |
| 301 | + MessageOutput actionOutput = (MessageOutput) getJsonResult(action).getOutput(); |
| 302 | + |
| 303 | + verify(mockLogic, times(1)).getFeedbackSessionsClosingWithinTimeLimit(); |
| 304 | + mockRequestTracer.verify(RequestTracer::checkRemainingTime, times(3)); |
| 305 | + |
| 306 | + // Verify regular closing soon emails (only session1) |
| 307 | + verify(mockSqlEmailGenerator, times(1)).generateFeedbackSessionClosingSoonEmails(session1); |
| 308 | + verify(session1, times(1)).setClosingSoonEmailSent(true); |
| 309 | + |
| 310 | + // Verify deadline extensions grouping |
| 311 | + verify(mockLogic, times(1)).getDeadlineExtensionsPossiblyNeedingClosingSoonEmail(); |
| 312 | + verify(deadlineExtension1, times(2)).getFeedbackSession(); |
| 313 | + verify(deadlineExtension2, times(1)).getFeedbackSession(); |
| 314 | + verify(deadlineExtension3, times(2)).getFeedbackSession(); |
| 315 | + |
| 316 | + // Verify deadline extension emails for session1 (isClosingSoonEmailEnabled() = true) |
| 317 | + verify(session1, times(1)).isClosingSoonEmailEnabled(); |
| 318 | + verify(mockSqlEmailGenerator, times(1)) |
| 319 | + .generateFeedbackSessionClosingWithExtensionEmails(session1, deadlineExtensionsForSession1); |
| 320 | + verify(deadlineExtension1, times(1)).setClosingSoonEmailSent(true); |
| 321 | + verify(deadlineExtension2, times(1)).setClosingSoonEmailSent(true); |
| 322 | + |
| 323 | + // Verify no deadline extension emails for session2 (isClosingSoonEmailEnabled() = false) |
| 324 | + verify(session2, times(1)).isClosingSoonEmailEnabled(); |
| 325 | + verify(mockSqlEmailGenerator, never()) |
| 326 | + .generateFeedbackSessionClosingWithExtensionEmails(session2, deadlineExtensionsForSession2); |
| 327 | + verify(deadlineExtension3, never()).setClosingSoonEmailSent(true); |
| 328 | + |
| 329 | + verifySpecifiedTasksAdded(Const.TaskQueue.SEND_EMAIL_QUEUE_NAME, 2); |
| 330 | + verifyNoMoreInteractions(mockSqlEmailGenerator, session1, session2, |
| 331 | + deadlineExtension1, deadlineExtension2, deadlineExtension3); |
| 332 | + assertEquals("Successful", actionOutput.getMessage()); |
| 333 | + } |
| 334 | + } |
| 335 | + |
| 336 | + @Test |
| 337 | + void testSpecificAccessControl_admin_canAccess() { |
| 338 | + loginAsAdmin(); |
| 339 | + verifyCanAccess(); |
| 340 | + } |
| 341 | + |
| 342 | + @Test |
| 343 | + void testSpecificAccessControl_instructor_cannotAccess() { |
| 344 | + loginAsInstructor("instructor-googleId"); |
| 345 | + verifyCannotAccess(); |
| 346 | + } |
| 347 | + |
| 348 | + @Test |
| 349 | + void testSpecificAccessControl_student_cannotAccess() { |
| 350 | + loginAsStudent("student-googleId"); |
| 351 | + verifyCannotAccess(); |
| 352 | + } |
| 353 | + |
| 354 | + @Test |
| 355 | + void testSpecificAccessControl_loggedOut_cannotAccess() { |
| 356 | + logoutUser(); |
| 357 | + verifyCannotAccess(); |
| 358 | + } |
| 359 | +} |
0 commit comments