Skip to content

Commit

Permalink
Securities Act Notice add flag to user profile, update unit test.
Browse files Browse the repository at this point in the history
Signed-off-by: Doug Lovett <[email protected]>
  • Loading branch information
doug-lovett committed May 10, 2024
1 parent dfcc8ce commit 53ca5ce
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion ppr-api/src/ppr_api/resources/v1/user_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from flask import Blueprint, current_app, g, request
from flask_cors import cross_origin
from ppr_api.exceptions import BusinessException
from ppr_api.models import User, UserProfile
from ppr_api.models import ClientCode, User, UserProfile
from ppr_api.resources import utils as resource_utils
from ppr_api.services.authz import (
GENERAL_USER_GROUP,
Expand Down Expand Up @@ -64,6 +64,8 @@ def get_user_profile():
user.user_profile = UserProfile.create_from_json(None, user.id)
user.user_profile.save()
profile_json = set_service_agreements(jwt, user.user_profile)
parties = ClientCode.find_by_account_id(account_id, False, True)
profile_json['hasSecuritiesActAccess'] = parties is not None and len(parties) > 0
return profile_json, HTTPStatus.OK

except BusinessException as exception:
Expand Down
1 change: 1 addition & 0 deletions ppr-api/tests/unit/api/test_user_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def test_get_user_profile(session, client, jwt, desc, staff, include_account, st
assert 'selectConfirmationDialog' in response_data
assert 'defaultDropDowns' in response_data
assert 'defaultTableFilters' in response_data
assert 'hasSecuritiesActAccess' in response_data


@pytest.mark.parametrize('desc,staff,include_account,status,role,data', TEST_DATA_UPDATE)
Expand Down
2 changes: 1 addition & 1 deletion ppr-api/tests/unit/api/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def test_validate_registration(session, client, jwt, desc, valid):
del json_data['authorizationReceived']

# test
error_msg = resource_utils.validate_registration(json_data)
error_msg = resource_utils.validate_registration(json_data, 'PS12345')
if valid:
assert error_msg == ''
else:
Expand Down

0 comments on commit 53ca5ce

Please sign in to comment.