-
Notifications
You must be signed in to change notification settings - Fork 603
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 #444 from tableau/dev
Auth bugs fixes
- Loading branch information
Showing
7 changed files
with
98 additions
and
8 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 @@ | ||
2.1.0 | ||
2.2.0 |
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
57 changes: 57 additions & 0 deletions
57
tests/integration/resources/deploy_and_evaluate_model_auth.conf
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,57 @@ | ||
[TabPy] | ||
# TABPY_QUERY_OBJECT_PATH = /tmp/query_objects | ||
TABPY_PORT = 9009 | ||
# TABPY_STATE_PATH = ./tabpy/tabpy_server | ||
|
||
# Where static pages live | ||
# TABPY_STATIC_PATH = ./tabpy/tabpy_server/static | ||
|
||
# For how to configure TabPy authentication read | ||
# Authentication section in docs/server-config.md. | ||
TABPY_PWD_FILE = ./tests/integration/resources/pwdfile.txt | ||
|
||
# To set up secure TabPy uncomment and modify the following lines. | ||
# Note only PEM-encoded x509 certificates are supported. | ||
# TABPY_TRANSFER_PROTOCOL = https | ||
# TABPY_CERTIFICATE_FILE = path/to/certificate/file.crt | ||
# TABPY_KEY_FILE = path/to/key/file.key | ||
|
||
# Log additional request details including caller IP, full URL, client | ||
# end user info if provided. | ||
# TABPY_LOG_DETAILS = true | ||
|
||
# Configure how long a custom script provided to the /evaluate method | ||
# will run before throwing a TimeoutError. | ||
# The value should be a float representing the timeout time in seconds. | ||
#TABPY_EVALUATE_TIMEOUT = 30 | ||
|
||
[loggers] | ||
keys=root | ||
|
||
[handlers] | ||
keys=rootHandler,rotatingFileHandler | ||
|
||
[formatters] | ||
keys=rootFormatter | ||
|
||
[logger_root] | ||
level=DEBUG | ||
handlers=rootHandler,rotatingFileHandler | ||
qualname=root | ||
propagete=0 | ||
|
||
[handler_rootHandler] | ||
class=StreamHandler | ||
level=DEBUG | ||
formatter=rootFormatter | ||
args=(sys.stdout,) | ||
|
||
[handler_rotatingFileHandler] | ||
class=handlers.RotatingFileHandler | ||
level=DEBUG | ||
formatter=rootFormatter | ||
args=('tabpy_log.log', 'a', 1000000, 5) | ||
|
||
[formatter_rootFormatter] | ||
format=%(asctime)s [%(levelname)s] (%(filename)s:%(module)s:%(lineno)d): %(message)s | ||
datefmt=%Y-%m-%d,%H:%M:%S |
34 changes: 34 additions & 0 deletions
34
tests/integration/test_deploy_and_evaluate_model_auth_on.py
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,34 @@ | ||
from . import integ_test_base | ||
|
||
|
||
class TestDeployAndEvaluateModelAuthOn(integ_test_base.IntegTestBase): | ||
def _get_config_file_name(self) -> str: | ||
return "./tests/integration/resources/deploy_and_evaluate_model_auth.conf" | ||
|
||
def _get_port(self) -> str: | ||
return "9009" | ||
|
||
def test_deploy_and_evaluate_model(self): | ||
# Uncomment the following line to preserve | ||
# test case output and other files (config, state, ect.) | ||
# in system temp folder. | ||
# self.set_delete_temp_folder(False) | ||
|
||
self.deploy_models(self._get_username(), self._get_password()) | ||
|
||
headers = { | ||
"Content-Type": "application/json", | ||
"Authorization": "Basic dXNlcjE6UEBzc3cwcmQ=", | ||
"Host": "localhost:9009", | ||
} | ||
payload = """{ | ||
"data": { "_arg1": ["happy", "sad", "neutral"] }, | ||
"script": | ||
"return tabpy.query('Sentiment Analysis',_arg1)['response']" | ||
}""" | ||
|
||
conn = self._get_connection() | ||
conn.request("POST", "/evaluate", payload, headers) | ||
SentimentAnalysis_eval = conn.getresponse() | ||
self.assertEqual(200, SentimentAnalysis_eval.status) | ||
SentimentAnalysis_eval.read() |
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 |
---|---|---|
|
@@ -162,4 +162,3 @@ def test_creds_no_auth_fails(self): | |
}, | ||
) | ||
self.assertEqual(400, response.code) | ||
|