Skip to content

Commit

Permalink
Updated variable naming.
Browse files Browse the repository at this point in the history
  • Loading branch information
hfekete committed Mar 19, 2024
1 parent 746bfd1 commit 32b5d2a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 2 additions & 0 deletions btr-api/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ POD_NAMESPACE=local
LD_SDK_KEY=

# Registry Integration Services
AUTH_SVC_API_URL=
AUTH_SVC_API_VERSION=/api/v1
PAY_API_URL=
PAY_API_VERSION=/api/v1
LEGAL_API_URL=
Expand Down
2 changes: 1 addition & 1 deletion btr-api/src/btr_api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class Config: # pylint: disable=too-few-public-methods
JWT_OIDC_FIRSTNAME = os.getenv('JWT_OIDC_FIRSTNAME', 'firstname')
JWT_OIDC_LASTNAME = os.getenv('JWT_OIDC_LASTNAME', 'lastname')

AUTH_SVC_URL = os.getenv('AUTH_SVC_URL', '')
AUTH_API_URL = os.getenv('AUTH_API_URL', '') + os.getenv('AUTH_API_VERSION', '')
PAYMENT_SVC_URL = os.getenv('PAY_API_URL', '') + os.getenv('PAY_API_VERSION', '')
LEGAL_SVC_URL = os.getenv('LEGAL_API_URL', '') + os.getenv('LEGAL_API_VERSION_2', '')
BOR_SVC_URL = os.getenv('BOR_API_URL', '') + os.getenv('BOR_API_VERSION', '')
Expand Down
2 changes: 1 addition & 1 deletion btr-api/src/btr_api/services/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(self, app: Flask = None):
def init_app(self, app: Flask):
"""Initialize app dependent variables."""
self.app = app
self.svc_url = app.config.get('AUTH_SVC_URL')
self.svc_url = app.config.get('AUTH_API_URL')
self.timeout = app.config.get('AUTH_API_TIMEOUT', 20)
self.sso_svc_token_url = app.config.get('SSO_SVC_TOKEN_URL')
self.sso_svc_timeout = app.config.get('SSO_SVC_TIMEOUT', 20)
Expand Down
18 changes: 9 additions & 9 deletions btr-api/tests/unit/resources/test_submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_get_plots(app, client, session, jwt, requests_mock, test_name, submissi
session.commit()
id = sub.id

requests_mock.get(f"{app.config.get('AUTH_SVC_URL')}/entities/{sub.business_identifier}/authorizations",
requests_mock.get(f"{app.config.get('AUTH_API_URL')}/entities/{sub.business_identifier}/authorizations",
json={"orgMembership": "COORDINATOR", 'roles': ['edit', 'view']})
# Test
rv = client.get(f'/plots/{id}',
Expand Down Expand Up @@ -82,7 +82,7 @@ def test_get_plots_auth(app, client, session, jwt, requests_mock, test_name, bus
session.commit()
search_id = sub.id

requests_mock.get(f"{app.config.get('AUTH_SVC_URL')}/entities/{business_identifier}/authorizations",
requests_mock.get(f"{app.config.get('AUTH_API_URL')}/entities/{business_identifier}/authorizations",
json=auth_svc_response)

headers = create_header(jwt,
Expand Down Expand Up @@ -118,7 +118,7 @@ def test_post_plots_db_mocked(app, session, client, jwt, mocker, requests_mock):

mocked_entity_response = {"business": {"adminFreeze": False, "state": "ACTIVE"}}
identifier = json_data['businessIdentifier']
requests_mock.get(f"{app.config.get('AUTH_SVC_URL')}/entities/{identifier}/authorizations",
requests_mock.get(f"{app.config.get('AUTH_API_URL')}/entities/{identifier}/authorizations",
json={"orgMembership": "COORDINATOR", 'roles': ['edit', 'view']})
legal_api_mock = requests_mock.get(
f"{app.config.get('LEGAL_SVC_URL')}/businesses/{identifier}",
Expand Down Expand Up @@ -200,7 +200,7 @@ def test_post_plots(app, client, session, jwt, requests_mock):

mocked_entity_response = {"business": {"adminFreeze": False, "state": "ACTIVE"}}
identifier = json_data['businessIdentifier']
requests_mock.get(f"{app.config.get('AUTH_SVC_URL')}/entities/{identifier}/authorizations",
requests_mock.get(f"{app.config.get('AUTH_API_URL')}/entities/{identifier}/authorizations",
json={"orgMembership": "COORDINATOR", 'roles': ['edit', 'view']})
legal_api_mock = requests_mock.get(
f"{app.config.get('LEGAL_SVC_URL')}/businesses/{identifier}",
Expand Down Expand Up @@ -252,7 +252,7 @@ def test_post_plots_pay_error(app, client, session, jwt, requests_mock):

mocked_entity_response = {"business": {"adminFreeze": False, "state": "ACTIVE"}}
identifier = json_data['businessIdentifier']
requests_mock.get(f"{app.config.get('AUTH_SVC_URL')}/entities/{identifier}/authorizations",
requests_mock.get(f"{app.config.get('AUTH_API_URL')}/entities/{identifier}/authorizations",
json={"orgMembership": "COORDINATOR", 'roles': ['edit', 'view']})
legal_api_mock = requests_mock.get(
f"{app.config.get('LEGAL_SVC_URL')}/businesses/{identifier}",
Expand Down Expand Up @@ -296,7 +296,7 @@ def test_post_plots_auth_error(app, client, session, jwt, requests_mock):

mocked_entity_response = {"business": {"adminFreeze": False, "state": "ACTIVE"}}
identifier = json_data['businessIdentifier']
requests_mock.get(f"{app.config.get('AUTH_SVC_URL')}/entities/{identifier}/authorizations",
requests_mock.get(f"{app.config.get('AUTH_API_URL')}/entities/{identifier}/authorizations",
json={"orgMembership": "COORDINATOR", 'roles': ['edit', 'view']})
legal_api_mock = requests_mock.get(
f"{app.config.get('LEGAL_SVC_URL')}/businesses/{identifier}",
Expand Down Expand Up @@ -339,7 +339,7 @@ def test_post_plots_bor_error(app, client, session, jwt, requests_mock):

mocked_entity_response = {"business": {"adminFreeze": False, "state": "ACTIVE"}}
identifier = json_data['businessIdentifier']
requests_mock.get(f"{app.config.get('AUTH_SVC_URL')}/entities/{identifier}/authorizations",
requests_mock.get(f"{app.config.get('AUTH_API_URL')}/entities/{identifier}/authorizations",
json={"orgMembership": "COORDINATOR", 'roles': ['edit', 'view']})
legal_api_mock = requests_mock.get(
f"{app.config.get('LEGAL_SVC_URL')}/businesses/{identifier}",
Expand Down Expand Up @@ -389,7 +389,7 @@ def test_post_plots_invalid_entity(app, client, session, jwt, requests_mock, tes

mocked_entity_response = {"business": {"adminFreeze": admin_freeze, "state": state}}
identifier = json_data['businessIdentifier']
requests_mock.get(f"{app.config.get('AUTH_SVC_URL')}/entities/{identifier}/authorizations",
requests_mock.get(f"{app.config.get('AUTH_API_URL')}/entities/{identifier}/authorizations",
json={"orgMembership": "COORDINATOR", 'roles': ['edit', 'view']})
legal_api_mock = requests_mock.get(
f"{app.config.get('LEGAL_SVC_URL')}/businesses/{identifier}",
Expand Down Expand Up @@ -438,7 +438,7 @@ def test_get_latest_for_entity(app, client, session, jwt, requests_mock):
(SubmissionService.create_submission(s2_dict, user.id)).save()
(SubmissionService.create_submission(s3_dict, user.id)).save()

requests_mock.get(f"{app.config.get('AUTH_SVC_URL')}/entities/{test_identifier}/authorizations",
requests_mock.get(f"{app.config.get('AUTH_API_URL')}/entities/{test_identifier}/authorizations",
json={"orgMembership": "COORDINATOR", 'roles': ['edit', 'view']})
# Test
rv = client.get(f'/plots/entity/{test_identifier}',
Expand Down

0 comments on commit 32b5d2a

Please sign in to comment.