@@ -1625,7 +1625,6 @@ def test_project_versions_list(mc):
1625
1625
assert versions [0 ]["name" ] == "v2"
1626
1626
assert versions [- 1 ]["name" ] == "v4"
1627
1627
1628
-
1629
1628
def test_report (mc ):
1630
1629
test_project = 'test_download_diffs'
1631
1630
project = API_USER + '/' + test_project
@@ -1662,3 +1661,45 @@ def test_report(mc):
1662
1661
shutil .rmtree (directory )
1663
1662
with pytest .raises (InvalidProject ):
1664
1663
create_report (mc , directory , since , to , report_file )
1664
+
1665
+ def test_project_versions_list (mc , mc2 ):
1666
+ """
1667
+ Test retrieving user permissions
1668
+ """
1669
+ test_project = 'test_permissions'
1670
+ test_project_fullname = API_USER2 + '/' + test_project
1671
+
1672
+ # cleanups
1673
+ project_dir = os .path .join (TMP_DIR , test_project , API_USER )
1674
+ cleanup (mc , test_project_fullname , [project_dir ])
1675
+ cleanup (mc2 , test_project_fullname , [project_dir ])
1676
+
1677
+ # create new (empty) project on server
1678
+ mc2 .create_project (test_project )
1679
+
1680
+ # Add reader access to another client
1681
+ project_info = get_project_info (mc2 , API_USER2 , test_project )
1682
+ access = project_info ['access' ]
1683
+ access ['readersnames' ].append (API_USER )
1684
+ mc2 .set_project_access (test_project_fullname , access )
1685
+
1686
+ # reader should not have write access
1687
+ assert not mc .has_writing_permissions (test_project_fullname )
1688
+
1689
+ # Add writer access to another client
1690
+ project_info = get_project_info (mc2 , API_USER2 , test_project )
1691
+ access = project_info ['access' ]
1692
+ access ['writersnames' ].append (API_USER )
1693
+ mc2 .set_project_access (test_project_fullname , access )
1694
+
1695
+ # now user shold have write access
1696
+ assert mc .has_writing_permissions (test_project_fullname )
1697
+
1698
+ # test organization permissions
1699
+ test_project_fullname = 'testorg' + '/' + 'test_org_permissions'
1700
+
1701
+ # owner should have write access
1702
+ assert mc .has_writing_permissions (test_project_fullname )
1703
+
1704
+ # writer should have write access
1705
+ assert mc2 .has_writing_permissions (test_project_fullname )
0 commit comments