Skip to content

Commit

Permalink
Merge pull request #74 from deathiop/73-endpoint
Browse files Browse the repository at this point in the history
feat: expose endpoint on client
  • Loading branch information
deathiop authored Oct 9, 2023
2 parents 1cf8fb5 + 19db4e3 commit 48ddc3f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ovh/ovh.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ func NewDefaultClient() (*Client, error) {
return NewClient("", "", "", "")
}

func (c *Client) Endpoint() string {
return c.endpoint
}

//
// High level helpers
//
Expand Down
16 changes: 16 additions & 0 deletions ovh/ovh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,22 @@ func sbody(s string) io.ReadCloser {
// Tests
//

func TestClientEndpoint(t *testing.T) {
require := td.Require(t)

client, err := NewClient("ovh-eu", MockApplicationKey, MockApplicationSecret, MockConsumerKey)
require.CmpNoError(err)
td.Cmp(t, client.Endpoint(), OvhEU)

client, err = NewClient("ovh-ca", MockApplicationKey, MockApplicationSecret, MockConsumerKey)
require.CmpNoError(err)
td.Cmp(t, client.Endpoint(), OvhCA)

client, err = NewClient("https://example.org", MockApplicationKey, MockApplicationSecret, MockConsumerKey)
require.CmpNoError(err)
td.Cmp(t, client.Endpoint(), "https://example.org")
}

type MockSuite struct {
client *Client
}
Expand Down

0 comments on commit 48ddc3f

Please sign in to comment.