@@ -1462,3 +1462,105 @@ def test_get_permissions(client_setup: Client):
1462
1462
"_sort" : "id" ,
1463
1463
},
1464
1464
)
1465
+
1466
+
1467
+ def test_get_changeset_default (client_setup : Client ):
1468
+ client = client_setup
1469
+ client .collection_name = "foo"
1470
+ mock_response (client .session )
1471
+
1472
+ client .get_changeset ()
1473
+ client .session .request .assert_called_with (
1474
+ "get" , "/buckets/mybucket/collections/foo/changeset" , params = {"_expected" : 0 }
1475
+ )
1476
+
1477
+
1478
+ def test_get_changeset_bust (client_setup : Client , mocker : MockerFixture ):
1479
+ client = client_setup
1480
+ mock_response (client .session )
1481
+ mocked_random = mocker .patch ("kinto_http.client.random" )
1482
+ mocked_random .randint .return_value = 42
1483
+
1484
+ client .get_changeset (collection = "bar" , bust_cache = True )
1485
+ client .session .request .assert_called_with (
1486
+ "get" , "/buckets/mybucket/collections/bar/changeset" , params = {"_expected" : 42 }
1487
+ )
1488
+
1489
+
1490
+ def test_get_changeset_params (client_setup : Client , mocker : MockerFixture ):
1491
+ client = client_setup
1492
+ mock_response (client .session )
1493
+
1494
+ client .get_changeset (bucket = "foo" , collection = "bar" , _since = '"42"' )
1495
+ client .session .request .assert_called_with (
1496
+ "get" , "/buckets/foo/collections/bar/changeset" , params = {"_expected" : 0 , "_since" : '"42"' }
1497
+ )
1498
+
1499
+
1500
+ def test_request_review (client_setup : Client , mocker : MockerFixture ):
1501
+ client = client_setup .clone (collection = "cid" )
1502
+ mock_response (client .session )
1503
+
1504
+ client .request_review ("r?" )
1505
+ client .session .request .assert_called_with (
1506
+ "patch" ,
1507
+ "/buckets/mybucket/collections/cid" ,
1508
+ headers = {"Content-Type" : "application/json" },
1509
+ payload = {"data" : {"last_editor_comment" : "r?" , "status" : "to-review" }},
1510
+ )
1511
+
1512
+
1513
+ def test_request_review_advanced (client_setup : Client , mocker : MockerFixture ):
1514
+ client = client_setup
1515
+ mock_response (client .session )
1516
+
1517
+ client .request_review ("r?" , id = "cid" , data = {"field" : "foo" }, if_match = '"42"' )
1518
+ client .session .request .assert_called_with (
1519
+ "patch" ,
1520
+ "/buckets/mybucket/collections/cid" ,
1521
+ headers = {"Content-Type" : "application/json" , "If-Match" : '"42"' },
1522
+ payload = {"data" : {"field" : "foo" , "last_editor_comment" : "r?" , "status" : "to-review" }},
1523
+ )
1524
+
1525
+
1526
+ def test_approve_changes (client_setup : Client , mocker : MockerFixture ):
1527
+ client = client_setup
1528
+ mock_response (client .session )
1529
+
1530
+ client .approve_changes (id = "cid" , data = {"field" : "foo" }, if_match = '"42"' )
1531
+ client .session .request .assert_called_with (
1532
+ "patch" ,
1533
+ "/buckets/mybucket/collections/cid" ,
1534
+ headers = {"Content-Type" : "application/json" , "If-Match" : '"42"' },
1535
+ payload = {"data" : {"field" : "foo" , "status" : "to-sign" }},
1536
+ )
1537
+
1538
+
1539
+ def test_decline_changes (client_setup : Client , mocker : MockerFixture ):
1540
+ client = client_setup
1541
+ mock_response (client .session )
1542
+
1543
+ client .decline_changes (message = "r-" , id = "cid" , data = {"field" : "foo" }, if_match = '"42"' )
1544
+ client .session .request .assert_called_with (
1545
+ "patch" ,
1546
+ "/buckets/mybucket/collections/cid" ,
1547
+ headers = {"Content-Type" : "application/json" , "If-Match" : '"42"' },
1548
+ payload = {
1549
+ "data" : {"field" : "foo" , "last_reviewer_comment" : "r-" , "status" : "work-in-progress" }
1550
+ },
1551
+ )
1552
+
1553
+
1554
+ def test_rollback_changes (client_setup : Client , mocker : MockerFixture ):
1555
+ client = client_setup
1556
+ mock_response (client .session )
1557
+
1558
+ client .rollback_changes (message = "cancel" , id = "cid" , data = {"field" : "foo" }, if_match = '"42"' )
1559
+ client .session .request .assert_called_with (
1560
+ "patch" ,
1561
+ "/buckets/mybucket/collections/cid" ,
1562
+ headers = {"Content-Type" : "application/json" , "If-Match" : '"42"' },
1563
+ payload = {
1564
+ "data" : {"field" : "foo" , "last_editor_comment" : "cancel" , "status" : "to-rollback" }
1565
+ },
1566
+ )
0 commit comments