Skip to content

Commit

Permalink
added fake provicer
Browse files Browse the repository at this point in the history
  • Loading branch information
jstrachan committed Jul 8, 2019
1 parent ceb36e5 commit 3b3887a
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions scm/driver/fake/fake.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package fake

import (
"net/url"

"github.com/jenkins-x/go-scm/scm"
)

type fakeClient struct {
}

// NewDefault returns a new GitHub API client using the
// default api.github.com address.
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.Repositories = &repositoryService{client: client, data: data}
client.Issues = &issueService{client: client, data: data}

// TODO
/*
client.Contents = &contentService{client}
client.Git = &gitService{client}
client.Organizations = &organizationService{client}
client.PullRequests = &pullService{&issueService{client}}
client.Reviews = &reviewService{client}
client.Users = &userService{client}
client.Webhooks = &webhookService{client}
*/
return client.Client, data
}

// wraper wraps the Client to provide high level helper functions
// for making http requests and unmarshaling the response.
type wrapper struct {
*scm.Client
}

0 comments on commit 3b3887a

Please sign in to comment.