Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update DIT with DBT in metadata #5872

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions datahub/company/test/test_company_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class TestListCompanies(APITestMixin):

def test_companies_list_no_permissions(self):
"""Should return 403"""
user = create_test_user(dit_team=TeamFactory())
user = create_test_user(dbt_team=TeamFactory())
api_client = self.create_api_client(user=user)
url = reverse('api-v4:company:collection')
response = api_client.get(url)
Expand Down Expand Up @@ -444,16 +444,16 @@ def test_get(self):
'first_name': ghq.one_list_account_owner.first_name,
'last_name': ghq.one_list_account_owner.last_name,
'contact_email': ghq.one_list_account_owner.contact_email,
'dit_team': {
'id': str(ghq.one_list_account_owner.dit_team.id),
'name': ghq.one_list_account_owner.dit_team.name,
'dbt_team': {
'id': str(ghq.one_list_account_owner.dbt_team.id),
'name': ghq.one_list_account_owner.dbt_team.name,
'uk_region': {
'id': str(ghq.one_list_account_owner.dit_team.uk_region.pk),
'name': ghq.one_list_account_owner.dit_team.uk_region.name,
'id': str(ghq.one_list_account_owner.dbt_team.uk_region.pk),
'name': ghq.one_list_account_owner.dbt_team.uk_region.name,
},
'country': {
'id': str(ghq.one_list_account_owner.dit_team.country.pk),
'name': ghq.one_list_account_owner.dit_team.country.name,
'id': str(ghq.one_list_account_owner.dbt_team.country.pk),
'name': ghq.one_list_account_owner.dbt_team.country.name,
},
},
},
Expand Down Expand Up @@ -786,16 +786,16 @@ def test_one_list_group_global_account_manager(self, build_company):
'first_name': global_account_manager.first_name,
'last_name': global_account_manager.last_name,
'contact_email': global_account_manager.contact_email,
'dit_team': {
'id': str(global_account_manager.dit_team.id),
'name': global_account_manager.dit_team.name,
'dbt_team': {
'id': str(global_account_manager.dbt_team.id),
'name': global_account_manager.dbt_team.name,
'uk_region': {
'id': str(global_account_manager.dit_team.uk_region.pk),
'name': global_account_manager.dit_team.uk_region.name,
'id': str(global_account_manager.dbt_team.uk_region.pk),
'name': global_account_manager.dbt_team.uk_region.name,
},
'country': {
'id': str(global_account_manager.dit_team.country.pk),
'name': global_account_manager.dit_team.country.name,
'id': str(global_account_manager.dbt_team.country.pk),
'name': global_account_manager.dbt_team.country.name,
},
},
}
Expand Down
24 changes: 12 additions & 12 deletions datahub/company/test/test_contact_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def test_with_manual_address(self, get_consent_fixture):
},
'address_postcode': 'SW1A1AA',
'notes': 'lorem ipsum',
'accepts_dit_email_marketing': True,
'accepts_dbt_email_marketing': True,
},
)

Expand Down Expand Up @@ -137,7 +137,7 @@ def test_with_manual_address(self, get_consent_fixture):
},
'address_postcode': 'SW1A1AA',
'notes': 'lorem ipsum',
'accepts_dit_email_marketing': True,
'accepts_dbt_email_marketing': True,
'archived': False,
'archived_by': None,
'archived_documents_url_path': '',
Expand Down Expand Up @@ -205,7 +205,7 @@ def test_defaults(self):
assert not response_data['address_country']
assert not response_data['address_postcode']
assert not response_data['notes']
assert not response_data['accepts_dit_email_marketing']
assert not response_data['accepts_dbt_email_marketing']

