-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds unit test for catching SDKs not installed
Adding test to make coverage not complain, and to also validate that if the environment variables are present that things wont break if the right SDK is not installed.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 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,33 @@ | ||
import os | ||
import unittest | ||
from unittest.mock import patch | ||
|
||
from naturf import driver | ||
|
||
|
||
class TestDriverGuardAgainstSDK(unittest.TestCase): | ||
INPUTS = { | ||
"input_shapefile": os.path.join("naturf", "data", "C-5.shp"), | ||
"radius": 100, | ||
"cap_style": 1, | ||
} | ||
|
||
# mock the driver module variables | ||
@patch("naturf.driver.HAMILTON_UI_PROJECT_ID", "3") | ||
@patch("naturf.driver.HAMILTON_UI_USERNAME", "test@test") | ||
def tests_sdk_not_installed(self): | ||
"""tests that things work if the sdk is not installed""" | ||
# this line running without error means that our checks worked | ||
driver.Model(inputs=TestDriverGuardAgainstSDK.INPUTS, outputs=["input_shapefile_df"]) | ||
|
||
@patch("naturf.driver.HAMILTON_UI_PROJECT_ID", "3") | ||
@patch("naturf.driver.HAMILTON_UI_USERNAME", "test@test") | ||
@patch("naturf.driver.DAGWORKS_API_KEY", "some-api-key") | ||
def tests_sdk_not_installed_DW(self): | ||
"""tests that things work if the sdk is not installed for the DW path""" | ||
# this line running without error means that our checks worked | ||
driver.Model(inputs=TestDriverGuardAgainstSDK.INPUTS, outputs=["input_shapefile_df"]) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |