Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for region and edge values in url #62

Merged
merged 15 commits into from
Apr 21, 2021
Merged

Conversation

eshanholtz
Copy link
Contributor

@eshanholtz eshanholtz commented Apr 15, 2021

Makefile Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
twilio/twilio.go Show resolved Hide resolved
Copy link
Contributor

@thinkingserious thinkingserious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎆

@eshanholtz eshanholtz merged commit 591addb into main Apr 21, 2021
@eshanholtz eshanholtz deleted the regional branch April 21, 2021 18:06
@@ -20,7 +21,8 @@ func NewClient(accountSid string, authToken string) *twilio.Client {
c := &twilio.Client{
Credentials: creds,
HTTPClient: http.DefaultClient,
BaseURL: "twilio.com",
Edge: os.Getenv("TWILIO_EDGE"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test shouldn't be reading these values unless it's also clearing them before each test. Otherwise tests may fail (or pass in error) when set in the testing environment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I add os.Setenv("TWILIO_EDGE", ""), os.Setenv("TWILIO_REGION", "") at the end of each the region/edge tests, that should work

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sort of, but this is partially testing the logic that the test client can read from the env vars (not the actual client). I say avoid it if possible. Unless, for instance, you're testing that the actual client can read from the env vars.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. I was trying to test precedence, but I see that's already handled when setting c.Region or c.Edge, which is equivalent to setting those fields during instantiation of the client. I'll rip out the extraneous tests and submit a new PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#66

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants