diff --git a/pagure/api/project.py b/pagure/api/project.py index 29b19dd..d866029 100644 --- a/pagure/api/project.py +++ b/pagure/api/project.py @@ -117,6 +117,7 @@ def api_projects(): "description": "A web-based calendar for Fedora", "id": 7, "name": "fedocal", + "fullname": "fedocal", "parent": null, "user": { "fullname": "Pierre-Yves C", @@ -128,11 +129,13 @@ def api_projects(): "description": "An awesome messaging servicefor everyone", "id": 12, "name": "fedmsg", + "fullname": "forks/pingou/fedmsg", "parent": { "date_created": "1433423298", "description": "An awesome messaging servicefor everyone", "id": 11, "name": "fedmsg", + "fullname": "fedmsg", "parent": null, "user": { "fullname": "Ralph B", diff --git a/pagure/lib/model.py b/pagure/lib/model.py index 6657d56..5ac9c59 100644 --- a/pagure/lib/model.py +++ b/pagure/lib/model.py @@ -679,6 +679,7 @@ class Project(BASE): output = { 'id': self.id, 'name': self.name, + 'fullname': self.fullname, 'description': self.description, 'namespace': self.namespace, 'parent': self.parent.to_json( diff --git a/tests/test_pagure_flask_api_fork.py b/tests/test_pagure_flask_api_fork.py index ed6cee4..39a33d5 100644 --- a/tests/test_pagure_flask_api_fork.py +++ b/tests/test_pagure_flask_api_fork.py @@ -129,6 +129,7 @@ class PagureFlaskApiForktests(tests.Modeltests): "id": 1, "milestones": {}, "name": "test", + "fullname": "test", "namespace": None, "parent": None, "priorities": {}, @@ -152,6 +153,7 @@ class PagureFlaskApiForktests(tests.Modeltests): "id": 1, "milestones": {}, "name": "test", + "fullname": "test", "namespace": None, "parent": None, "priorities": {}, @@ -275,6 +277,7 @@ class PagureFlaskApiForktests(tests.Modeltests): "id": 1, "milestones": {}, "name": "test", + "fullname": "test", "namespace": None, "parent": None, "priorities": {}, @@ -298,6 +301,7 @@ class PagureFlaskApiForktests(tests.Modeltests): "id": 1, "milestones": {}, "name": "test", + "fullname": "test", "namespace": None, "parent": None, "priorities": {}, diff --git a/tests/test_pagure_flask_api_project.py b/tests/test_pagure_flask_api_project.py index f59ea08..f80a0ee 100644 --- a/tests/test_pagure_flask_api_project.py +++ b/tests/test_pagure_flask_api_project.py @@ -167,6 +167,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): "id": 1, "milestones": {}, "name": "test", + "fullname": "test", "namespace": None, "parent": None, "priorities": {}, @@ -209,6 +210,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): "id": 1, "milestones": {}, "name": "test", + "fullname": "test", "namespace": None, "parent": None, "priorities": {}, @@ -231,6 +233,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): "id": 2, "milestones": {}, "name": "test2", + "fullname": "test2", "namespace": None, "parent": None, "priorities": {}, @@ -253,6 +256,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): "id": 3, "milestones": {}, "name": "test3", + "fullname": "somenamespace/test3", "namespace": "somenamespace", "parent": None, "priorities": {}, @@ -295,6 +299,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): "id": 1, "milestones": {}, "name": "test", + "fullname": "test", "namespace": None, "parent": None, "priorities": {}, @@ -358,6 +363,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): "id": 1, "milestones": {}, "name": "test", + "fullname": "test", "namespace": None, "parent": None, "priorities": {}, diff --git a/tests/test_pagure_flask_api_user.py b/tests/test_pagure_flask_api_user.py index 5245700..157f358 100644 --- a/tests/test_pagure_flask_api_user.py +++ b/tests/test_pagure_flask_api_user.py @@ -88,98 +88,124 @@ class PagureFlaskApiUSertests(tests.Modeltests): output = self.app.get('/api/0/user/pingou') self.assertEqual(output.status_code, 200) data = json.loads(output.data) + data['repos'][0]['date_created'] = "1490272832" + data['repos'][1]['date_created'] = "1490272832" + data['repos'][2]['date_created'] = "1490272832" exp = { "forks": [], - "repos": [{ - "custom_keys": [], - "description": "test project #1", - "parent": None, - "settings": { - "issues_default_to_private": False, + "repos": [ + { + "close_status": [ + "Invalid", + "Insufficient data", + "Fixed", + "Duplicate" + ], + "custom_keys": [], + "date_created": "1490272832", + "description": "test project #1", + "fullname": "test", + "id": 1, + "milestones": {}, + "name": "test", + "namespace": None, + "parent": None, + "priorities": {}, + "settings": { + "Enforce_signed-off_commits_in_pull-request": False, "Minimum_score_to_merge_pull-request": -1, + "Only_assignee_can_merge_pull-request": False, "Web-hooks": None, - "fedmsg_notifications": True, "always_merge": False, + "fedmsg_notifications": True, + "issue_tracker": True, + "issues_default_to_private": False, "project_documentation": False, - "Enforce_signed-off_commits_in_pull-request": False, - "pull_requests": True, - "Only_assignee_can_merge_pull-request": False, - "issue_tracker": True - }, - "tags": [], - "namespace": None, - "priorities": {}, - "close_status": ["Invalid", "Insufficient data", "Fixed", "Duplicate"], - "milestones": {}, - "user": { + "pull_requests": True + }, + "tags": [], + "user": { "fullname": "PY C", "name": "pingou" + } }, - "date_created": data['repos'][0]['date_created'], - "id": 1, - "name": "test"}, { - "custom_keys": [], - "description": "test project #2", - "parent": None, - "settings": { - "issues_default_to_private": False, + "close_status": [ + "Invalid", + "Insufficient data", + "Fixed", + "Duplicate" + ], + "custom_keys": [], + "date_created": "1490272832", + "description": "test project #2", + "fullname": "test2", + "id": 2, + "milestones": {}, + "name": "test2", + "namespace": None, + "parent": None, + "priorities": {}, + "settings": { + "Enforce_signed-off_commits_in_pull-request": False, "Minimum_score_to_merge_pull-request": -1, + "Only_assignee_can_merge_pull-request": False, "Web-hooks": None, - "fedmsg_notifications": True, "always_merge": False, + "fedmsg_notifications": True, + "issue_tracker": True, + "issues_default_to_private": False, "project_documentation": False, - "Enforce_signed-off_commits_in_pull-request": False, - "pull_requests": True, - "Only_assignee_can_merge_pull-request": False, - "issue_tracker": True - }, - "tags": [], - "namespace": None, - "priorities": {}, - "close_status": ["Invalid", "Insufficient data", "Fixed", "Duplicate"], - "milestones": {}, - "user": { - "fullname": "PY C", - "name": "pingou" + "pull_requests": True + }, + "tags": [], + "user": { + "fullname": "PY C", + "name": "pingou" + } }, - "date_created": data['repos'][1]['date_created'], - "id": 2, - "name": "test2"}, { - "custom_keys": [], - "description": "namespaced test project", - "parent": None, - "settings": { - "issues_default_to_private": False, + "close_status": [ + "Invalid", + "Insufficient data", + "Fixed", + "Duplicate" + ], + "custom_keys": [], + "date_created": "1490272832", + "description": "namespaced test project", + "fullname": "somenamespace/test3", + "id": 3, + "milestones": {}, + "name": "test3", + "namespace": "somenamespace", + "parent": None, + "priorities": {}, + "settings": { + "Enforce_signed-off_commits_in_pull-request": False, "Minimum_score_to_merge_pull-request": -1, + "Only_assignee_can_merge_pull-request": False, "Web-hooks": None, - "fedmsg_notifications": True, "always_merge": False, + "fedmsg_notifications": True, + "issue_tracker": True, + "issues_default_to_private": False, "project_documentation": False, - "Enforce_signed-off_commits_in_pull-request": False, - "pull_requests": True, - "Only_assignee_can_merge_pull-request": False, - "issue_tracker": True - }, - "tags": [], - "namespace": "somenamespace", - "priorities": {}, - "close_status": ["Invalid", "Insufficient data", "Fixed", "Duplicate"], - "milestones": {}, - "user": { + "pull_requests": True + }, + "tags": [], + "user": { "fullname": "PY C", "name": "pingou" - }, - "date_created": data['repos'][2]['date_created'], - "id": 3, - "name": "test3"}, + } + } ], "user": { "fullname": "PY C", "name": "pingou" } } + self.assertEqual(data, exp) @patch('pagure.lib.notify.send_email') diff --git a/tests/test_pagure_lib_git.py b/tests/test_pagure_lib_git.py index 8f6d297..0c8f99f 100644 --- a/tests/test_pagure_lib_git.py +++ b/tests/test_pagure_lib_git.py @@ -1403,7 +1403,7 @@ new file mode 100644 index 0000000..60f7480 --- /dev/null +++ b/456 -@@ -0,0 +1,96 @@ +@@ -0,0 +1,98 @@ +{ + "assignee": null, + "branch": "master", @@ -1422,6 +1422,7 @@ index 0000000..60f7480 + "custom_keys": [], + "date_created": null, + "description": "test project for ticket", ++ "fullname": "test_ticket_repo", + "id": 1, + "milestones": {}, + "name": "test_ticket_repo", @@ -1457,6 +1458,7 @@ index 0000000..60f7480 + "custom_keys": [], + "date_created": null, + "description": "test project for ticket", ++ "fullname": "test_ticket_repo", + "id": 1, + "milestones": {}, + "name": "test_ticket_repo",