| |
@@ -36,6 +36,8 @@
|
| |
class PagureFlaskApiProjecttests(tests.Modeltests):
|
| |
""" Tests for the flask API of pagure for issue """
|
| |
|
| |
+ maxDiff = None
|
| |
+
|
| |
def setUp(self):
|
| |
super(PagureFlaskApiProjecttests, self).setUp()
|
| |
self.gga_patcher = patch(
|
| |
@@ -225,9 +227,15 @@
|
| |
},
|
| |
"projects": [
|
| |
{
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": []},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["pingou"],
|
| |
"ticket": [],
|
| |
@@ -441,9 +449,15 @@
|
| |
},
|
| |
"projects": [
|
| |
{
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": []},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["pingou"],
|
| |
"ticket": [],
|
| |
@@ -502,9 +516,15 @@
|
| |
},
|
| |
"projects": [
|
| |
{
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": []},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["pingou"],
|
| |
"ticket": [],
|
| |
@@ -535,9 +555,15 @@
|
| |
},
|
| |
},
|
| |
{
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": []},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["pingou"],
|
| |
"ticket": [],
|
| |
@@ -568,9 +594,15 @@
|
| |
},
|
| |
},
|
| |
{
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": []},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["pingou"],
|
| |
"ticket": [],
|
| |
@@ -629,9 +661,15 @@
|
| |
},
|
| |
"projects": [
|
| |
{
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": []},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["pingou"],
|
| |
"ticket": [],
|
| |
@@ -662,9 +700,15 @@
|
| |
},
|
| |
},
|
| |
{
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": []},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["pingou"],
|
| |
"ticket": [],
|
| |
@@ -695,9 +739,15 @@
|
| |
},
|
| |
},
|
| |
{
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": []},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["pingou"],
|
| |
"ticket": [],
|
| |
@@ -752,9 +802,15 @@
|
| |
},
|
| |
"projects": [
|
| |
{
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": []},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["pingou"],
|
| |
"ticket": [],
|
| |
@@ -809,9 +865,15 @@
|
| |
},
|
| |
"projects": [
|
| |
{
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": []},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["pingou"],
|
| |
"ticket": [],
|
| |
@@ -882,9 +944,15 @@
|
| |
data["date_created"] = "1436527638"
|
| |
data["date_modified"] = "1436527638"
|
| |
expected_data = {
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": []},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["pingou"],
|
| |
"ticket": [],
|
| |
@@ -972,11 +1040,13 @@
|
| |
expected_data = {
|
| |
"access_groups": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": ["some_group"],
|
| |
"ticket": [],
|
| |
},
|
| |
"access_users": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["pingou"],
|
| |
"ticket": [],
|
| |
@@ -1036,9 +1106,15 @@
|
| |
data["date_created"] = "1436527638"
|
| |
data["date_modified"] = "1436527638"
|
| |
expected_data = {
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": []},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["pingou"],
|
| |
"ticket": [],
|
| |
@@ -1101,9 +1177,15 @@
|
| |
},
|
| |
"projects": [
|
| |
{
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": []},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["pingou"],
|
| |
"ticket": [],
|
| |
@@ -1134,9 +1216,15 @@
|
| |
},
|
| |
},
|
| |
{
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": []},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["pingou"],
|
| |
"ticket": [],
|
| |
@@ -1167,9 +1255,15 @@
|
| |
},
|
| |
},
|
| |
{
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": []},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["pingou"],
|
| |
"ticket": [],
|
| |
@@ -1238,9 +1332,15 @@
|
| |
"pagination": {"next": None, "page": 2, "pages": 2, "per_page": 2},
|
| |
"projects": [
|
| |
{
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": []},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["pingou"],
|
| |
"ticket": [],
|
| |
@@ -1396,9 +1496,15 @@
|
| |
data["date_created"] = "1496338274"
|
| |
data["date_modified"] = "1496338274"
|
| |
expected_output = {
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": []},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["foo"],
|
| |
"ticket": [],
|
| |
@@ -1451,9 +1557,15 @@
|
| |
data["date_created"] = "1496338274"
|
| |
data["date_modified"] = "1496338274"
|
| |
expected_output = {
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": []},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": ["pingou"],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["foo"],
|
| |
"ticket": [],
|
| |
@@ -1516,9 +1628,15 @@
|
| |
data["date_created"] = "1496338274"
|
| |
data["date_modified"] = "1496338274"
|
| |
expected_output = {
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": []},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": ["pingou"],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["foo"],
|
| |
"ticket": [],
|
| |
@@ -1573,9 +1691,15 @@
|
| |
data["date_created"] = "1496338274"
|
| |
data["date_modified"] = "1496338274"
|
| |
expected_output = {
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": []},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["foo"],
|
| |
"ticket": [],
|
| |
@@ -1632,9 +1756,15 @@
|
| |
data["date_created"] = "1496338274"
|
| |
data["date_modified"] = "1496338274"
|
| |
expected_output = {
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": []},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["foo"],
|
| |
"ticket": [],
|
| |
@@ -2986,7 +3116,8 @@
|
| |
|
| |
project = pagure.lib.query._get_project(self.session, "test")
|
| |
self.assertEquals(
|
| |
- project.access_users, {"admin": [], "commit": [], "ticket": []}
|
| |
+ project.access_users,
|
| |
+ {"admin": [], "collaborator": [], "commit": [], "ticket": []},
|
| |
)
|
| |
|
| |
def test_api_modify_acls_no_project(self):
|
| |
@@ -3126,9 +3257,15 @@
|
| |
data["date_modified"] = "1510742566"
|
| |
|
| |
expected_output = {
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": []},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": ["foo"],
|
| |
"owner": ["pingou"],
|
| |
"ticket": [],
|
| |
@@ -3190,9 +3327,15 @@
|
| |
data["date_modified"] = "1510742566"
|
| |
|
| |
expected_output = {
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": ["baz"]},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": ["baz"],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["pingou"],
|
| |
"ticket": [],
|
| |
@@ -3231,7 +3374,8 @@
|
| |
|
| |
project = pagure.lib.query._get_project(self.session, "test")
|
| |
self.assertEquals(
|
| |
- project.access_users, {"admin": [], "commit": [], "ticket": []}
|
| |
+ project.access_users,
|
| |
+ {"admin": [], "collaborator": [], "commit": [], "ticket": []},
|
| |
)
|
| |
|
| |
data = {"user_type": "user", "name": "foo"}
|
| |
@@ -3280,7 +3424,12 @@
|
| |
user_foo = pagure.lib.query.search_user(self.session, username="foo")
|
| |
self.assertEquals(
|
| |
project.access_users,
|
| |
- {"admin": [], "commit": [user_foo], "ticket": []},
|
| |
+ {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [user_foo],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
)
|
| |
|
| |
# Create an API token for `foo` for the project `test`
|
| |
@@ -3309,9 +3458,15 @@
|
| |
data["date_modified"] = "1510742566"
|
| |
|
| |
expected_output = {
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": []},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["pingou"],
|
| |
"ticket": [],
|
| |
@@ -3348,7 +3503,8 @@
|
| |
self.session = pagure.lib.query.create_session(self.dbpath)
|
| |
project = pagure.lib.query._get_project(self.session, "test")
|
| |
self.assertEquals(
|
| |
- project.access_users, {"admin": [], "commit": [], "ticket": []}
|
| |
+ project.access_users,
|
| |
+ {"admin": [], "collaborator": [], "commit": [], "ticket": []},
|
| |
)
|
| |
|
| |
def test_api_modify_acls_remove_someone_else_acl(self):
|
| |
@@ -3362,7 +3518,12 @@
|
| |
user_foo = pagure.lib.query.search_user(self.session, username="foo")
|
| |
self.assertEquals(
|
| |
project.access_users,
|
| |
- {"admin": [], "commit": [user_foo], "ticket": []},
|
| |
+ {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [user_foo],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
)
|
| |
|
| |
headers = {"Authorization": "token aaabbbcccddd"}
|
| |
@@ -3376,9 +3537,15 @@
|
| |
data["date_modified"] = "1510742566"
|
| |
|
| |
expected_output = {
|
| |
- "access_groups": {"admin": [], "commit": [], "ticket": []},
|
| |
+ "access_groups": {
|
| |
+ "admin": [],
|
| |
+ "collaborator": [],
|
| |
+ "commit": [],
|
| |
+ "ticket": [],
|
| |
+ },
|
| |
"access_users": {
|
| |
"admin": [],
|
| |
+ "collaborator": [],
|
| |
"commit": [],
|
| |
"owner": ["pingou"],
|
| |
"ticket": [],
|
| |
@@ -3415,7 +3582,8 @@
|
| |
self.session = pagure.lib.query.create_session(self.dbpath)
|
| |
project = pagure.lib.query._get_project(self.session, "test")
|
| |
self.assertEquals(
|
| |
- project.access_users, {"admin": [], "commit": [], "ticket": []}
|
| |
+ project.access_users,
|
| |
+ {"admin": [], "collaborator": [], "commit": [], "ticket": []},
|
| |
)
|
| |
|
| |
|
| |
@@ -3434,7 +3602,8 @@
|
| |
|
| |
project = pagure.lib.query._get_project(self.session, "test")
|
| |
self.assertEquals(
|
| |
- project.access_users, {"admin": [], "commit": [], "ticket": []}
|
| |
+ project.access_users,
|
| |
+ {"admin": [], "collaborator": [], "commit": [], "ticket": []},
|
| |
)
|
| |
|
| |
def test_api_get_project_options_wrong_project(self):
|
| |
The collaborators are collaborators that are only granted limited access
to the project (for example, one or a few branches in the repository).
They are also provided ticket access.
They are not granted full commit on the entire project.
Signed-off-by: Pierre-Yves Chibon pingou@pingoured.fr