@@ -266,6 +266,59 @@ def test_get_groups(self, h_api, http_service):
266266 for group in groups
267267 ]
268268
269+ def test_sync_checkpoints (self , h_api , _api_request ): # noqa: PT019
270+ checkpoints = [
271+ {
272+ "group_authority_provided_id" : "group1" ,
273+ "document_uri" : "https://example.com/doc" ,
274+ "reveal_date" : None ,
275+ }
276+ ]
277+
278+ h_api .sync_checkpoints (authority = "lms.hypothes.is" , checkpoints = checkpoints )
279+
280+ _api_request .assert_called_once_with (
281+ "POST" ,
282+ path = "bulk/checkpoint" ,
283+ body = json .dumps (
284+ {"authority" : "lms.hypothes.is" , "checkpoints" : checkpoints }
285+ ),
286+ headers = {"Content-Type" : "application/json" },
287+ )
288+
289+ def test_sync_checkpoints_with_instructor (self , h_api , _api_request ): # noqa: PT019
290+ checkpoints = [
291+ {
292+ "group_authority_provided_id" : "group1" ,
293+ "document_uri" : "https://example.com/doc" ,
294+ "reveal_date" : None ,
295+ }
296+ ]
297+
298+ h_api .sync_checkpoints (
299+ authority = "lms.hypothes.is" ,
300+ checkpoints = checkpoints ,
301+ instructor_username = "teacher" ,
302+ )
303+
304+ _api_request .assert_called_once_with (
305+ "POST" ,
306+ path = "bulk/checkpoint" ,
307+ body = json .dumps (
308+ {
309+ "authority" : "lms.hypothes.is" ,
310+ "checkpoints" : checkpoints ,
311+ "instructor_username" : "teacher" ,
312+ }
313+ ),
314+ headers = {"Content-Type" : "application/json" },
315+ )
316+
317+ def test_sync_checkpoints_with_no_checkpoints (self , h_api , _api_request ): # noqa: PT019
318+ h_api .sync_checkpoints (authority = "lms.hypothes.is" , checkpoints = [])
319+
320+ _api_request .assert_not_called ()
321+
269322 def test__api_request (self , h_api , http_service ):
270323 h_api ._api_request (sentinel .method , "dummy-path" , body = sentinel .raw_body ) # noqa: SLF001
271324
0 commit comments