Skip to content

Commit

Permalink
Fix an issue where base_url was being set incorrectly. Added regressi…
Browse files Browse the repository at this point in the history
…on test (#391)
  • Loading branch information
Thetwam authored Jul 6, 2020
1 parent 42606eb commit 03b6771
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion canvasapi/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self, base_url, access_token):
# Ensure that the user-supplied access token and base_url contain no leading or
# trailing spaces that might cause issues when communicating with the API.
access_token = access_token.strip()
base_url = base_url.strip()
base_url = new_url.strip()

self.__requester = Requester(base_url, access_token)

Expand Down
5 changes: 4 additions & 1 deletion tests/test_canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ def setUp(self):
# Canvas()
def test_init_deprecate_url_contains_version(self, m):
with warnings.catch_warnings(record=True) as w:
Canvas(settings.BASE_URL_WITH_VERSION, settings.API_KEY)
client = Canvas(settings.BASE_URL_WITH_VERSION, settings.API_KEY)
self.assertEqual(
client._Canvas__requester.base_url, "https://example.com/api/v1/"
)
self.assertTrue(issubclass(w[0].category, DeprecationWarning))

def test_init_warns_when_url_is_http(self, m):
Expand Down

0 comments on commit 03b6771

Please sign in to comment.