-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Kharude, Sachin <sachin.kharude@here.com>
- Loading branch information
Showing
24 changed files
with
119 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
credentials: { | ||
XYZ_TOKEN: "MY-XYZ-TOKEN" | ||
} | ||
http_headers: { | ||
Authorization: "Bearer MY-XYZ-TOKEN" | ||
Content-Type: "application/geo+json" | ||
} | ||
url: "https://xyz.api.here.com" |
This file was deleted.
Oops, something went wrong.
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
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
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
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,8 @@ | ||
xyzspaces.config.default module | ||
=============================== | ||
|
||
.. automodule:: xyzspaces.config.default | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
:private-members: |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -13,4 +13,4 @@ Submodules | |
.. toctree:: | ||
:maxdepth: 4 | ||
|
||
xyzspaces.config.default_config | ||
xyzspaces.config.default |
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 |
---|---|---|
|
@@ -6,3 +6,4 @@ geopandas | |
turfpy>=0.0.3 | ||
geobuf | ||
ijson==3.1.1 | ||
pyhocon |
Empty file.
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,75 @@ | ||
"""This module tests custom configurations for xyzspaces.""" | ||
|
||
import os | ||
from pathlib import Path | ||
|
||
from xyzspaces.config.default import DEFAULT_CONFIG, XYZConfig | ||
|
||
|
||
def test_default_config(): | ||
"""Test default config.""" | ||
xyzconfig = XYZConfig.from_default() | ||
assert xyzconfig.config["credentials"]["XYZ_TOKEN"] == os.environ.get( | ||
"XYZ_TOKEN" | ||
) | ||
assert xyzconfig.config["credentials"]["HERE_USER"] == os.environ.get( | ||
"HERE_USER" | ||
) | ||
assert xyzconfig.config["credentials"]["HERE_PASSWORD"] == os.environ.get( | ||
"HERE_PASSWORD" | ||
) | ||
assert xyzconfig.config["url"] == "https://xyz.api.here.com" | ||
assert ( | ||
xyzconfig.config["http_headers"]["Authorization"] | ||
== f"Bearer {os.environ.get('XYZ_TOKEN')}" | ||
) | ||
assert ( | ||
xyzconfig.config["http_headers"]["Content-Type"] | ||
== "application/geo+json" | ||
) | ||
|
||
|
||
def test_config_object(): | ||
"""Test configurations using config object.""" | ||
xyzconfig = XYZConfig(**DEFAULT_CONFIG) | ||
assert xyzconfig.config["credentials"]["XYZ_TOKEN"] == os.environ.get( | ||
"XYZ_TOKEN" | ||
) | ||
assert xyzconfig.config["credentials"]["HERE_USER"] == os.environ.get( | ||
"HERE_USER" | ||
) | ||
assert xyzconfig.config["credentials"]["HERE_PASSWORD"] == os.environ.get( | ||
"HERE_PASSWORD" | ||
) | ||
assert xyzconfig.config["url"] == "https://xyz.api.here.com" | ||
assert ( | ||
xyzconfig.config["http_headers"]["Authorization"] | ||
== f"Bearer {os.environ.get('XYZ_TOKEN')}" | ||
) | ||
assert ( | ||
xyzconfig.config["http_headers"]["Content-Type"] | ||
== "application/geo+json" | ||
) | ||
|
||
|
||
def test_config_from_file(): | ||
"""Test configurations using file.""" | ||
root = Path(__file__).parent.parent.parent | ||
file_path = ( | ||
root | ||
/ Path("docs") | ||
/ Path("notebooks") | ||
/ Path("data") | ||
/ "xyz_configuration.conf" | ||
) | ||
xyzconfig = XYZConfig.from_file(file_path) | ||
assert xyzconfig.config["credentials"]["XYZ_TOKEN"] == "MY-XYZ-TOKEN" | ||
assert xyzconfig.config["url"] == "https://xyz.api.here.com" | ||
assert ( | ||
xyzconfig.config["http_headers"]["Authorization"] | ||
== "Bearer MY-XYZ-TOKEN" | ||
) | ||
assert ( | ||
xyzconfig.config["http_headers"]["Content-Type"] | ||
== "application/geo+json" | ||
) |
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
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
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
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
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