mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-11 18:15:28 +00:00
Updated mocks
This commit is contained in:
parent
afa928af0c
commit
49f03cd7e7
1 changed files with 105 additions and 23 deletions
128
plugin/remote/gitlab/testdata/testdata.go
vendored
128
plugin/remote/gitlab/testdata/testdata.go
vendored
|
@ -18,6 +18,12 @@ func NewServer() *httptest.Server {
|
||||||
case "/api/v3/projects":
|
case "/api/v3/projects":
|
||||||
w.Write(projectsPayload)
|
w.Write(projectsPayload)
|
||||||
return
|
return
|
||||||
|
case "/api/v3/projects/4":
|
||||||
|
w.Write(project4Paylod)
|
||||||
|
return
|
||||||
|
case "/api/v3/projects/6":
|
||||||
|
w.Write(project6Paylod)
|
||||||
|
return
|
||||||
case "/api/v3/session":
|
case "/api/v3/session":
|
||||||
w.Write(sessionPayload)
|
w.Write(sessionPayload)
|
||||||
return
|
return
|
||||||
|
@ -68,17 +74,7 @@ var projectsPayload = []byte(`
|
||||||
"path": "diaspora",
|
"path": "diaspora",
|
||||||
"updated_at": "2013-09-30T13: 46: 02Z"
|
"updated_at": "2013-09-30T13: 46: 02Z"
|
||||||
},
|
},
|
||||||
"archived": false,
|
"archived": false
|
||||||
"permissions": {
|
|
||||||
"project_access": {
|
|
||||||
"access_level": 10,
|
|
||||||
"notification_level": 3
|
|
||||||
},
|
|
||||||
"group_access": {
|
|
||||||
"access_level": 50,
|
|
||||||
"notification_level": 3
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 6,
|
"id": 6,
|
||||||
|
@ -90,7 +86,7 @@ var projectsPayload = []byte(`
|
||||||
"http_url_to_repo": "http://example.com/brightbox/puppet.git",
|
"http_url_to_repo": "http://example.com/brightbox/puppet.git",
|
||||||
"web_url": "http://example.com/brightbox/puppet",
|
"web_url": "http://example.com/brightbox/puppet",
|
||||||
"owner": {
|
"owner": {
|
||||||
"id": 4,
|
"id": 4,
|
||||||
"name": "Brightbox",
|
"name": "Brightbox",
|
||||||
"created_at": "2013-09-30T13:46:02Z"
|
"created_at": "2013-09-30T13:46:02Z"
|
||||||
},
|
},
|
||||||
|
@ -113,21 +109,107 @@ var projectsPayload = []byte(`
|
||||||
"path": "brightbox",
|
"path": "brightbox",
|
||||||
"updated_at": "2013-09-30T13:46:02Z"
|
"updated_at": "2013-09-30T13:46:02Z"
|
||||||
},
|
},
|
||||||
"archived": false,
|
"archived": false
|
||||||
"permissions": {
|
|
||||||
"project_access": {
|
|
||||||
"access_level": 10,
|
|
||||||
"notification_level": 3
|
|
||||||
},
|
|
||||||
"group_access": {
|
|
||||||
"access_level": 50,
|
|
||||||
"notification_level": 3
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
`)
|
`)
|
||||||
|
|
||||||
|
var project4Paylod = []byte(`
|
||||||
|
{
|
||||||
|
"id": 4,
|
||||||
|
"description": null,
|
||||||
|
"default_branch": "master",
|
||||||
|
"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",
|
||||||
|
"created_at": "2013-09-30T13: 46: 02Z"
|
||||||
|
},
|
||||||
|
"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,
|
||||||
|
"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": 3,
|
||||||
|
"name": "Diaspora",
|
||||||
|
"owner_id": 1,
|
||||||
|
"path": "diaspora",
|
||||||
|
"updated_at": "2013-09-30T13: 46: 02Z"
|
||||||
|
},
|
||||||
|
"archived": false,
|
||||||
|
"permissions": {
|
||||||
|
"project_access": {
|
||||||
|
"access_level": 10,
|
||||||
|
"notification_level": 3
|
||||||
|
},
|
||||||
|
"group_access": {
|
||||||
|
"access_level": 50,
|
||||||
|
"notification_level": 3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
|
||||||
|
var project6Paylod = []byte(`
|
||||||
|
{
|
||||||
|
"id": 6,
|
||||||
|
"description": null,
|
||||||
|
"default_branch": "master",
|
||||||
|
"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": {
|
||||||
|
"id": 4,
|
||||||
|
"name": "Brightbox",
|
||||||
|
"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": {
|
||||||
|
"project_access": {
|
||||||
|
"access_level": 10,
|
||||||
|
"notification_level": 3
|
||||||
|
},
|
||||||
|
"group_access": {
|
||||||
|
"access_level": 50,
|
||||||
|
"notification_level": 3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
|
||||||
// sample org list response
|
// sample org list response
|
||||||
var sessionPayload = []byte(`
|
var sessionPayload = []byte(`
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue