-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #141 from microsoft/bugfix/set-raw-request-url
Bugfix/set raw request url
- Loading branch information
Showing
6 changed files
with
101 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
VERSION: str = "0.8.5" | ||
VERSION: str = "0.8.6" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,8 @@ pytest==7.4.2 | |
|
||
pytest-asyncio==0.21.1 | ||
|
||
pytest-mock==3.11.1 | ||
|
||
requests==2.31.0 | ||
|
||
toml==0.10.2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import pytest | ||
|
||
from kiota_abstractions.base_request_builder import BaseRequestBuilder | ||
|
||
|
||
def test_initialization(mock_request_adapter): | ||
request_builder = BaseRequestBuilder(mock_request_adapter, "{+baseurl}", None) | ||
assert request_builder.request_adapter == mock_request_adapter | ||
assert request_builder.url_template == "{+baseurl}" | ||
assert request_builder.path_parameters == {} | ||
|
||
|
||
def test_initialization_with_no_adapter_raises_exception(mock_request_adapter): | ||
with pytest.raises(TypeError) as excinfo: | ||
request_builder = BaseRequestBuilder(None, "{+baseurl}", None) | ||
assert "request_adapter cannot be null." in str(excinfo.value) | ||
|
||
|
||
def test_initialization_with_no_url_template_raises_exception(mock_request_adapter): | ||
with pytest.raises(TypeError) as excinfo: | ||
request_builder = BaseRequestBuilder(mock_request_adapter, None, None) | ||
assert "url_template cannot be null." in str(excinfo.value) | ||
|
||
|
||
def test_initialization_with_empty_url_template_valid(mock_request_adapter): | ||
request_builder = BaseRequestBuilder(mock_request_adapter, "", None) | ||
assert request_builder.request_adapter == mock_request_adapter | ||
assert request_builder.url_template == "" | ||
assert request_builder.path_parameters == {} | ||
|
||
|
||
def test_initialization_with_path_parameters(mock_request_adapter): | ||
request_builder = BaseRequestBuilder( | ||
mock_request_adapter, "{+baseurl}", {"baseurl": "https://example.com"} | ||
) | ||
assert request_builder.request_adapter == mock_request_adapter | ||
assert request_builder.url_template == "{+baseurl}" | ||
assert request_builder.path_parameters == {"baseurl": "https://example.com"} | ||
|
||
|
||
def test_initialization_with_path_parameters_as_string_sets_raw_url(mock_request_adapter): | ||
request_builder = BaseRequestBuilder(mock_request_adapter, "{+baseurl}", "https://example.com") | ||
assert request_builder.request_adapter == mock_request_adapter | ||
assert request_builder.url_template == "{+baseurl}" | ||
assert request_builder.path_parameters == {"request-raw-url": "https://example.com"} |