Skip to content

Commit

Permalink
making contact required field in catalogue pages (#2718)
Browse files Browse the repository at this point in the history
* changing forms.py to make enquiries_contact as required and resolving test_admin fails

* adding tests for reference, master and dataset and resolving test_views fail
  • Loading branch information
tayyib-saddique authored Aug 10, 2023
1 parent 68900e2 commit d42c810
Show file tree
Hide file tree
Showing 4 changed files with 172 additions and 8 deletions.
5 changes: 5 additions & 0 deletions dataworkspace/dataworkspace/apps/dw_admin/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def __init__(self, *args, **kwargs):
self.fields["information_asset_owner"].required = True
if "information_asset_manager" in self.fields:
self.fields["information_asset_manager"].required = True
if "enquiries_contact" in self.fields:
self.fields["enquiries_contact"].required = True
if "sort_field" in self.fields:
self.fields["sort_field"].queryset = self.instance.fields.all()

Expand Down Expand Up @@ -531,6 +533,7 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields["information_asset_owner"].required = True
self.fields["information_asset_manager"].required = True
self.fields["enquiries_contact"].required = True

class Meta:
model = MasterDataset
Expand All @@ -545,6 +548,7 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields["information_asset_owner"].required = True
self.fields["information_asset_manager"].required = True
self.fields["enquiries_contact"].required = True

class Meta:
model = MasterDataset
Expand Down Expand Up @@ -718,6 +722,7 @@ def __init__(self, *args, **kwargs):

self.fields["information_asset_owner"].required = True
self.fields["information_asset_manager"].required = True
self.fields["enquiries_contact"].required = True


class VisualisationLinkForm(forms.ModelForm):
Expand Down
1 change: 1 addition & 0 deletions dataworkspace/dataworkspace/tests/datasets/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4795,6 +4795,7 @@ def test_csv_upload(
published=True,
user_access_type=UserAccessType.REQUIRES_AUTHENTICATION,
information_asset_manager=user,
enquiries_contact=user,
),
schema="test",
table="table1",
Expand Down
1 change: 1 addition & 0 deletions dataworkspace/dataworkspace/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class DataSetFactory(factory.django.DjangoModelFactory):
type = DataSetType.DATACUT
information_asset_owner = factory.SubFactory(UserFactory)
information_asset_manager = factory.SubFactory(UserFactory)
enquiries_contact = factory.SubFactory(UserFactory)

class Meta:
model = "datasets.DataSet"
Expand Down
Loading

0 comments on commit d42c810

Please sign in to comment.