forked from drone/go-scm
-
Notifications
You must be signed in to change notification settings - Fork 83
/
fake.go
40 lines (34 loc) · 1.04 KB
/
fake.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package fake
import (
"net/url"
"github.com/jenkins-x/go-scm/scm"
)
// NewDefault returns a new fake client.
// The Data object lets you pre-load resources into the fake driver or check for results after the
// scm operations have been performed
func NewDefault() (*scm.Client, *Data) {
data := NewData()
client := &wrapper{new(scm.Client)}
client.BaseURL = &url.URL{
Host: "fake.com",
Path: "/",
}
// initialize services
client.Driver = scm.DriverFake
client.Git = &gitService{client: client, data: data}
client.Issues = &issueService{client: client, data: data}
client.Organizations = &organizationService{client: client, data: data}
client.PullRequests = &pullService{client: client, data: data}
client.Repositories = &repositoryService{client: client, data: data}
client.Reviews = &reviewService{client: client, data: data}
// TODO
/*
client.Contents = &contentService{client}
client.Users = &userService{client}
client.Webhooks = &webhookService{client}
*/
return client.Client, data
}
type wrapper struct {
*scm.Client
}