Skip to content

Commit

Permalink
[tests][apps] updating previous tests to use new auth property on c…
Browse files Browse the repository at this point in the history
…onfig
  • Loading branch information
ryandeivert committed Oct 27, 2017
1 parent 9446e49 commit 3878e8c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions docs/source/app-development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ to outline what methods from the base ``AppIntegration`` class must be implement
def _get_oauth(self):
"""This should return the oauth token for this request"""
secret_key = self._config['auth']['secret_key']
client_id = self._config['auth']['client_id']
token = self._config['auth']['token']
secret_key = self._config.auth['secret_key']
client_id = self._config.auth['client_id']
token = self._config.auth['token']
# Do something to generate oauth
return generated_oauth
4 changes: 2 additions & 2 deletions tests/unit/app_integrations/test_apps/test_duo.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def setup(self):
@patch('logging.Logger.exception')
def test_generate_auth_hmac_failure(self, log_mock):
"""DuoApp - Generate Auth, hmac Failure"""
self._app._config['auth']['secret_key'] = {'bad_secret'}
self._app._config.auth['secret_key'] = {'bad_secret'}
assert_false(self._app._generate_auth('hostname', {}))
log_mock.assert_called_with('Could not generate hmac signature')

Expand Down Expand Up @@ -87,7 +87,7 @@ def _get_sample_logs(count, base_time):
@patch('requests.get')
def test_get_duo_logs_bad_headers(self, requests_mock):
"""DuoApp - Get Duo Logs, Bad Headers"""
self._app._config['auth']['secret_key'] = {'bad_secret'}
self._app._config.auth['secret_key'] = {'bad_secret'}
assert_false(self._app._get_duo_logs('hostname', 'full_url'))
requests_mock.assert_not_called()

Expand Down
6 changes: 3 additions & 3 deletions tests/unit/app_integrations/test_apps/test_onelogin.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def setup(self):

def set_config_values(self, region, client_id, client_secret):
"""Helper function to setup the auth values"""
self._app._config['auth']['region'] = region
self._app._config['auth']['client_id'] = client_id
self._app._config['auth']['client_secret'] = client_secret
self._app._config.auth['region'] = region
self._app._config.auth['client_id'] = client_id
self._app._config.auth['client_secret'] = client_secret

@patch('requests.post')
def test_generate_headers_bad_response(self, requests_mock):
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/app_integrations/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@ def test_is_success(self):
def test_scrub_auth_info(self):
"""AppIntegrationConfig - Scrub Auth Info"""
auth_key = '{}_auth'.format(FUNCTION_NAME)
param_dict = {auth_key: self._config['auth']}
param_dict = {auth_key: self._config.auth}
scrubbed_config = self._config._scrub_auth_info(param_dict, auth_key)
assert_equal(scrubbed_config[auth_key]['api_hostname'],
'*' * len(self._config['auth']['api_hostname']))
'*' * len(self._config.auth['api_hostname']))
assert_equal(scrubbed_config[auth_key]['integration_key'],
'*' * len(self._config['auth']['integration_key']))
'*' * len(self._config.auth['integration_key']))
assert_equal(scrubbed_config[auth_key]['secret_key'],
'*' * len(self._config['auth']['secret_key']))
'*' * len(self._config.auth['secret_key']))

0 comments on commit 3878e8c

Please sign in to comment.