def test_fails_with_invalid_email_address(self):
"""Test that fails if the email address is invalid."""
Expand Down Expand Up @@ -408,7 +408,7 @@ def test_with_us_manual_address(self, get_consent_fixture):
},
'address_postcode': 'SW1A1AA',
'notes': 'lorem ipsum',
'accepts_dit_email_marketing': True,
'accepts_dbt_email_marketing': True,
'valid_email': True,
},
)
Expand Down Expand Up @@ -452,7 +452,7 @@ def test_with_us_manual_address(self, get_consent_fixture):
},
'address_postcode': 'SW1A1AA',
'notes': 'lorem ipsum',
'accepts_dit_email_marketing': True,
'accepts_dbt_email_marketing': True,
'archived': False,
'archived_by': None,
'archived_documents_url_path': '',
Expand Down Expand Up @@ -573,7 +573,7 @@ def test_patch(self):
},
'address_postcode': 'SW1A1AA',
'notes': 'lorem ipsum',
'accepts_dit_email_marketing': False,
'accepts_dbt_email_marketing': False,
'archived': False,
'archived_by': None,
'archived_documents_url_path': contact.archived_documents_url_path,
Expand Down Expand Up @@ -771,7 +771,7 @@ def test_patch_area(self):
},
'address_postcode': 'SW1A1AA',
'notes': 'lorem ipsum',
'accepts_dit_email_marketing': False,
'accepts_dbt_email_marketing': False,
'archived': False,
'archived_by': None,
'archived_documents_url_path': contact.archived_documents_url_path,
Expand Down Expand Up @@ -961,7 +961,7 @@ def test_view(self):
},
'address_postcode': 'YO22 4JU',
'notes': 'lorem ipsum',
'accepts_dit_email_marketing': False,
'accepts_dbt_email_marketing': False,
'archived': False,
'archived_by': None,
'archived_documents_url_path': contact.archived_documents_url_path,
Expand Down Expand Up @@ -1029,7 +1029,7 @@ def test_accepts_dit_email_marketing_consent_service(

assert requests_mock.call_count == 1
assert response.status_code == status.HTTP_200_OK
assert response.json()['accepts_dit_email_marketing'] == accepts_marketing
assert response.json()['accepts_dbt_email_marketing'] == accepts_marketing

@pytest.mark.parametrize(
'response_status',
Expand Down Expand Up @@ -1059,7 +1059,7 @@ def test_accepts_dit_email_marketing_consent_service_http_error(
response = api_client.get(url)

assert requests_mock.call_count == 1
assert response.json()['accepts_dit_email_marketing'] is False
assert response.json()['accepts_dbt_email_marketing'] is False

@pytest.mark.parametrize(
'exceptions',
Expand All @@ -1086,7 +1086,7 @@ def test_accepts_dit_email_marketing_consent_service_error(
response = api_client.get(url)

assert requests_mock.call_count == 1
assert response.json()['accepts_dit_email_marketing'] is False
assert response.json()['accepts_dbt_email_marketing'] is False


class TestViewContactV3(ViewContactBase):
Expand All @@ -1108,7 +1108,7 @@ class ContactListBase(APITestMixin):

def test_contact_list_no_permissions(self):
"""Should return 403"""
user = create_test_user(dit_team=TeamFactory())
user = create_test_user(dbt_team=TeamFactory())
api_client = self.create_api_client(user=user)
url = reverse(f'{self.endpoint_namespace}:contact:list')
response = api_client.get(url)
Expand Down
38 changes: 19 additions & 19 deletions datahub/search/investment/test/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,7 @@ class TestSearchPermissions(APITestMixin):

def test_investment_project_no_permissions(self):
"""Should return 403"""
user = create_test_user(dit_team=TeamFactory())
user = create_test_user(dbt_team=TeamFactory())
api_client = self.create_api_client(user=user)
url = reverse('api-v3:search:investment_project')
response = api_client.get(url)
Expand All @@ -1194,12 +1194,12 @@ def test_non_restricted_user_can_see_all_projects(
"""Test that normal users can see all projects."""
team = TeamFactory()
team_others = TeamFactory()
adviser_1 = AdviserFactory(dit_team_id=team.id)
adviser_2 = AdviserFactory(dit_team_id=team_others.id)
adviser_1 = AdviserFactory(dbt_team_id=team.id)
adviser_2 = AdviserFactory(dbt_team_id=team_others.id)

request_user = create_test_user(
permission_codenames=permissions,
dit_team=team,
dbt_team=team,
)
api_client = self.create_api_client(user=request_user)

Expand Down Expand Up @@ -1228,7 +1228,7 @@ def test_restricted_user_with_no_team_cannot_see_projects(self, opensearch_with_
"""
url = reverse('api-v3:search:investment_project')

adviser_other = AdviserFactory(dit_team_id=None)
adviser_other = AdviserFactory(dbt_team_id=None)
request_user = create_test_user(
permission_codenames=['view_associated_investmentproject'],
)
Expand All @@ -1251,11 +1251,11 @@ def test_restricted_users_cannot_see_other_teams_projects(self, opensearch_with_

team = TeamFactory()
team_other = TeamFactory()
adviser_other = AdviserFactory(dit_team_id=team_other.id)
adviser_same_team = AdviserFactory(dit_team_id=team.id)
adviser_other = AdviserFactory(dbt_team_id=team_other.id)
adviser_same_team = AdviserFactory(dbt_team_id=team.id)
request_user = create_test_user(
permission_codenames=['view_associated_investmentproject'],
dit_team=team,
dbt_team=team,
)
api_client = self.create_api_client(user=request_user)

Expand Down Expand Up @@ -1583,7 +1583,7 @@ class TestInvestmentProjectExportView(APITestMixin):
)
def test_user_without_permission_cannot_export(self, opensearch, permissions):
"""Test that a user without the correct permissions cannot export data."""
user = create_test_user(dit_team=TeamFactory(), permission_codenames=permissions)
user = create_test_user(dbt_team=TeamFactory(), permission_codenames=permissions)
api_client = self.create_api_client(user=user)

url = reverse('api-v3:search:investment_project-export')
Expand All @@ -1594,14 +1594,14 @@ def test_restricted_users_cannot_see_other_teams_projects(self, opensearch_with_
"""Test that restricted users cannot see other teams' projects in the export."""
team = TeamFactory()
team_other = TeamFactory()
adviser_other = AdviserFactory(dit_team_id=team_other.id)
adviser_same_team = AdviserFactory(dit_team_id=team.id)
adviser_other = AdviserFactory(dbt_team_id=team_other.id)
adviser_same_team = AdviserFactory(dbt_team_id=team.id)
request_user = create_test_user(
permission_codenames=(
InvestmentProjectPermission.view_associated,
InvestmentProjectPermission.export,
),
dit_team=team,
dbt_team=team,
)
api_client = self.create_api_client(user=request_user)

Expand Down Expand Up @@ -1882,12 +1882,12 @@ def test_global_non_restricted_user_can_see_all_projects(
"""Test that normal users can see all projects."""
team = TeamFactory()
team_others = TeamFactory()
adviser_1 = AdviserFactory(dit_team_id=team.id)
adviser_2 = AdviserFactory(dit_team_id=team_others.id)
adviser_1 = AdviserFactory(dbt_team_id=team.id)
adviser_2 = AdviserFactory(dbt_team_id=team_others.id)

request_user = create_test_user(
permission_codenames=permissions,
dit_team=team,
dbt_team=team,
)
api_client = self.create_api_client(user=request_user)

Expand Down Expand Up @@ -1924,11 +1924,11 @@ def test_global_restricted_users_cannot_see_other_teams_projects(
"""
team = TeamFactory()
team_other = TeamFactory()
adviser_other = AdviserFactory(dit_team_id=team_other.id)
adviser_same_team = AdviserFactory(dit_team_id=team.id)
adviser_other = AdviserFactory(dbt_team_id=team_other.id)
adviser_same_team = AdviserFactory(dbt_team_id=team.id)
request_user = create_test_user(
permission_codenames=['view_associated_investmentproject'],
dit_team=team,
dbt_team=team,
)
api_client = self.create_api_client(user=request_user)

Expand Down Expand Up @@ -1976,7 +1976,7 @@ def test_global_restricted_user_with_no_team_cannot_see_projects(
Checks that a restricted user that doesn't have a team cannot view projects associated
with other advisers that don't have teams.
"""
adviser_other = AdviserFactory(dit_team_id=None)
adviser_other = AdviserFactory(dbt_team_id=None)
request_user = create_test_user(
permission_codenames=['view_associated_investmentproject'],
)
Expand Down
2 changes: 1 addition & 1 deletion datahub/search/large_investor_profile/test/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ def test_user_needs_correct_permissions_to_export_data(
self, opensearch, permissions, expected_status_code,
):
"""Test that a user without the correct permissions cannot export data."""
user = create_test_user(dit_team=TeamFactory(), permission_codenames=permissions)
user = create_test_user(dbt_team=TeamFactory(), permission_codenames=permissions)
api_client = self.create_api_client(user=user)

url = reverse('api-v4:search:large-investor-profile-export')
Expand Down
6 changes: 3 additions & 3 deletions fixtures/metadata/referrals.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@
fields: {name: "Invest in GREAT Britain"}
- model: metadata.referralsourcewebsite
pk: cbde665e-9121-46d5-ba54-24e1e6c4aa77
fields: {name: "DIT Global Website"}
fields: {name: "DBT Global Website"}
- model: metadata.referralsourcewebsite
pk: 7524c091-2d60-4a52-90e3-cc647c92b140
fields: {name: "DIT Regional Website"}
pk: 7524c091-2d60-4a52-90e3-cc647c92b140
fields: {name: "DBT Regional Website"}
- model: metadata.referralsourcewebsite
pk: 072241d4-22d0-4657-8d8e-1848a0519b0a
fields: {name: "Other website"}
Expand Down
Loading
Loading