Skip to content

Commit 48ddc3f

Browse files
authored
Merge pull request #74 from deathiop/73-endpoint
feat: expose endpoint on client
2 parents 1cf8fb5 + 19db4e3 commit 48ddc3f

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

ovh/ovh.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ func NewDefaultClient() (*Client, error) {
114114
return NewClient("", "", "", "")
115115
}
116116

117+
func (c *Client) Endpoint() string {
118+
return c.endpoint
119+
}
120+
117121
//
118122
// High level helpers
119123
//

ovh/ovh_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,22 @@ func sbody(s string) io.ReadCloser {
3838
// Tests
3939
//
4040

41+
func TestClientEndpoint(t *testing.T) {
42+
require := td.Require(t)
43+
44+
client, err := NewClient("ovh-eu", MockApplicationKey, MockApplicationSecret, MockConsumerKey)
45+
require.CmpNoError(err)
46+
td.Cmp(t, client.Endpoint(), OvhEU)
47+
48+
client, err = NewClient("ovh-ca", MockApplicationKey, MockApplicationSecret, MockConsumerKey)
49+
require.CmpNoError(err)
50+
td.Cmp(t, client.Endpoint(), OvhCA)
51+
52+
client, err = NewClient("https://example.org", MockApplicationKey, MockApplicationSecret, MockConsumerKey)
53+
require.CmpNoError(err)
54+
td.Cmp(t, client.Endpoint(), "https://example.org")
55+
}
56+
4157
type MockSuite struct {
4258
client *Client
4359
}

0 commit comments

Comments
 (0)