2018-02-19 22:24:10 +00:00
|
|
|
// Copyright 2018 Drone.IO Inc.
|
2019-09-14 12:21:16 +00:00
|
|
|
//
|
2018-02-19 22:24:10 +00:00
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
2019-09-14 12:21:16 +00:00
|
|
|
//
|
2018-02-19 22:24:10 +00:00
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
2019-09-14 12:21:16 +00:00
|
|
|
//
|
2018-02-19 22:24:10 +00:00
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2015-08-22 19:06:56 +00:00
|
|
|
package testdata
|
|
|
|
|
|
|
|
// sample repository list
|
2016-02-16 11:35:20 +00:00
|
|
|
var allProjectsPayload = []byte(`
|
2015-08-22 19:06:56 +00:00
|
|
|
[
|
|
|
|
{
|
|
|
|
"id": 4,
|
|
|
|
"description": null,
|
2023-07-31 03:47:23 +00:00
|
|
|
"default_branch": "main",
|
2015-08-22 19:06:56 +00:00
|
|
|
"public": false,
|
|
|
|
"visibility_level": 0,
|
|
|
|
"ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git",
|
|
|
|
"http_url_to_repo": "http://example.com/diaspora/diaspora-client.git",
|
|
|
|
"web_url": "http://example.com/diaspora/diaspora-client",
|
|
|
|
"owner": {
|
|
|
|
"id": 3,
|
|
|
|
"name": "Diaspora",
|
2016-01-07 14:35:53 +00:00
|
|
|
"username": "some_user",
|
2021-10-03 12:42:47 +00:00
|
|
|
"created_at": "2013-09-30T13:46:02Z"
|
2015-08-22 19:06:56 +00:00
|
|
|
},
|
|
|
|
"name": "Diaspora Client",
|
|
|
|
"name_with_namespace": "Diaspora / Diaspora Client",
|
|
|
|
"path": "diaspora-client",
|
|
|
|
"path_with_namespace": "diaspora/diaspora-client",
|
|
|
|
"issues_enabled": true,
|
|
|
|
"merge_requests_enabled": true,
|
|
|
|
"wiki_enabled": true,
|
|
|
|
"snippets_enabled": false,
|
2021-10-03 12:42:47 +00:00
|
|
|
"created_at": "2013-09-30T13:46:02Z",
|
|
|
|
"last_activity_at": "2013-09-30T13:46:02Z",
|
2015-08-22 19:06:56 +00:00
|
|
|
"namespace": {
|
2021-10-03 12:42:47 +00:00
|
|
|
"created_at": "2013-09-30T13:46:02Z",
|
2015-08-22 19:06:56 +00:00
|
|
|
"description": "",
|
|
|
|
"id": 3,
|
|
|
|
"name": "Diaspora",
|
|
|
|
"owner_id": 1,
|
|
|
|
"path": "diaspora",
|
2021-10-03 12:42:47 +00:00
|
|
|
"updated_at": "2013-09-30T13:46:02Z"
|
2015-08-22 19:06:56 +00:00
|
|
|
},
|
2023-03-21 22:01:59 +00:00
|
|
|
"archived": false,
|
|
|
|
"permissions": {
|
|
|
|
"project_access": {
|
|
|
|
"access_level": 10,
|
|
|
|
"notification_level": 3
|
|
|
|
},
|
|
|
|
"group_access": {
|
|
|
|
"access_level": 50,
|
|
|
|
"notification_level": 3
|
|
|
|
}
|
|
|
|
}
|
2015-08-22 19:06:56 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": 6,
|
|
|
|
"description": null,
|
2023-07-31 03:47:23 +00:00
|
|
|
"default_branch": "main",
|
2015-08-22 19:06:56 +00:00
|
|
|
"public": false,
|
|
|
|
"visibility_level": 0,
|
|
|
|
"ssh_url_to_repo": "git@example.com:brightbox/puppet.git",
|
|
|
|
"http_url_to_repo": "http://example.com/brightbox/puppet.git",
|
|
|
|
"web_url": "http://example.com/brightbox/puppet",
|
|
|
|
"owner": {
|
2016-01-07 14:35:53 +00:00
|
|
|
"id": 1,
|
2015-08-22 19:06:56 +00:00
|
|
|
"name": "Brightbox",
|
2016-01-07 14:35:53 +00:00
|
|
|
"username": "test_user",
|
2015-08-22 19:06:56 +00:00
|
|
|
"created_at": "2013-09-30T13:46:02Z"
|
|
|
|
},
|
|
|
|
"name": "Puppet",
|
|
|
|
"name_with_namespace": "Brightbox / Puppet",
|
|
|
|
"path": "puppet",
|
|
|
|
"path_with_namespace": "brightbox/puppet",
|
|
|
|
"issues_enabled": true,
|
|
|
|
"merge_requests_enabled": true,
|
|
|
|
"wiki_enabled": true,
|
|
|
|
"snippets_enabled": false,
|
|
|
|
"created_at": "2013-09-30T13:46:02Z",
|
|
|
|
"last_activity_at": "2013-09-30T13:46:02Z",
|
|
|
|
"namespace": {
|
|
|
|
"created_at": "2013-09-30T13:46:02Z",
|
|
|
|
"description": "",
|
|
|
|
"id": 4,
|
|
|
|
"name": "Brightbox",
|
|
|
|
"owner_id": 1,
|
|
|
|
"path": "brightbox",
|
|
|
|
"updated_at": "2013-09-30T13:46:02Z"
|
|
|
|
},
|
2023-03-21 22:01:59 +00:00
|
|
|
"archived": true,
|
|
|
|
"permissions": {
|
|
|
|
"project_access": {
|
|
|
|
"access_level": 10,
|
|
|
|
"notification_level": 3
|
|
|
|
},
|
|
|
|
"group_access": {
|
|
|
|
"access_level": 50,
|
|
|
|
"notification_level": 3
|
|
|
|
}
|
|
|
|
}
|
2016-02-16 11:35:20 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
`)
|
|
|
|
|
|
|
|
var notArchivedProjectsPayload = []byte(`
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"id": 4,
|
|
|
|
"description": null,
|
2023-07-31 03:47:23 +00:00
|
|
|
"default_branch": "main",
|
2016-02-16 11:35:20 +00:00
|
|
|
"public": false,
|
|
|
|
"visibility_level": 0,
|
|
|
|
"ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git",
|
|
|
|
"http_url_to_repo": "http://example.com/diaspora/diaspora-client.git",
|
|
|
|
"web_url": "http://example.com/diaspora/diaspora-client",
|
|
|
|
"owner": {
|
|
|
|
"id": 3,
|
|
|
|
"name": "Diaspora",
|
|
|
|
"username": "some_user",
|
2021-10-03 12:42:47 +00:00
|
|
|
"created_at": "2013-09-30T13:46:02Z"
|
2016-02-16 11:35:20 +00:00
|
|
|
},
|
|
|
|
"name": "Diaspora Client",
|
|
|
|
"name_with_namespace": "Diaspora / Diaspora Client",
|
|
|
|
"path": "diaspora-client",
|
|
|
|
"path_with_namespace": "diaspora/diaspora-client",
|
|
|
|
"issues_enabled": true,
|
|
|
|
"merge_requests_enabled": true,
|
|
|
|
"wiki_enabled": true,
|
|
|
|
"snippets_enabled": false,
|
2021-10-03 12:42:47 +00:00
|
|
|
"created_at": "2013-09-30T13:46:02Z",
|
|
|
|
"last_activity_at": "2013-09-30T13:46:02Z",
|
2016-02-16 11:35:20 +00:00
|
|
|
"namespace": {
|
2021-10-03 12:42:47 +00:00
|
|
|
"created_at": "2013-09-30T13:46:02Z",
|
2016-02-16 11:35:20 +00:00
|
|
|
"description": "",
|
|
|
|
"id": 3,
|
|
|
|
"name": "Diaspora",
|
|
|
|
"owner_id": 1,
|
|
|
|
"path": "diaspora",
|
2021-10-03 12:42:47 +00:00
|
|
|
"updated_at": "2013-09-30T13:46:02Z"
|
2016-02-16 11:35:20 +00:00
|
|
|
},
|
2023-03-21 22:01:59 +00:00
|
|
|
"archived": false,
|
|
|
|
"permissions": {
|
|
|
|
"project_access": {
|
|
|
|
"access_level": 10,
|
|
|
|
"notification_level": 3
|
|
|
|
},
|
|
|
|
"group_access": {
|
|
|
|
"access_level": 50,
|
|
|
|
"notification_level": 3
|
|
|
|
}
|
|
|
|
}
|
2015-08-22 19:06:56 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
`)
|
|
|
|
|
2022-11-09 07:12:17 +00:00
|
|
|
var project4Payload = []byte(`
|
2015-08-22 19:06:56 +00:00
|
|
|
{
|
|
|
|
"id": 4,
|
|
|
|
"description": null,
|
2023-07-31 03:47:23 +00:00
|
|
|
"default_branch": "main",
|
2015-08-22 19:06:56 +00:00
|
|
|
"public": false,
|
|
|
|
"visibility_level": 0,
|
|
|
|
"ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git",
|
|
|
|
"http_url_to_repo": "http://example.com/diaspora/diaspora-client.git",
|
|
|
|
"web_url": "http://example.com/diaspora/diaspora-client",
|
|
|
|
"owner": {
|
|
|
|
"id": 3,
|
|
|
|
"name": "Diaspora",
|
2016-01-07 14:35:53 +00:00
|
|
|
"username": "some_user",
|
2021-10-03 12:42:47 +00:00
|
|
|
"created_at": "2013-09-30T13:46:02Z"
|
2015-08-22 19:06:56 +00:00
|
|
|
},
|
|
|
|
"name": "Diaspora Client",
|
|
|
|
"name_with_namespace": "Diaspora / Diaspora Client",
|
|
|
|
"path": "diaspora-client",
|
|
|
|
"path_with_namespace": "diaspora/diaspora-client",
|
|
|
|
"issues_enabled": true,
|
|
|
|
"merge_requests_enabled": true,
|
|
|
|
"wiki_enabled": true,
|
|
|
|
"snippets_enabled": false,
|
2021-10-03 12:42:47 +00:00
|
|
|
"created_at": "2013-09-30T13:46:02Z",
|
|
|
|
"last_activity_at": "2013-09-30T13:46:02Z",
|
2015-08-22 19:06:56 +00:00
|
|
|
"namespace": {
|
2021-10-03 12:42:47 +00:00
|
|
|
"created_at": "2013-09-30T13:46:02Z",
|
2015-08-22 19:06:56 +00:00
|
|
|
"description": "",
|
|
|
|
"id": 3,
|
|
|
|
"name": "Diaspora",
|
|
|
|
"owner_id": 1,
|
|
|
|
"path": "diaspora",
|
2021-10-03 12:42:47 +00:00
|
|
|
"updated_at": "2013-09-30T13:46:02Z"
|
2015-08-22 19:06:56 +00:00
|
|
|
},
|
|
|
|
"archived": false,
|
|
|
|
"permissions": {
|
|
|
|
"project_access": {
|
|
|
|
"access_level": 10,
|
|
|
|
"notification_level": 3
|
|
|
|
},
|
|
|
|
"group_access": {
|
|
|
|
"access_level": 50,
|
|
|
|
"notification_level": 3
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
|
2022-11-09 07:12:17 +00:00
|
|
|
var project6Payload = []byte(`
|
2015-08-22 19:06:56 +00:00
|
|
|
{
|
|
|
|
"id": 6,
|
|
|
|
"description": null,
|
2023-07-31 03:47:23 +00:00
|
|
|
"default_branch": "main",
|
2015-08-22 19:06:56 +00:00
|
|
|
"public": false,
|
|
|
|
"visibility_level": 0,
|
|
|
|
"ssh_url_to_repo": "git@example.com:brightbox/puppet.git",
|
|
|
|
"http_url_to_repo": "http://example.com/brightbox/puppet.git",
|
|
|
|
"web_url": "http://example.com/brightbox/puppet",
|
|
|
|
"owner": {
|
2016-01-07 14:35:53 +00:00
|
|
|
"id": 1,
|
2015-08-22 19:06:56 +00:00
|
|
|
"name": "Brightbox",
|
2016-01-07 14:35:53 +00:00
|
|
|
"username": "test_user",
|
2015-08-22 19:06:56 +00:00
|
|
|
"created_at": "2013-09-30T13:46:02Z"
|
|
|
|
},
|
|
|
|
"name": "Puppet",
|
|
|
|
"name_with_namespace": "Brightbox / Puppet",
|
|
|
|
"path": "puppet",
|
|
|
|
"path_with_namespace": "brightbox/puppet",
|
|
|
|
"issues_enabled": true,
|
|
|
|
"merge_requests_enabled": true,
|
|
|
|
"wiki_enabled": true,
|
|
|
|
"snippets_enabled": false,
|
|
|
|
"created_at": "2013-09-30T13:46:02Z",
|
|
|
|
"last_activity_at": "2013-09-30T13:46:02Z",
|
|
|
|
"namespace": {
|
|
|
|
"created_at": "2013-09-30T13:46:02Z",
|
|
|
|
"description": "",
|
|
|
|
"id": 4,
|
|
|
|
"name": "Brightbox",
|
|
|
|
"owner_id": 1,
|
|
|
|
"path": "brightbox",
|
|
|
|
"updated_at": "2013-09-30T13:46:02Z"
|
|
|
|
},
|
|
|
|
"archived": false,
|
|
|
|
"permissions": {
|
2016-01-07 14:35:53 +00:00
|
|
|
"project_access": null,
|
|
|
|
"group_access": null
|
2015-08-22 19:06:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
`)
|
2021-12-19 00:12:09 +00:00
|
|
|
|
|
|
|
var project4PayloadHook = []byte(`
|
|
|
|
{
|
|
|
|
"id": 10717088,
|
|
|
|
"url": "http://example.com/api/hook",
|
|
|
|
"created_at": "2021-12-18T23:29:33.852Z",
|
|
|
|
"push_events": true,
|
|
|
|
"tag_push_events": true,
|
|
|
|
"merge_requests_events": true,
|
|
|
|
"repository_update_events": false,
|
|
|
|
"enable_ssl_verification": true,
|
|
|
|
"project_id": 4,
|
|
|
|
"issues_events": false,
|
|
|
|
"confidential_issues_events": false,
|
|
|
|
"note_events": false,
|
|
|
|
"confidential_note_events": null,
|
|
|
|
"pipeline_events": false,
|
|
|
|
"wiki_page_events": false,
|
|
|
|
"deployment_events": true,
|
|
|
|
"job_events": false,
|
|
|
|
"releases_events": false,
|
|
|
|
"push_events_branch_filter": null
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
|
|
|
|
var project4PayloadHooks = []byte(`
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"id": 10717088,
|
|
|
|
"url": "http://example.com/api/hook",
|
|
|
|
"created_at": "2021-12-18T23:29:33.852Z",
|
|
|
|
"push_events": true,
|
|
|
|
"tag_push_events": true,
|
|
|
|
"merge_requests_events": true,
|
|
|
|
"repository_update_events": false,
|
|
|
|
"enable_ssl_verification": true,
|
|
|
|
"project_id": 4,
|
|
|
|
"issues_events": false,
|
|
|
|
"confidential_issues_events": false,
|
|
|
|
"note_events": false,
|
|
|
|
"confidential_note_events": null,
|
|
|
|
"pipeline_events": false,
|
|
|
|
"wiki_page_events": false,
|
|
|
|
"deployment_events": true,
|
|
|
|
"job_events": false,
|
|
|
|
"releases_events": false,
|
|
|
|
"push_events_branch_filter": null
|
|
|
|
}
|
|
|
|
]
|
|
|
|
`)
|